Salome HOME
Attempt of Management of profiles in spliter
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingDataArrayTypemaps.i
index ef8946fbf70a1d660f74c9b5fae443c991165217..29049764bbb540c2c9968f111e9894176a4c7850 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 #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 <sstream>
 
+static PyObject *convertArray(MEDCoupling::DataArray *array, int owner)
+{
+  PyObject *ret(NULL);
+  if(!array)
+    {
+      Py_XINCREF(Py_None);
+      return Py_None;
+    }
+  if(dynamic_cast<MEDCoupling::DataArrayDouble *>(array))
+    ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
+  if(dynamic_cast<MEDCoupling::DataArrayInt *>(array))
+    ret=SWIG_NewPointerObj((void*)array,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
+  if(dynamic_cast<MEDCoupling::DataArrayFloat *>(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
+ * This method is an extension 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<PySliceObject *>(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<int>::max(),start,stop,step));
+  int ret(PySlice_GetIndices(
+#if PY_VERSION_HEX >= 0x03000000
+        slice,
+#else
+        reinterpret_cast<PySliceObject *>(slice),
+#endif
+        std::numeric_limits<int>::max(),start,stop,step));
   if(ret==0)
     {
       if(*start!=std::numeric_limits<int>::max() && *stop!=std::numeric_limits<int>::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<class MCData>
@@ -146,7 +182,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype
           std::size_t nbOfElems(sz0*sz1);
           T *dataCpy=(T*)malloc(sizeof(T)*nbOfElems);
           std::copy(reinterpret_cast<const T*>(data),reinterpret_cast<const T*>(data)+nbOfElems,dataCpy);
-          ret->useArray(dataCpy,true,MEDCoupling::C_DEALLOC,sz0,sz1);
+          ret->useArray(dataCpy,true,MEDCoupling::DeallocType::C_DEALLOC,sz0,sz1);
           return ret.retn();
         }
       typename MEDCoupling::MemArray<T>& mma=ret->accessToMemArray();
@@ -154,7 +190,7 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype
         {
           PyCallBackDataArraySt<MCData> *cb=PyObject_GC_New(PyCallBackDataArraySt<MCData>,pytype);
           cb->_pt_mc=ret;
-          ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::C_DEALLOC,sz0,sz1);
+          ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::DeallocType::C_DEALLOC,sz0,sz1);
           PyObject *ref=PyWeakref_NewRef(deepestObj,(PyObject *)cb);
           void **objs=new void *[2]; objs[0]=cb; objs[1]=ref;
           mma.setParameterForDeallocator(objs);
@@ -163,17 +199,23 @@ MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype
         }
       else
         {
-          ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::C_DEALLOC,sz0,sz1);
+          ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::DeallocType::C_DEALLOC_WITH_OFFSET,sz0,sz1);
           PyObject *ref=PyWeakref_NewRef(reinterpret_cast<PyObject *>(eltOwning),NULL);
-          typename MEDCoupling::MemArray<T>::Deallocator tmp(MEDCoupling::MemArray<T>::CDeallocator);
+          typename MEDCoupling::MemArray<T>::Deallocator tmp(MEDCoupling::MemArray<T>::COffsetDeallocator);
           void **tmp2 = reinterpret_cast<void**>(&tmp); // MSVC2010 does not support constructor()
-          void **objs=new void *[2]; objs[0]=ref; objs[1]=*tmp2;
+          const char *dataEltOwning(PyArray_BYTES(eltOwning));//In case of input array is a sub array of a 2D,3D... array there is an offset
+          int64_t offset(0);
+          if(data!=dataEltOwning)
+            {
+              offset=data>dataEltOwning?-((int64_t)(std::distance(dataEltOwning,data))):(int64_t)std::distance(data,dataEltOwning);
+            }
+          void **objs=new void *[3]; objs[0]=ref; objs[1]=*tmp2; objs[2]=new int64_t(offset);
           mma.setParameterForDeallocator(objs);
           mma.setSpecificDeallocator(numarrdeal);
         }
     }
   else if(PyArray_ISBEHAVED_RO(elt0))
-    ret->useArray(reinterpret_cast<const T *>(data),false,MEDCoupling::CPP_DEALLOC,sz0,sz1);
+    ret->useArray(reinterpret_cast<const T *>(data),false,MEDCoupling::DeallocType::CPP_DEALLOC,sz0,sz1);
   return ret.retn();
 }
 
@@ -200,27 +242,27 @@ int NumpyArrSetBaseObjectExt(PyArrayObject *arr, PyObject *obj)
 
     /*
      * Don't allow infinite chains of views, always set the base
-     * to the first owner of the data.  
-     * That is, either the first object which isn't an array, 
+     * to the first owner of the data.
+     * That is, either the first object which isn't an array,
      * or the first object which owns its own data.
      */
 
     while (PyArray_Check(obj) && (PyObject *)arr != obj) {
         PyArrayObject *obj_arr = (PyArrayObject *)obj;
         PyObject *tmp;
+
 
         /* If this array owns its own data, stop collapsing */
-        if (PyArray_CHKFLAGS(obj_arr, MED_NUMPY_OWNDATA )) { 
+        if (PyArray_CHKFLAGS(obj_arr, MED_NUMPY_OWNDATA )) {
             break;
-        }   
+        }
 
         tmp = PyArray_BASE(obj_arr);
         /* If there's no base, stop collapsing */
         if (tmp == NULL) {
             break;
         }
-        /* Stop the collapse new base when the would not be of the same 
+        /* Stop the collapse new base when the would not be of the same
          * type (i.e. different subclass).
          */
         if (Py_TYPE(tmp) != Py_TYPE(arr)) {
@@ -257,7 +299,7 @@ PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *M
   MEDCoupling::MemArray<T>& mem=self->accessToMemArray();
   if(nbComp==0)
     {
-      std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !"; 
+      std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   int nbDims=nbComp==1?1:2;
@@ -272,7 +314,7 @@ PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *M
           PyObject *ref(PyWeakref_NewRef(ret,NULL));
           typename MEDCoupling::MemArray<T>::Deallocator tmp(mem.getDeallocator());
           void **tmp2 = reinterpret_cast<void**>(&tmp); // MSVC2010 does not support constructor()
-          void **objs=new void *[2]; objs[0]=reinterpret_cast<void*>(ref); objs[1]=*tmp2;
+          void **objs=new void *[3]; objs[0]=reinterpret_cast<void*>(ref); objs[1]=*tmp2; objs[2]=new int64_t(0);
           mem.setParameterForDeallocator(objs);
           mem.setSpecificDeallocator(numarrdeal);
           return ret;
@@ -307,7 +349,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<std::map<int,double> >& m, int nbCols) throw(INTERP_KERNEL::Exception)
+#endif
+
+#ifdef WITH_SCIPY
+PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols)
 {
   int nbRows((int)m.size());
   MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
@@ -349,7 +394,9 @@ PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& 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 +413,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 +436,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<size;i++)
@@ -397,7 +444,7 @@ static PyObject *convertIntArrToPyList(const int *ptr, int size) throw(INTERP_KE
   return ret;
 }
 
-static PyObject *convertIntArrToPyList2(const std::vector<int>& v) throw(INTERP_KERNEL::Exception)
+static PyObject *convertIntArrToPyList2(const std::vector<int>& v)
 {
   int size=v.size();
   PyObject *ret=PyList_New(size);
@@ -406,7 +453,7 @@ static PyObject *convertIntArrToPyList2(const std::vector<int>& v) throw(INTERP_
   return ret;
 }
 
-static PyObject *convertIntArrToPyList3(const std::set<int>& v) throw(INTERP_KERNEL::Exception)
+static PyObject *convertIntArrToPyList3(const std::set<int>& v)
 {
   int size=v.size();
   PyObject *ret=PyList_New(size);
@@ -416,7 +463,45 @@ static PyObject *convertIntArrToPyList3(const std::set<int>& 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 string 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<nbOfTuples;i++)
@@ -429,7 +514,7 @@ static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int
   return ret;
 }
 
-static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception)
+static int *convertPyToNewIntArr2(PyObject *pyLi, int *size)
 {
   if(PyList_Check(pyLi))
     {
@@ -477,7 +562,7 @@ static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL
     }
 }
 
-static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
+static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr)
 {
   PyObject *ret=PyList_New(arr.size());
   for(std::size_t i=0;i<arr.size();i++)
@@ -490,7 +575,7 @@ static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int>
   return ret;
 }
 
-static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& 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 +632,7 @@ static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair<std::string,int> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair<std::string,int> >& 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 +648,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 +671,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 +685,7 @@ static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pai
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr)
 {
   if(PyList_Check(pyLi))
     {
@@ -644,7 +725,7 @@ static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr) throw(I
     }
 }
 
-static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector<int>& arr)
 {
   if(recurseLev<0)
     throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !");
@@ -701,7 +782,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 +877,7 @@ static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector<in
     throw INTERP_KERNEL::Exception("fillArrayWithPyListInt3 : Unrecognized type ! Should be a composition of tuple,list,int !");
 }
 
-static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
+static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp)
 {
   std::vector<int> ret;
   int size1=-1,size2=-1;
@@ -829,7 +910,7 @@ static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples,
   return ret;
 }
 
-static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) throw(INTERP_KERNEL::Exception)
+static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec)
 {
   if(PyList_Check(pyLi))
     {
@@ -838,9 +919,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
       for(int i=0;i<sz;i++)
         {
           PyObject *o=PyList_GetItem(pyLi,i);
-          if(PyString_Check(o))
-            vec[i]=PyString_AsString(o);
-          else
+          if(!convertPyObjectToStrNT(o,vec[i]))
             return false;
         }
       return true;
@@ -852,9 +931,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
       for(int i=0;i<sz;i++)
         {
           PyObject *o=PyTuple_GetItem(pyLi,i);
-          if(PyString_Check(o))
-            vec[i]=PyString_AsString(o);
-          else
+          if(!convertPyObjectToStrNT(o,vec[i]))
             return false;
         }
       return true;
@@ -862,7 +939,7 @@ static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) thro
   else
     return false;
 }
-static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector<std::string> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector<std::string> >& arr)
 {
   const char msg[]="convertPyToVectorOfVectorOfString : expecting list of list of strings !";
   if(PyList_Check(pyLi))
@@ -891,7 +968,7 @@ static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec) throw(INTERP_KERNEL::Exception)
+static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec)
 {
   if(PyList_Check(pyLi))
     {
@@ -925,7 +1002,7 @@ static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec) throw(INTERP_KE
     return false;
 }
 
-static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& arr)
 {
   const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !";
   if(PyList_Check(pyLi))
@@ -954,7 +1031,7 @@ static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vec
     throw INTERP_KERNEL::Exception(msg);
 }
 
-static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair<std::string, std::vector<std::string> > >& arr) throw(INTERP_KERNEL::Exception)
+static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair<std::string, std::vector<std::string> > >& 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 +1048,7 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st
                 throw INTERP_KERNEL::Exception(msg);
               std::pair<std::string, std::vector<std::string> > 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 +1072,7 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st
                 throw INTERP_KERNEL::Exception(msg);
               std::pair<std::string, std::vector<std::string> > 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 +1087,7 @@ static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< st
 }
 
 template<class T>
-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<size;i++)
@@ -1022,7 +1095,7 @@ PyObject *convertDblArrToPyList(const T *ptr, int size) throw(INTERP_KERNEL::Exc
   return ret;
 }
 
-static PyObject *convertDblArrToPyList2(const std::vector<double>& v) throw(INTERP_KERNEL::Exception)
+static PyObject *convertDblArrToPyList2(const std::vector<double>& v)
 {
   int size(v.size());
   PyObject *ret(PyList_New(size));
@@ -1032,7 +1105,7 @@ static PyObject *convertDblArrToPyList2(const std::vector<double>& v) throw(INTE
 }
 
 template<class T>
-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<nbOfTuples;i++)
@@ -1045,7 +1118,7 @@ PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTupl
   return ret;
 }
 
-static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
+static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples)
 {
   PyObject *ret=PyList_New(nbOfTuples);
   INTERP_KERNEL::AutoPtr<char> tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0';
@@ -1057,7 +1130,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 +1254,7 @@ static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector<do
     throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl3 : Unrecognized type ! Should be a composition of tuple,list,int and float !");
 }
 
-static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
+static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp)
 {
   std::vector<double> ret;
   int size1=-1,size2=-1;
@@ -1272,7 +1345,7 @@ static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, cons
  *
  * switch between (int,vector<int>,DataArrayInt)
  */
-static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
+static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple)
 {
   sw=-1;
   if(PyInt_Check(value))
@@ -1327,7 +1400,7 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std:
     }
   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
       sw=4;
       return ;
@@ -1335,6 +1408,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<int> sw=2
+ * if python tuple[int] -> cpp vector<int> sw=2
+ * if python DataArrayInt -> cpp DataArrayInt sw=3
+ * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
+ *
+ * switch between (int,vector<int>,DataArrayInt)
+ */
+static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& 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<size;i++)
+        {
+          PyObject *o=PyTuple_GetItem(value,i);
+          if(PyInt_Check(o))
+            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=2; sz=size;
+      return &stdvecTyypp[0];
+    }
+  if(PyList_Check(value))
+    {
+      int size=PyList_Size(value);
+      stdvecTyypp.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyList_GetItem(value,i);
+          if(PyInt_Check(o))
+            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=2; sz=size;
+      return &stdvecTyypp[0];
+    }
+  void *argp;
+  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
+  if(SWIG_IsOK(status))
+    {
+      MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(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 +1500,7 @@ static void convertObjToPossibleCpp1(PyObject *value, int& sw, int& iTyypp, std:
  * switch between (int,vector<int>,DataArrayInt)
  */
 template<class T>
-void convertObjToPossibleCpp4(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti) throw(INTERP_KERNEL::Exception)
+void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti)
 {
   sw=-1;
   if(PyFloat_Check(value))
@@ -1421,7 +1574,7 @@ void convertObjToPossibleCpp4(PyObject *value, int& sw, T& iTyypp, std::vector<T
  *
  * switch between (int,vector<int>,DataArrayInt)
  */
-static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp)
 {
   sw=-1;
   if(PyFloat_Check(value))
@@ -1484,6 +1637,106 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp,
   sw=3;
 }
 
+template<class T>
+void convertFPStarLikePyObjToCpp_2(PyObject *value, int& sw, T& val, typename MEDCoupling::Traits<T>::ArrayType *&d, typename MEDCoupling::Traits<T>::ArrayTuple *&e, std::vector<T>& 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<size;i++)
+        {
+          PyObject *o=PyTuple_GetItem(value,i);
+          if(PyFloat_Check(o))
+            f[i]=PyFloat_AS_DOUBLE(o);
+          else if(PyInt_Check(o))
+            f[i]=(T)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=4;
+      return;
+    }
+  if(PyList_Check(value))
+    {
+      int size=PyList_Size(value);
+      f.resize(size);
+      for(int i=0;i<size;i++)
+        {
+          PyObject *o=PyList_GetItem(value,i);
+          if(PyFloat_Check(o))
+            f[i]=PyFloat_AS_DOUBLE(o);
+          else if(PyInt_Check(o))
+            f[i]=(T)PyInt_AS_LONG(o);
+          else
+            {
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
+      sw=4;
+      return;
+    }
+  void *argp;
+  int status=SWIG_ConvertPtr(value,&argp,ti_da,0|0);
+  if(SWIG_IsOK(status))
+    {
+      d=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayType * >(argp);
+      sw=2;
+      return ;
+    }
+  status=SWIG_ConvertPtr(value,&argp,ti_tuple,0|0);
+  if(SWIG_IsOK(status))
+    {
+      e=reinterpret_cast< typename MEDCoupling::Traits<T>::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<double> sw=4
+ * if value tuple[int,double] -> cpp std::vector<double> sw=4
+ */
+static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
+{
+  convertFPStarLikePyObjToCpp_2<double>(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__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<double> sw=4
+ * if value tuple[int,double] -> cpp std::vector<double> sw=4
+ */
+static void convertFloatStarLikePyObjToCpp_2(PyObject *value, int& sw, float& val, MEDCoupling::DataArrayFloat *&d, MEDCoupling::DataArrayFloatTuple *&e, std::vector<float>& f)
+{
+  convertFPStarLikePyObjToCpp_2<float>(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple);
+}
+
 /*!
  * if python int -> cpp int sw=1
  * if python list[int] -> cpp vector<int> sw=2
@@ -1493,7 +1746,7 @@ static void convertObjToPossibleCpp44(PyObject *value, int& sw, double& iTyypp,
  *
  * switch between (int,vector<int>,DataArrayInt)
  */
-static void convertObjToPossibleCpp2(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertIntStarOrSliceLikePyObjToCpp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp)
 {
   const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
   sw=-1;
@@ -1542,8 +1795,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<PySliceObject *>(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 +1833,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<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayInt *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& 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 +1851,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<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp22(PyObject *value, int nbelem, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, std::pair<int, std::pair<int,int> >& p, MEDCoupling::DataArrayIntTuple *& daIntTyypp)
 {
   sw=-1;
   if(PyInt_Check(value))
@@ -1647,8 +1899,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<PySliceObject *>(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 +1921,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<string>,DataArrayChar)
  */
-static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, MEDCoupling::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception)
+static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& 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 +1942,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 +1968,11 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyTuple_GetItem(value,i);
-          if(PyString_Check(o))
-            vsType[i]=PyString_AsString(o);
-          else
+          try
+            {
+              vsType[i]=convertPyObjectToStr(o);
+            }
+          catch(INTERP_KERNEL::Exception& e)
             {
               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not a string ! only tuples of strings accepted !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
@@ -1716,11 +1988,13 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
       for(int i=0;i<size;i++)
         {
           PyObject *o=PyList_GetItem(value,i);
-          if(PyString_Check(o))
-            vsType[i]=PyString_AsString(o);
-          else
+          try
+            {
+              vsType[i]=convertPyObjectToStr(o);
+            }
+          catch(INTERP_KERNEL::Exception& e)
             {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not string ! only lists of strings accepted !";
+              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not a string ! only tuples of strings accepted !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
         }
@@ -1774,11 +2048,11 @@ static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::
  */
 static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector<int>& vt, std::vector<int>& vc,
                                      std::pair<int, std::pair<int,int> >& pt, std::pair<int, std::pair<int,int> >& 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,9 +2062,9 @@ 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;
     }
 }
@@ -1803,116 +2077,35 @@ static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo,
  * if value list[int,double] -> cpp std::vector<double> sw=4
  * if value tuple[int,double] -> cpp std::vector<double> sw=4
  */
-static void convertObjToPossibleCpp5(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
+static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
+                                                   const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt)
 {
   sw=-1;
   if(PyFloat_Check(value))
     {
       val=PyFloat_AS_DOUBLE(value);
       sw=1;
-      return;
+      if(nbTuplesExpected*nbCompExpected!=1)
+        {
+          std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyFloat) !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      return &val;
     }
   if(PyInt_Check(value))
     {
       val=(double)PyInt_AS_LONG(value);
       sw=1;
-      return;
+      if(nbTuplesExpected*nbCompExpected!=1)
+        {
+          std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyInt) !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+      return &val;
     }
-  if(PyTuple_Check(value))
+  if(PyTuple_Check(value) || PyList_Check(value))
     {
-      int size=PyTuple_Size(value);
-      f.resize(size);
-      for(int i=0;i<size;i++)
-        {
-          PyObject *o=PyTuple_GetItem(value,i);
-          if(PyFloat_Check(o))
-            f[i]=PyFloat_AS_DOUBLE(o);
-          else if(PyInt_Check(o))
-            f[i]=(double)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=4;
-      return;
-    }
-  if(PyList_Check(value))
-    {
-      int size=PyList_Size(value);
-      f.resize(size);
-      for(int i=0;i<size;i++)
-        {
-          PyObject *o=PyList_GetItem(value,i);
-          if(PyFloat_Check(o))
-            f[i]=PyFloat_AS_DOUBLE(o);
-          else if(PyInt_Check(o))
-            f[i]=(double)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=4;
-      return;
-    }
-  void *argp;
-  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
-  if(SWIG_IsOK(status))
-    {  
-      d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(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
- * if value DataArrayDouble -> cpp DataArrayDouble sw=2
- * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
- * if value list[int,double] -> cpp std::vector<double> sw=4
- * if value tuple[int,double] -> cpp std::vector<double> sw=4
- */
-static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
-                                                   const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) throw(INTERP_KERNEL::Exception)
-{
-  sw=-1;
-  if(PyFloat_Check(value))
-    {
-      val=PyFloat_AS_DOUBLE(value);
-      sw=1;
-      if(nbTuplesExpected*nbCompExpected!=1)
-        {
-          std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyFloat) !"; 
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-      return &val;
-    }
-  if(PyInt_Check(value))
-    {
-      val=(double)PyInt_AS_LONG(value);
-      sw=1;
-      if(nbTuplesExpected*nbCompExpected!=1)
-        {
-          std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyInt) !"; 
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
-        }
-      return &val;
-    }
-  if(PyTuple_Check(value) || PyList_Check(value))
-    {
-      try
+      try
         {
           int tmp1=nbTuplesExpected,tmp2=nbCompExpected;
           std::vector<double> ret=fillArrayWithPyListDbl2(value,tmp1,tmp2);
@@ -1925,7 +2118,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou
   void *argp;
   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
       sw=2;
       if(d)
@@ -1961,7 +2154,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou
     }
   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
       sw=3;
       if(e->getNumberOfCompo()==nbCompExpected)
@@ -1970,7 +2163,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou
             return e->getConstPointer();
           else
             {
-              std::ostringstream oss; oss << msg << "nb of tuples expected to be " << nbTuplesExpected << " , and input DataArrayDoubleTuple has always one tuple by contruction !";
+              std::ostringstream oss; oss << msg << "nb of tuples expected to be " << nbTuplesExpected << " , and input DataArrayDoubleTuple has always one tuple by construction !";
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
         }
@@ -1992,7 +2185,7 @@ static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, dou
  * if value tuple[int,double] -> cpp std::vector<double> sw=4
  */
 static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& 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))
@@ -2001,7 +2194,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
       sw=1;
       if(nbCompExpected!=1)
         {
-          std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyFloat) !"; 
+          std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyFloat) !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
       nbTuples=1;
@@ -2013,7 +2206,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
       sw=1;
       if(nbCompExpected!=1)
         {
-          std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyInt) !"; 
+          std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyInt) !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
       nbTuples=1;
@@ -2039,7 +2232,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
       sw=4;
       if(size%nbCompExpected!=0)
         {
-          std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !"; 
+          std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
       nbTuples=size/nbCompExpected;
@@ -2065,7 +2258,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
       sw=4;
       if(size%nbCompExpected!=0)
         {
-          std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !"; 
+          std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
       nbTuples=size/nbCompExpected;
@@ -2074,7 +2267,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
   void *argp;
   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
       sw=2;
       if(d)
@@ -2103,7 +2296,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
     }
   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
       sw=3;
       if(e)
@@ -2142,7 +2335,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
  * if value tuple[int,double] -> cpp std::vector<double> sw=4
  */
 static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector<double>& 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;
@@ -2206,7 +2399,7 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int&
   void *argp;
   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
       sw=2;
       if(d)
@@ -2235,7 +2428,7 @@ static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int&
     }
   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
   if(SWIG_IsOK(status))
-    {  
+    {
       e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
       sw=3;
       if(e)
@@ -2257,86 +2450,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<int> sw=2
- * if python tuple[int] -> cpp vector<int> sw=2
- * if python DataArrayInt -> cpp DataArrayInt sw=3
- * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
- *
- * switch between (int,vector<int>,DataArrayInt)
- */
-static const int *convertObjToPossibleCpp1_Safe(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& 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<size;i++)
-        {
-          PyObject *o=PyTuple_GetItem(value,i);
-          if(PyInt_Check(o))
-            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=2; sz=size;
-      return &stdvecTyypp[0];
-    }
-  if(PyList_Check(value))
-    {
-      int size=PyList_Size(value);
-      stdvecTyypp.resize(size);
-      for(int i=0;i<size;i++)
-        {
-          PyObject *o=PyList_GetItem(value,i);
-          if(PyInt_Check(o))
-            stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
-          else
-            {
-              std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
-              throw INTERP_KERNEL::Exception(oss.str().c_str());
-            }
-        }
-      sw=2; sz=size;
-      return &stdvecTyypp[0];
-    }
-  void *argp;
-  int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
-  if(SWIG_IsOK(status))
-    {
-      MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(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;
@@ -2362,72 +2475,7 @@ static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj,
   return reinterpret_cast< MEDCoupling::DataArray * >(aBasePtrVS);
 }
 
-static PyObject *NewMethWrapCallInitOnlyIfEmptyDictInInput(PyObject *cls, PyObject *args, const char *clsName)
-{
-  if(!PyTuple_Check(args))
-    {
-      std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
-  PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
-  PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
-  //
-  PyObject *tmp0(PyTuple_New(1));
-  PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
-  PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
-  Py_DECREF(tmp0);
-  Py_DECREF(selfMeth);
-  if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==0 )
-    {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
-      PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
-      PyObject *tmp3(PyTuple_New(0));
-      PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
-      Py_XDECREF(tmp2);
-      Py_DECREF(tmp3);
-      Py_DECREF(initMeth);
-    }
-  return instance;
-}
-
-static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls, PyObject *args, const char *clsName)
-{
-  if(!PyTuple_Check(args))
-    {
-      std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !";
-      throw INTERP_KERNEL::Exception(oss.str().c_str());
-    }
-  PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
-  PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
-  PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
-  //
-  PyObject *tmp0(PyTuple_New(1));
-  PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
-  PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
-  Py_DECREF(tmp0);
-  Py_DECREF(selfMeth);
-  if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
-    {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
-      PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
-      PyObject *zeNumpyRepr(0);
-      {
-        PyObject *tmp1(PyInt_FromLong(0));
-       zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
-        Py_DECREF(tmp1);
-      }
-      {
-        PyObject *tmp3(PyTuple_New(1));
-        PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
-        PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
-        Py_XDECREF(tmp2);
-        Py_DECREF(tmp3);
-      }
-      Py_DECREF(initMeth);
-    }
-  return instance;
-}
-
-static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner) throw(INTERP_KERNEL::Exception)
+static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner)
 {
   PyObject *ret=0;
   if(!pd)
@@ -2548,7 +2596,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
   T i1;
   std::vector<T> v1;
   typename MEDCoupling::Traits<T>::ArrayType *d1=0;
-  convertObjToPossibleCpp4<T>(value,sw1,i1,v1,d1,ti);
+  considerPyObjAsATStarLikeObject<T>(value,sw1,i1,v1,d1,ti);
   int it1,ic1;
   std::vector<int> vt1,vc1;
   std::pair<int, std::pair<int,int> > pt1,pc1;
@@ -2566,7 +2614,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
             return self;
           case 3:
@@ -2586,7 +2634,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
             return self;
           case 3:
@@ -2606,7 +2654,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
             return self;
           case 3:
@@ -2626,7 +2674,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
             return self;
           case 3:
@@ -2646,7 +2694,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
             return self;
           case 3:
@@ -2666,7 +2714,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
             return self;
           case 3:
@@ -2686,7 +2734,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
             return self;
           case 3:
@@ -2706,7 +2754,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
             return self;
           case 3:
@@ -2726,7 +2774,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
             return self;
           case 3:
@@ -2746,7 +2794,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
             return self;
           case 3:
@@ -2766,7 +2814,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
             return self;
           case 3:
@@ -2786,7 +2834,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
             return self;
           case 3:
@@ -2806,7 +2854,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
             return self;
           case 3:
@@ -2826,7 +2874,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
             return self;
           case 3:
@@ -2846,7 +2894,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
             return self;
           case 3:
@@ -2866,7 +2914,7 @@ typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typena
             return self;
           case 2:
             tmp=MEDCoupling::Traits<T>::ArrayType::New();
-            tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
+            tmp->useArray(&v1[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,v1.size());
             self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
             return self;
           case 3:
@@ -2990,24 +3038,281 @@ PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits<T>::A
     }
 }
 
+bool isCSRMatrix(PyObject *m)
+{
+#if defined(WITH_NUMPY) && defined(WITH_SCIPY)
+  PyObject* pdict(PyDict_New());
+  PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+  PyObject *tmp(PyRun_String("from scipy.sparse import csr_matrix", Py_single_input, pdict, pdict));
+  if(!tmp)
+    throw INTERP_KERNEL::Exception("Problem during loading csr_matrix in scipy.sparse ! Is Scipy module available in present ?");
+  PyObject *csrMatrixCls=PyDict_GetItemString(pdict,"csr_matrix");
+  if(!csrMatrixCls)
+    throw INTERP_KERNEL::Exception("csr_matrix not found in scipy.sparse ! Is Scipy module available in present ?");
+  bool ret(PyObject_IsInstance(m,csrMatrixCls));
+  Py_DECREF(pdict); Py_XDECREF(tmp);
+  return ret;
+#else
+  return false;
+#endif
+}
+
+void convertCSR_MCDataToVectMapIntDouble(const MEDCoupling::DataArrayInt *indptrPtr, const MEDCoupling::DataArrayInt *indicesPtr, const MEDCoupling::DataArrayDouble *dataPtr, std::vector<std::map<int,double> >& mCpp)
+{
+  auto nbOfRows(indptrPtr->getNumberOfTuples()-1);
+  if(nbOfRows<0)
+    throw INTERP_KERNEL::Exception("pywrap of MEDCouplingRemapper::setMatrix : input CSR matrix looks bad regarding indptr array !");
+  mCpp.resize(nbOfRows);
+  auto indPtrCPtr(indptrPtr->begin());
+  auto indicesCPtr(indicesPtr->begin());
+  auto dataCPtr(dataPtr->begin());
+  for(auto i=0;i<nbOfRows;i++)
+    {
+      auto& line(mCpp[i]);
+      for(auto j=indPtrCPtr[i];j<indPtrCPtr[i+1];j++)
+        {
+          line[indicesCPtr[j]]=dataCPtr[j];
+        }
+    }
+}
+
+void convertToVectMapIntDouble(PyObject *pyobj, std::vector<std::map<int,double> >& mCpp)
+{
+  if(!PyList_Check(pyobj))
+    throw INTERP_KERNEL::Exception("convertToVectMapIntDouble : input is not a python list !");
+  mCpp.clear();
+  Py_ssize_t sz(PyList_Size(pyobj));
+  mCpp.resize(sz);
+  for(Py_ssize_t i=0;i<sz;i++)
+    {
+      PyObject *elt(PyList_GetItem(pyobj,i));
+      if(!PyDict_Check(elt))
+        {
+          std::ostringstream oss; oss << "convertToVectMapIntDouble : at pos # " << i << " of pylist a dict is exepect !";
+          throw INTERP_KERNEL::Exception(oss.str());
+        }
+      PyObject *key, *value;
+      Py_ssize_t pos(0);
+      std::map<int,double>& mapCpp(mCpp[i]);
+      while(PyDict_Next(elt,&pos,&key,&value))
+        {
+          if(!PyInt_Check(key))
+            {
+              std::ostringstream oss; oss << "convertToVectMapIntDouble : at pos # " << i << " of pylist the dict contains at pos " << pos << " a key not mappable to pyint !";
+              throw INTERP_KERNEL::Exception(oss.str());
+            }
+          if(!PyFloat_Check(value))
+            {
+              std::ostringstream oss; oss << "convertToVectMapIntDouble : at pos # " << i << " of pylist the dict contains at pos " << pos << " the value not mappable to pyfloat !";
+              throw INTERP_KERNEL::Exception(oss.str());
+            }
+          mapCpp[(int)PyInt_AS_LONG(key)]=PyFloat_AS_DOUBLE(value);
+        }
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __imul__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(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<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->multiplyEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+        self->multiplyEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __idiv__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(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<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->divideEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+        self->divideEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __iadd__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(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<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->addEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+        self->addEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
+template<class T>
+PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
+{
+  const char msg[]="Unexpected situation in __isub__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(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<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        self->substractEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    case 4:
+      {
+        MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+        self->substractEqual(aaa);
+        Py_XINCREF(trueSelf);
+        return trueSelf;
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
 template<class T>
 struct SWIGTITraits
 { };
 
 template<>
 struct SWIGTITraits<double>
-{ static swig_type_info *TI; };
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
 
 template<>
 struct SWIGTITraits<float>
-{ static swig_type_info *TI; };
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
+
+template<>
+struct SWIGTITraits<int>
+{ static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
 
 swig_type_info *SWIGTITraits<double>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
 swig_type_info *SWIGTITraits<float>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<int>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<double>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
+swig_type_info *SWIGTITraits<int>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
 
+#ifdef WITH_NUMPY
 PyTypeObject *NPYTraits<double>::NPYFunc=&PyCallBackDataArrayDouble_RefType;
 
 PyTypeObject *NPYTraits<float>::NPYFunc=&PyCallBackDataArrayFloat_RefType;
+#endif
 
 template<class T>
 typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, PyObject *value)
@@ -3021,4 +3326,61 @@ PyObject *DataArrayT__getitem(const typename MEDCoupling::Traits<T>::ArrayType *
   return DataArrayT__getitem__internal<T>(self,obj,SWIGTITraits<T>::TI);
 }
 
+template<class T>
+PyObject *DataArrayT_imul(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_imul__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+PyObject *DataArrayT_idiv(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_idiv__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+PyObject *DataArrayT_iadd(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_iadd__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+PyObject *DataArrayT_isub(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
+{
+  return DataArrayT_isub__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+}
+
+template<class T>
+typename MEDCoupling::Traits<T>::ArrayType *DataArrayFPT_rmul(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj)
+{
+  const char msg[]="Unexpected situation in __rmul__ !";
+  T val;
+  typename MEDCoupling::Traits<T>::ArrayType *a;
+  typename MEDCoupling::Traits<T>::ArrayTuple *aa;
+  std::vector<T> bb;
+  int sw;
+  convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
+  switch(sw)
+    {
+    case 1:
+      {
+        typename MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType> ret(self->deepCopy());
+        ret->applyLin(val,0.);
+        return ret.retn();
+      }
+    case 3:
+      {
+        typename MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType> aaa(aa->buildDA(1,self->getNumberOfComponents()));
+        return MEDCoupling::Traits<T>::ArrayType::Multiply(self,aaa);
+      }
+    case 4:
+      {
+        typename MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType> aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::DeallocType::CPP_DEALLOC,1,(int)bb.size());
+        return MEDCoupling::Traits<T>::ArrayType::Multiply(self,aaa);
+      }
+    default:
+      throw INTERP_KERNEL::Exception(msg);
+    }
+}
+
 #endif