Salome HOME
cc56b47750ad0e2bd8e48ca891c9ce043b304a24
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingDataArrayTypemaps.i
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Anthony Geay (EDF R&D)
20
21 #ifndef __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
22 #define __MEDCOUPLINGDATAARRAYTYPEMAPS_I__
23
24 #include "InterpKernelAutoPtr.hxx"
25 #include "MEDCouplingDataArrayTraits.hxx"
26
27 #include <sstream>
28
29 /*!
30  * This method is an extention of PySlice_GetIndices but less
31  * open than PySlice_GetIndicesEx that accepts too many situations.
32  */
33 void GetIndicesOfSlice(PySliceObject *slice, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
34 {
35   int ret(PySlice_GetIndices(slice,length,start,stop,step));
36   if(ret==0)
37     return ;
38   if(*step>0 && *start==*stop && length==*start)
39     return ;
40   throw INTERP_KERNEL::Exception(msgInCaseOfFailure);
41 }
42
43 /*!
44  * This method allows to retrieve slice info from \a slice.
45  */
46 void GetIndicesOfSliceExplicitely(PySliceObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, const char *msgInCaseOfFailure)
47 {
48   int ret(PySlice_GetIndices(slice,std::numeric_limits<int>::max(),start,stop,step));
49   if(ret==0)
50     {
51       if(*start!=std::numeric_limits<int>::max() && *stop!=std::numeric_limits<int>::max())
52         return ;
53       std::ostringstream oss;
54       oss << msgInCaseOfFailure << " The input slice contains some unknowns that can't be determined in static method ! The input slice must be explicit here !";
55       throw INTERP_KERNEL::Exception(oss.str().c_str());
56     }
57   throw INTERP_KERNEL::Exception(msgInCaseOfFailure);
58 }
59
60 int InterpreteNegativeInt(int val, int nbelem)
61 {
62   if(val<0)
63     {
64       int newVal(nbelem+val);
65       if(newVal<0)
66         {
67           std::ostringstream oss; oss << "interpreteNegativeInt : request for negative int=" << val << " but number of elems is equal to " << nbelem << " !";
68           throw INTERP_KERNEL::Exception(oss.str().c_str());
69         }
70       return newVal;
71     }
72   else
73     return val;
74 }
75
76 // this is the second type of specific deallocator, only valid for the constructor of DataArrays taking numpy array
77 // in input when an another DataArray is already client of this.
78 template<class MCData>
79 void numarrdeal2(void *pt, void *obj)
80 {
81   typedef struct PyCallBackDataArraySt<MCData> PyCallBackDataArray;
82   void **obj1=(void **)obj;
83   PyCallBackDataArray *cbdaic=reinterpret_cast<PyCallBackDataArray *>(obj1[0]);
84   PyObject *weakRefOnOwner=reinterpret_cast<PyObject *>(obj1[1]);
85   cbdaic->_pt_mc=0;
86   Py_XDECREF(weakRefOnOwner);
87   Py_XDECREF(cbdaic);
88   delete [] obj1;
89 }
90
91 template<class MCData, class T>
92 MCData *BuildNewInstance(PyObject *elt0, int npyObjectType, PyTypeObject *pytype, const char *msg)
93 {
94   int ndim=PyArray_NDIM(elt0);
95   if(ndim!=1 && ndim!=2)
96     throw INTERP_KERNEL::Exception("Input numpy array should have dimension equal to 1 or 2 !");
97   if(PyArray_DESCR(elt0)->type_num != npyObjectType)
98     {
99       std::ostringstream oss; oss << "Input numpy array has not the type " << msg << "!";
100       throw INTERP_KERNEL::Exception(oss.str().c_str());
101     }
102   npy_intp sz0=PyArray_DIM(elt0,0);
103   npy_intp sz1=ndim==2?PyArray_DIM(elt0,1):1;
104   //
105   int itemSize=PyArray_ITEMSIZE(elt0);
106   if(itemSize!=sizeof(T))
107     {
108       std::ostringstream oss; oss << "Input numpy array has not itemSize set to " << sizeof(T) << " !";
109       throw INTERP_KERNEL::Exception(oss.str().c_str());
110     }
111   if(itemSize*sz1!=PyArray_STRIDE(elt0,0))
112     throw INTERP_KERNEL::Exception("Input numpy array has stride that mismatches the item size ! Data are not packed in the right way for DataArrays !");
113   if(ndim==2)
114     if(itemSize!=PyArray_STRIDE(elt0,1))
115       throw INTERP_KERNEL::Exception("Input numpy array has stride that mismatches the item size ! Data are not packed in the right way for DataArrays for component #1 !");
116   const char *data=PyArray_BYTES(elt0);
117   typename MEDCoupling::MCAuto<MCData> ret=MCData::New();
118   if(PyArray_ISBEHAVED(elt0))//aligned and writeable and in machine byte-order
119     {
120       PyArrayObject *elt0C=reinterpret_cast<PyArrayObject *>(elt0);
121       PyArrayObject *eltOwning=(PyArray_FLAGS(elt0C) & MED_NUMPY_OWNDATA)?elt0C:NULL;
122       int mask=MED_NUMPY_OWNDATA; mask=~mask;
123       elt0C->flags&=mask;
124       PyObject *deepestObj=elt0;
125       PyObject *base=elt0C->base;
126       if(base) deepestObj=base;
127       bool isSpetialCase(false);
128       while(base)
129         {
130           if(PyArray_Check(base))
131             {
132               PyArrayObject *baseC=reinterpret_cast<PyArrayObject *>(base);
133               eltOwning=(PyArray_FLAGS(baseC) & MED_NUMPY_OWNDATA)?baseC:eltOwning;
134               baseC->flags&=mask;
135               base=baseC->base;
136               if(base) deepestObj=base;
137             }
138           else
139             {
140               isSpetialCase=true;
141               break;
142             }
143         }
144       if(isSpetialCase)
145         {// this case is present for numpy arrayint coming from load of pickelized string. The owner of elt0 is not an array -> A copy is requested.
146           std::size_t nbOfElems(sz0*sz1);
147           T *dataCpy=(T*)malloc(sizeof(T)*nbOfElems);
148           std::copy(reinterpret_cast<const T*>(data),reinterpret_cast<const T*>(data)+nbOfElems,dataCpy);
149           ret->useArray(dataCpy,true,MEDCoupling::C_DEALLOC,sz0,sz1);
150           return ret.retn();
151         }
152       typename MEDCoupling::MemArray<T>& mma=ret->accessToMemArray();
153       if(eltOwning==NULL)
154         {
155           PyCallBackDataArraySt<MCData> *cb=PyObject_GC_New(PyCallBackDataArraySt<MCData>,pytype);
156           cb->_pt_mc=ret;
157           ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::C_DEALLOC,sz0,sz1);
158           PyObject *ref=PyWeakref_NewRef(deepestObj,(PyObject *)cb);
159           void **objs=new void *[2]; objs[0]=cb; objs[1]=ref;
160           mma.setParameterForDeallocator(objs);
161           mma.setSpecificDeallocator(numarrdeal2<MCData>);
162           //"Impossible to share this numpy array chunk of data, because already shared by an another non numpy array object (maybe an another DataArrayInt instance) ! Release it, or perform a copy on the input array !");
163         }
164       else
165         {
166           ret->useArray(reinterpret_cast<const T *>(data),true,MEDCoupling::C_DEALLOC,sz0,sz1);
167           PyObject *ref=PyWeakref_NewRef(reinterpret_cast<PyObject *>(eltOwning),NULL);
168           typename MEDCoupling::MemArray<T>::Deallocator tmp(MEDCoupling::MemArray<T>::CDeallocator);
169           void **tmp2 = reinterpret_cast<void**>(&tmp); // MSVC2010 does not support constructor()
170           void **objs=new void *[2]; objs[0]=ref; objs[1]=*tmp2;
171           mma.setParameterForDeallocator(objs);
172           mma.setSpecificDeallocator(numarrdeal);
173         }
174     }
175   else if(PyArray_ISBEHAVED_RO(elt0))
176     ret->useArray(reinterpret_cast<const T *>(data),false,MEDCoupling::CPP_DEALLOC,sz0,sz1);
177   return ret.retn();
178 }
179
180
181 int NumpyArrSetBaseObjectExt(PyArrayObject *arr, PyObject *obj)
182 {
183     if (obj == NULL) {
184         PyErr_SetString(PyExc_ValueError,
185                 "Cannot set the NumPy array 'base' "
186                 "dependency to NULL after initialization");
187         return -1;
188     }
189     /*
190      * Allow the base to be set only once. Once the object which
191      * owns the data is set, it doesn't make sense to change it.
192      */
193     if (PyArray_BASE(arr) != NULL) {
194         Py_DECREF(obj);
195         PyErr_SetString(PyExc_ValueError,
196                 "Cannot set the NumPy array 'base' "
197                 "dependency more than once");
198         return -1;
199     }
200
201     /*
202      * Don't allow infinite chains of views, always set the base
203      * to the first owner of the data.  
204      * That is, either the first object which isn't an array, 
205      * or the first object which owns its own data.
206      */
207
208     while (PyArray_Check(obj) && (PyObject *)arr != obj) {
209         PyArrayObject *obj_arr = (PyArrayObject *)obj;
210         PyObject *tmp;
211  
212
213         /* If this array owns its own data, stop collapsing */
214         if (PyArray_CHKFLAGS(obj_arr, MED_NUMPY_OWNDATA )) { 
215             break;
216         }   
217
218         tmp = PyArray_BASE(obj_arr);
219         /* If there's no base, stop collapsing */
220         if (tmp == NULL) {
221             break;
222         }
223         /* Stop the collapse new base when the would not be of the same 
224          * type (i.e. different subclass).
225          */
226         if (Py_TYPE(tmp) != Py_TYPE(arr)) {
227             break;
228         }
229
230
231         Py_INCREF(tmp);
232         Py_DECREF(obj);
233         obj = tmp;
234     }
235
236     /* Disallow circular references */
237     if ((PyObject *)arr == obj) {
238         Py_DECREF(obj);
239         PyErr_SetString(PyExc_ValueError,
240                 "Cannot create a circular NumPy array 'base' dependency");
241         return -1;
242     }
243
244     arr->base = obj;
245
246     return 0;
247 }
248
249 template<class MCData, class T>
250 PyObject *ToNumPyArrayUnderground(MCData *self, int npyObjectType, const char *MCDataStr, int nbTuples, int nbComp)
251 {
252   if(!self->isAllocated())
253     {
254       std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : this is not allocated !";
255       throw INTERP_KERNEL::Exception(oss.str().c_str());
256     }
257   MEDCoupling::MemArray<T>& mem=self->accessToMemArray();
258   if(nbComp==0)
259     {
260       std::ostringstream oss; oss << MCDataStr << "::toNumPyArray : number of components of this is 0 ! Should be > 0 !"; 
261       throw INTERP_KERNEL::Exception(oss.str().c_str());
262     }
263   int nbDims=nbComp==1?1:2;
264   npy_intp dim[2];
265   dim[0]=(npy_intp)nbTuples; dim[1]=nbComp;
266   const T *bg=self->getConstPointer();
267   PyObject *ret(PyArray_SimpleNewFromData(nbDims,dim,npyObjectType,const_cast<T *>(bg)));
268   if(mem.isDeallocatorCalled())
269     {
270       if(mem.getDeallocator()!=numarrdeal)
271         {// case for the first call of toNumPyArray
272           PyObject *ref(PyWeakref_NewRef(ret,NULL));
273           typename MEDCoupling::MemArray<T>::Deallocator tmp(mem.getDeallocator());
274           void **tmp2 = reinterpret_cast<void**>(&tmp); // MSVC2010 does not support constructor()
275           void **objs=new void *[2]; objs[0]=reinterpret_cast<void*>(ref); objs[1]=*tmp2;
276           mem.setParameterForDeallocator(objs);
277           mem.setSpecificDeallocator(numarrdeal);
278           return ret;
279         }
280       else
281         {// case for the second and other call of toNumPyArray
282           void **objs=(void **)mem.getParameterForDeallocator();
283           PyObject *weakRefOnOwner=(PyObject *)objs[0];
284           PyObject *obj=PyWeakref_GetObject(weakRefOnOwner);
285           if(obj!=Py_None)
286             {//the previous numArray exists let numpy deals the numpy array each other by declaring the still alive instance as base
287               Py_XINCREF(obj);
288               NumpyArrSetBaseObjectExt((PyArrayObject*)ret,obj);
289             }
290           else
291             {//the previous numArray no more exists -> declare the newly created numpy array as the first one.
292               Py_XDECREF(weakRefOnOwner);
293               PyObject *ref=PyWeakref_NewRef(ret,NULL);
294               objs[0]=ref;
295             }
296         }
297     }
298   return ret;
299 }
300
301 template<class MCData, class T>
302 PyObject *ToNumPyArray(MCData *self, int npyObjectType, const char *MCDataStr)
303 {
304   return ToNumPyArrayUnderground<MCData,T>(self,npyObjectType,MCDataStr,self->getNumberOfTuples(),self->getNumberOfComponents());
305 }
306
307 SWIGINTERN PyObject *MEDCoupling_DataArrayInt_toNumPyArray(MEDCoupling::DataArrayInt *self);
308 SWIGINTERN PyObject *MEDCoupling_DataArrayDouble_toNumPyArray(MEDCoupling::DataArrayDouble *self);
309
310 PyObject *ToCSRMatrix(const std::vector<std::map<int,double> >& m, int nbCols) throw(INTERP_KERNEL::Exception)
311 {
312   int nbRows((int)m.size());
313   MEDCoupling::MCAuto<MEDCoupling::DataArrayInt> indPtr(MEDCoupling::DataArrayInt::New()),indices(MEDCoupling::DataArrayInt::New());
314   MEDCoupling::MCAuto<MEDCoupling::DataArrayDouble> data(MEDCoupling::DataArrayDouble::New());
315   indPtr->alloc(nbRows+1,1);
316   int *intPtr_ptr(indPtr->getPointer()); intPtr_ptr[0]=0; intPtr_ptr++;
317   int sz2(0);
318   for(std::vector<std::map<int,double> >::const_iterator it0=m.begin();it0!=m.end();it0++,intPtr_ptr++)
319     {
320       sz2+=(int)(*it0).size();
321       *intPtr_ptr=sz2;
322     }
323   indices->alloc(sz2,1); data->alloc(sz2,1);
324   int *indices_ptr(indices->getPointer());
325   double *data_ptr(data->getPointer());
326   for(std::vector<std::map<int,double> >::const_iterator it0=m.begin();it0!=m.end();it0++)
327     for(std::map<int,double>::const_iterator it1=(*it0).begin();it1!=(*it0).end();it1++,indices_ptr++,data_ptr++)
328       {
329         *indices_ptr=(*it1).first;
330         *data_ptr=(*it1).second;
331       }
332   PyObject *a(MEDCoupling_DataArrayDouble_toNumPyArray(data)),*b(MEDCoupling_DataArrayInt_toNumPyArray(indices)),*c(MEDCoupling_DataArrayInt_toNumPyArray(indPtr));
333   //
334   PyObject *args(PyTuple_New(1)),*args0(PyTuple_New(3)),*kw(PyDict_New()),*kw1(PyTuple_New(2));
335   PyTuple_SetItem(args0,0,a); PyTuple_SetItem(args0,1,b); PyTuple_SetItem(args0,2,c); PyTuple_SetItem(args,0,args0);
336   PyTuple_SetItem(kw1,0,PyInt_FromLong(nbRows)); PyTuple_SetItem(kw1,1,PyInt_FromLong(nbCols));
337   PyObject *tmp1(PyString_FromString("shape"));
338   PyDict_SetItem(kw,tmp1,kw1); Py_DECREF(tmp1); Py_DECREF(kw1);
339   PyObject* pdict=PyDict_New();
340   PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
341   PyObject *tmp(PyRun_String("from scipy.sparse import csr_matrix", Py_single_input, pdict, pdict));
342   if(!tmp)
343     throw INTERP_KERNEL::Exception("Problem during loading csr_matrix in scipy.sparse ! Is Scipy module available in present ?");
344   PyObject *csrMatrixCls=PyDict_GetItemString(pdict,"csr_matrix");
345   if(!csrMatrixCls)
346     throw INTERP_KERNEL::Exception("csr_matrix not found in scipy.sparse ! Is Scipy module available in present ?");
347   PyObject *ret(PyObject_Call(csrMatrixCls,args,kw));
348   Py_DECREF(pdict); Py_XDECREF(tmp); Py_DECREF(args); Py_DECREF(kw);
349   return ret;
350 }
351
352 static PyObject *convertDataArrayChar(MEDCoupling::DataArrayChar *dac, int owner) throw(INTERP_KERNEL::Exception)
353 {
354   PyObject *ret=0;
355   if(!dac)
356     {
357       Py_XINCREF(Py_None);
358       return Py_None;
359     }
360   if(dynamic_cast<MEDCoupling::DataArrayByte *>(dac))
361     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner);
362   if(dynamic_cast<MEDCoupling::DataArrayAsciiChar *>(dac))
363     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,owner);
364   if(!ret)
365     throw INTERP_KERNEL::Exception("Not recognized type of DataArrayChar on downcast !");
366   return ret;
367 }
368
369 static PyObject *convertDataArray(MEDCoupling::DataArray *dac, int owner) throw(INTERP_KERNEL::Exception)
370 {
371   PyObject *ret=0;
372   if(!dac)
373     {
374       Py_XINCREF(Py_None);
375       return Py_None;
376     }
377   if(dynamic_cast<MEDCoupling::DataArrayDouble *>(dac))
378     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayDouble,owner);
379   if(dynamic_cast<MEDCoupling::DataArrayInt *>(dac))
380     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayInt,owner);
381   if(dynamic_cast<MEDCoupling::DataArrayFloat *>(dac))
382     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayFloat,owner);
383   if(dynamic_cast<MEDCoupling::DataArrayByte *>(dac))
384     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayByte,owner);
385   if(dynamic_cast<MEDCoupling::DataArrayAsciiChar *>(dac))
386     ret=SWIG_NewPointerObj((void*)dac,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,owner);
387   if(!ret)
388     throw INTERP_KERNEL::Exception("Not recognized type of DataArray on downcast !");
389   return ret;
390 }
391
392 static PyObject *convertIntArrToPyList(const int *ptr, int size) throw(INTERP_KERNEL::Exception)
393 {
394   PyObject *ret=PyList_New(size);
395   for(int i=0;i<size;i++)
396     PyList_SetItem(ret,i,PyInt_FromLong(ptr[i]));
397   return ret;
398 }
399
400 static PyObject *convertIntArrToPyList2(const std::vector<int>& v) throw(INTERP_KERNEL::Exception)
401 {
402   int size=v.size();
403   PyObject *ret=PyList_New(size);
404   for(int i=0;i<size;i++)
405     PyList_SetItem(ret,i,PyInt_FromLong(v[i]));
406   return ret;
407 }
408
409 static PyObject *convertIntArrToPyList3(const std::set<int>& v) throw(INTERP_KERNEL::Exception)
410 {
411   int size=v.size();
412   PyObject *ret=PyList_New(size);
413   std::set<int>::const_iterator it=v.begin();
414   for(int i=0;i<size;i++,it++)
415     PyList_SetItem(ret,i,PyInt_FromLong(*it));
416   return ret;
417 }
418
419 static PyObject *convertIntArrToPyListOfTuple(const int *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
420 {
421   PyObject *ret=PyList_New(nbOfTuples);
422   for(int i=0;i<nbOfTuples;i++)
423     {
424       PyObject *t=PyTuple_New(nbOfComp);
425       for(int j=0;j<nbOfComp;j++)
426         PyTuple_SetItem(t,j,PyInt_FromLong(vals[i*nbOfComp+j]));
427       PyList_SetItem(ret,i,t);
428     }
429   return ret;
430 }
431
432 static int *convertPyToNewIntArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception)
433 {
434   if(PyList_Check(pyLi))
435     {
436       *size=PyList_Size(pyLi);
437       int *tmp=new int[*size];
438       for(int i=0;i<*size;i++)
439         {
440           PyObject *o=PyList_GetItem(pyLi,i);
441           if(PyInt_Check(o))
442             {
443               int val=(int)PyInt_AS_LONG(o);
444               tmp[i]=val;
445             }
446           else
447             {
448               delete [] tmp;
449               throw INTERP_KERNEL::Exception("list must contain integers only");
450             }
451         }
452       return tmp;
453     }
454   else if(PyTuple_Check(pyLi))
455     {
456       *size=PyTuple_Size(pyLi);
457       int *tmp=new int[*size];
458       for(int i=0;i<*size;i++)
459         {
460           PyObject *o=PyTuple_GetItem(pyLi,i);
461           if(PyInt_Check(o))
462             {
463               int val=(int)PyInt_AS_LONG(o);
464               tmp[i]=val;
465             }
466           else
467             {
468               delete [] tmp;
469               throw INTERP_KERNEL::Exception("tuple must contain integers only");
470             }
471         }
472       return tmp;
473     }
474   else
475     {
476       throw INTERP_KERNEL::Exception("convertPyToNewIntArr2 : not a list");
477     }
478 }
479
480 static PyObject *convertFromVectorPairInt(const std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
481 {
482   PyObject *ret=PyList_New(arr.size());
483   for(std::size_t i=0;i<arr.size();i++)
484     {
485       PyObject *t=PyTuple_New(2);
486       PyTuple_SetItem(t,0,PyInt_FromLong(arr[i].first));
487       PyTuple_SetItem(t,1,PyInt_FromLong(arr[i].second));
488       PyList_SetItem(ret,i,t);
489     }
490   return ret;
491 }
492
493 static void convertPyToVectorPairInt(PyObject *pyLi, std::vector< std::pair<int,int> >& arr) throw(INTERP_KERNEL::Exception)
494 {
495   const char msg[]="list must contain tuples of 2 integers only or tuple must contain tuples of 2 integers only !";
496   if(PyList_Check(pyLi))
497     {
498       int size=PyList_Size(pyLi);
499       arr.resize(size);
500       for(int i=0;i<size;i++)
501         {
502           PyObject *o=PyList_GetItem(pyLi,i);
503           if(PyTuple_Check(o))
504             {
505               int sz2=PyTuple_Size(o);
506               if(sz2!=2)
507                 throw INTERP_KERNEL::Exception(msg);
508               PyObject *o_0=PyTuple_GetItem(o,0);
509               if(!PyInt_Check(o_0))
510                 throw INTERP_KERNEL::Exception(msg);
511               PyObject *o_1=PyTuple_GetItem(o,1);
512               if(!PyInt_Check(o_1))
513                 throw INTERP_KERNEL::Exception(msg);
514               arr[i].first=(int)PyInt_AS_LONG(o_0);
515               arr[i].second=(int)PyInt_AS_LONG(o_1);
516             }
517           else
518             throw INTERP_KERNEL::Exception(msg);
519         }
520     }
521   else if(PyTuple_Check(pyLi))
522     {
523       int size=PyTuple_Size(pyLi);
524       arr.resize(size);
525       for(int i=0;i<size;i++)
526         {
527           PyObject *o=PyTuple_GetItem(pyLi,i);
528           if(PyTuple_Check(o))
529             {
530               int sz2=PyTuple_Size(o);
531               if(sz2!=2)
532                 throw INTERP_KERNEL::Exception(msg);
533               PyObject *o_0=PyTuple_GetItem(o,0);
534               if(!PyInt_Check(o_0))
535                 throw INTERP_KERNEL::Exception(msg);
536               PyObject *o_1=PyTuple_GetItem(o,1);
537               if(!PyInt_Check(o_1))
538                 throw INTERP_KERNEL::Exception(msg);
539               arr[i].first=(int)PyInt_AS_LONG(o_0);
540               arr[i].second=(int)PyInt_AS_LONG(o_1);
541             }
542           else
543             throw INTERP_KERNEL::Exception(msg);
544         }
545     }
546   else
547     throw INTERP_KERNEL::Exception(msg);
548 }
549
550 static void convertPyToVectorPairStringInt(PyObject *pyLi, std::vector< std::pair<std::string,int> >& arr) throw(INTERP_KERNEL::Exception)
551 {
552   const char msg[]="convertPyToVectorPairStringInt : list must contain tuples of 2 integers only or tuple must contain tuples of 1 string and 1 integer only !";
553   if(PyList_Check(pyLi))
554     {
555       int size=PyList_Size(pyLi);
556       arr.resize(size);
557       for(int i=0;i<size;i++)
558         {
559           PyObject *o=PyList_GetItem(pyLi,i);
560           if(PyTuple_Check(o))
561             {
562               int sz2=PyTuple_Size(o);
563               if(sz2!=2)
564                 throw INTERP_KERNEL::Exception(msg);
565               PyObject *o_0=PyTuple_GetItem(o,0);
566               if(!PyString_Check(o_0))
567                 throw INTERP_KERNEL::Exception(msg);
568               PyObject *o_1=PyTuple_GetItem(o,1);
569               if(!PyInt_Check(o_1))
570                 throw INTERP_KERNEL::Exception(msg);
571               arr[i].first=PyString_AsString(o_0);
572               arr[i].second=(int)PyInt_AS_LONG(o_1);
573             }
574           else
575             throw INTERP_KERNEL::Exception(msg);
576         }
577     }
578   else if(PyTuple_Check(pyLi))
579     {
580       int size=PyTuple_Size(pyLi);
581       arr.resize(size);
582       for(int i=0;i<size;i++)
583         {
584           PyObject *o=PyTuple_GetItem(pyLi,i);
585           if(PyTuple_Check(o))
586             {
587               int sz2=PyTuple_Size(o);
588               if(sz2!=2)
589                 throw INTERP_KERNEL::Exception(msg);
590               PyObject *o_0=PyTuple_GetItem(o,0);
591               if(!PyString_Check(o_0))
592                 throw INTERP_KERNEL::Exception(msg);
593               PyObject *o_1=PyTuple_GetItem(o,1);
594               if(!PyInt_Check(o_1))
595                 throw INTERP_KERNEL::Exception(msg);
596               arr[i].first=PyString_AsString(o_0);
597               arr[i].second=(int)PyInt_AS_LONG(o_1);
598             }
599           else
600             throw INTERP_KERNEL::Exception(msg);
601         }
602     }
603   else
604     throw INTERP_KERNEL::Exception(msg);
605 }
606
607 static void convertPyToNewIntArr3(PyObject *pyLi, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
608 {
609   if(PyList_Check(pyLi))
610     {
611       int size=PyList_Size(pyLi);
612       arr.resize(size);
613       for(int i=0;i<size;i++)
614         {
615           PyObject *o=PyList_GetItem(pyLi,i);
616           if(PyInt_Check(o))
617             {
618               int val=(int)PyInt_AS_LONG(o);
619               arr[i]=val;
620             }
621           else
622             throw INTERP_KERNEL::Exception("list must contain integers only");
623         }
624     }
625   else if(PyTuple_Check(pyLi))
626     {
627       int size=PyTuple_Size(pyLi);
628       arr.resize(size);
629       for(int i=0;i<size;i++)
630         {
631           PyObject *o=PyTuple_GetItem(pyLi,i);
632           if(PyInt_Check(o))
633             {
634               int val=(int)PyInt_AS_LONG(o);
635               arr[i]=val;
636             }
637           else
638             throw INTERP_KERNEL::Exception("tuple must contain integers only");
639         }
640     }
641   else
642     {
643       throw INTERP_KERNEL::Exception("convertPyToNewIntArr3 : not a list nor a tuple");
644     }
645 }
646
647 static void convertPyToNewIntArr4(PyObject *pyLi, int recurseLev, int nbOfSubPart, std::vector<int>& arr) throw(INTERP_KERNEL::Exception)
648 {
649   if(recurseLev<0)
650     throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : invalid list of integers level of recursion !");
651   arr.clear();
652   if(PyList_Check(pyLi))
653     {
654       int size=PyList_Size(pyLi);
655       for(int i=0;i<size;i++)
656         {
657           PyObject *o=PyList_GetItem(pyLi,i);
658           if(PyInt_Check(o))
659             {
660               int val=(int)PyInt_AS_LONG(o);
661               arr.push_back(val);
662             }
663           else
664             {
665               std::vector<int> arr2;
666               convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2);
667               if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size())
668                   {
669                     std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " <<  recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !";
670                     throw INTERP_KERNEL::Exception(oss.str().c_str());
671                   }
672               arr.insert(arr.end(),arr2.begin(),arr2.end());
673             }
674         }
675     }
676   else if(PyTuple_Check(pyLi))
677     {
678       int size=PyTuple_Size(pyLi);
679       for(int i=0;i<size;i++)
680         {
681           PyObject *o=PyTuple_GetItem(pyLi,i);
682           if(PyInt_Check(o))
683             {
684               int val=(int)PyInt_AS_LONG(o);
685               arr.push_back(val);
686             }
687           else
688             {
689               std::vector<int> arr2;
690               convertPyToNewIntArr4(o,recurseLev-1,nbOfSubPart,arr2);
691               if(nbOfSubPart>=1 && nbOfSubPart!=(int)arr2.size())
692                   {
693                     std::ostringstream oss; oss << "convertPyToNewIntArr4 : input list at lev " <<  recurseLev << " invalid nb of subpart elts expected " << nbOfSubPart << " having " << arr2.size() << " !";
694                     throw INTERP_KERNEL::Exception(oss.str().c_str());
695                   }
696               arr.insert(arr.end(),arr2.begin(),arr2.end());
697             }
698         }
699     }
700   else
701     throw INTERP_KERNEL::Exception("convertPyToNewIntArr4 : not a list nor a tuple recursively !");
702 }
703
704 static void checkFillArrayWithPyList(int size1, int size2, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
705 {
706   if(nbOfTuples==-1)
707     {
708       if(nbOfComp==-1) { nbOfTuples=size1; nbOfComp=size2; }
709       else { if(nbOfComp==size2) { nbOfTuples=size1; } else
710           {
711             std::ostringstream oss; oss << "fillArrayWithPyListDbl2 : mismatch between nb of elemts : Input has " << size1 << " tuples and " << size2 << " components";
712             oss << " whereas nb of components expected is " << nbOfComp << " !";
713             throw INTERP_KERNEL::Exception(oss.str().c_str());
714           } }
715     }
716   else
717     {
718       if(nbOfComp!=-1)
719         {
720           if((nbOfTuples!=size1 || nbOfComp!=size2))
721             {
722               if(size2!=1 || size1!=nbOfComp*nbOfTuples)
723                 {
724                   std::ostringstream oss; oss << "fillArrayWithPyListDbl2 : mismatch between nb of elemts : Input has " << size1 << " tuples and " << size2 << " components";
725                   oss << " whereas nb of tuples expected is " << nbOfTuples << " and number of components expected is " << nbOfComp << " !";
726                   throw INTERP_KERNEL::Exception(oss.str().c_str());
727                 }
728             }
729         }
730       else
731         {
732           if(nbOfTuples==size1)
733             nbOfComp=size2;
734           else
735             {
736               std::ostringstream oss; oss << "fillArrayWithPyListDbl2 : mismatch between nb of elemts : Input has " << size1 << " tuples and " << size2 << " components";
737               oss << " whereas nb of tuples expected is " << nbOfTuples << " !";
738               throw INTERP_KERNEL::Exception(oss.str().c_str());
739             }
740         }
741     }
742 }
743
744 static void fillArrayWithPyListInt3(PyObject *pyLi, int& nbOfElt, std::vector<int>& ret)
745 {
746   static const char MSG[]="fillArrayWithPyListInt3 : It appears that the input list or tuple is composed by elts having different sizes !";
747   if(PyInt_Check(pyLi))
748     {
749       long val=PyInt_AS_LONG(pyLi);
750       if(nbOfElt==-1)
751         nbOfElt=1;
752       else
753         if(nbOfElt!=1)
754           throw INTERP_KERNEL::Exception(MSG);
755       ret.push_back(val);
756     }
757   else if(PyList_Check(pyLi))
758     {
759       int size=PyList_Size(pyLi);
760       int tmp=0;
761       for(int i=0;i<size;i++)
762         {
763           PyObject *o=PyList_GetItem(pyLi,i);
764           int tmp1=-1;
765           fillArrayWithPyListInt3(o,tmp1,ret);
766           tmp+=tmp1;
767         }
768       if(nbOfElt==-1)
769         nbOfElt=tmp;
770       else
771         {
772           if(nbOfElt!=tmp)
773             throw INTERP_KERNEL::Exception(MSG);
774         }
775     }
776   else if(PyTuple_Check(pyLi))
777     {
778       int size=PyTuple_Size(pyLi);
779       int tmp=0;
780       for(int i=0;i<size;i++)
781         {
782           PyObject *o=PyTuple_GetItem(pyLi,i);
783           int tmp1=-1;
784           fillArrayWithPyListInt3(o,tmp1,ret);
785           tmp+=tmp1;
786         }
787       if(nbOfElt==-1)
788         nbOfElt=tmp;
789       else
790         {
791           if(nbOfElt!=tmp)
792             throw INTERP_KERNEL::Exception(MSG);
793         }
794     }
795   else
796     throw INTERP_KERNEL::Exception("fillArrayWithPyListInt3 : Unrecognized type ! Should be a composition of tuple,list,int !");
797 }
798
799 static std::vector<int> fillArrayWithPyListInt2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
800 {
801   std::vector<int> ret;
802   int size1=-1,size2=-1;
803   if(PyList_Check(pyLi))
804     {
805       size1=PyList_Size(pyLi);
806       for(int i=0;i<size1;i++)
807         {
808           PyObject *o=PyList_GetItem(pyLi,i);
809           fillArrayWithPyListInt3(o,size2,ret);
810         }
811       if(size1==0)
812         size2=1;
813     }
814   else if(PyTuple_Check(pyLi))
815     {
816       size1=PyTuple_Size(pyLi);
817       for(int i=0;i<size1;i++)
818         {
819           PyObject *o=PyTuple_GetItem(pyLi,i);
820           fillArrayWithPyListInt3(o,size2,ret);
821         }
822       if(size1==0)
823         size2=1;
824     }
825   else
826     throw INTERP_KERNEL::Exception("fillArrayWithPyListInt2 : Unrecognized type ! Should be a tuple or a list !");
827   //
828   checkFillArrayWithPyList(size1,size2,nbOfTuples,nbOfComp);
829   return ret;
830 }
831
832 static bool fillStringVector(PyObject *pyLi, std::vector<std::string>& vec) throw(INTERP_KERNEL::Exception)
833 {
834   if(PyList_Check(pyLi))
835     {
836       Py_ssize_t sz=PyList_Size(pyLi);
837       vec.resize(sz);
838       for(int i=0;i<sz;i++)
839         {
840           PyObject *o=PyList_GetItem(pyLi,i);
841           if(PyString_Check(o))
842             vec[i]=PyString_AsString(o);
843           else
844             return false;
845         }
846       return true;
847     }
848   else if(PyTuple_Check(pyLi))
849     {
850       Py_ssize_t sz=PyTuple_Size(pyLi);
851       vec.resize(sz);
852       for(int i=0;i<sz;i++)
853         {
854           PyObject *o=PyTuple_GetItem(pyLi,i);
855           if(PyString_Check(o))
856             vec[i]=PyString_AsString(o);
857           else
858             return false;
859         }
860       return true;
861     }
862   else
863     return false;
864 }
865 static void convertPyToVectorOfVectorOfString(PyObject *pyLi, std::vector< std::vector<std::string> >& arr) throw(INTERP_KERNEL::Exception)
866 {
867   const char msg[]="convertPyToVectorOfVectorOfString : expecting list of list of strings !";
868   if(PyList_Check(pyLi))
869     {
870       Py_ssize_t sz=PyList_Size(pyLi);
871       arr.resize(sz);
872       for(int i=0;i<sz;i++)
873         {
874           PyObject *o=PyList_GetItem(pyLi,i);
875           if(!fillStringVector(o,arr[i]))
876             throw INTERP_KERNEL::Exception(msg);
877         }
878     }
879   else if(PyTuple_Check(pyLi))
880     {
881       Py_ssize_t sz=PyTuple_Size(pyLi);
882       arr.resize(sz);
883       for(int i=0;i<sz;i++)
884         {
885           PyObject *o=PyTuple_GetItem(pyLi,i);
886           if(!fillStringVector(o,arr[i]))
887             throw INTERP_KERNEL::Exception(msg);
888         }
889     }
890   else
891     throw INTERP_KERNEL::Exception(msg);
892 }
893
894 static bool fillIntVector(PyObject *pyLi, std::vector<int>& vec) throw(INTERP_KERNEL::Exception)
895 {
896   if(PyList_Check(pyLi))
897     {
898       Py_ssize_t sz=PyList_Size(pyLi);
899       vec.resize(sz);
900       for(int i=0;i<sz;i++)
901         {
902           PyObject *o=PyList_GetItem(pyLi,i);
903           if(PyInt_Check(o))
904             vec[i]=PyInt_AS_LONG(o);
905           else
906             return false;
907         }
908       return true;
909     }
910   else if(PyTuple_Check(pyLi))
911     {
912       Py_ssize_t sz=PyTuple_Size(pyLi);
913       vec.resize(sz);
914       for(int i=0;i<sz;i++)
915         {
916           PyObject *o=PyTuple_GetItem(pyLi,i);
917           if(PyInt_Check(o))
918             vec[i]=PyInt_AS_LONG(o);
919           else
920             return false;
921         }
922       return true;
923     }
924   else
925     return false;
926 }
927
928 static void convertPyToVectorOfVectorOfInt(PyObject *pyLi, std::vector< std::vector<int> >& arr) throw(INTERP_KERNEL::Exception)
929 {
930   const char msg[]="convertPyToVectorOfVectorOfInt : expecting list of list of strings !";
931   if(PyList_Check(pyLi))
932     {
933       Py_ssize_t sz=PyList_Size(pyLi);
934       arr.resize(sz);
935       for(int i=0;i<sz;i++)
936         {
937           PyObject *o=PyList_GetItem(pyLi,i);
938           if(!fillIntVector(o,arr[i]))
939             throw INTERP_KERNEL::Exception(msg);
940         }
941     }
942   else if(PyTuple_Check(pyLi))
943     {
944       Py_ssize_t sz=PyTuple_Size(pyLi);
945       arr.resize(sz);
946       for(int i=0;i<sz;i++)
947         {
948           PyObject *o=PyTuple_GetItem(pyLi,i);
949           if(!fillIntVector(o,arr[i]))
950             throw INTERP_KERNEL::Exception(msg);
951         }
952     }
953   else
954     throw INTERP_KERNEL::Exception(msg);
955 }
956
957 static void convertPyToVectorPairStringVecString(PyObject *pyLi, std::vector< std::pair<std::string, std::vector<std::string> > >& arr) throw(INTERP_KERNEL::Exception)
958 {
959   const char msg[]="convertPyToVectorPairStringVecString : expecting list of tuples containing each exactly 2 items : one string and one vector of string !";
960   if(PyList_Check(pyLi))
961     {
962       Py_ssize_t sz=PyList_Size(pyLi);
963       arr.resize(sz);
964       for(int i=0;i<sz;i++)
965         {
966           PyObject *o=PyList_GetItem(pyLi,i);
967           if(PyTuple_Check(o))
968             {
969               int sz2=PyTuple_Size(o);
970               if(sz2!=2)
971                 throw INTERP_KERNEL::Exception(msg);
972               std::pair<std::string, std::vector<std::string> > item;
973               PyObject *o_0=PyTuple_GetItem(o,0);
974               if(!PyString_Check(o_0))
975                 throw INTERP_KERNEL::Exception(msg);
976               item.first=PyString_AsString(o_0);
977               PyObject *o_1=PyTuple_GetItem(o,1);
978               if(!fillStringVector(o_1,item.second))
979                 throw INTERP_KERNEL::Exception(msg);
980               arr[i]=item;
981             }
982           else
983             throw INTERP_KERNEL::Exception(msg);
984         }
985     }
986   else if(PyTuple_Check(pyLi))
987     {
988       Py_ssize_t sz=PyTuple_Size(pyLi);
989       arr.resize(sz);
990       for(int i=0;i<sz;i++)
991         {
992           PyObject *o=PyTuple_GetItem(pyLi,i);
993           if(PyTuple_Check(o))
994             {
995               int sz2=PyTuple_Size(o);
996               if(sz2!=2)
997                 throw INTERP_KERNEL::Exception(msg);
998               std::pair<std::string, std::vector<std::string> > item;
999               PyObject *o_0=PyTuple_GetItem(o,0);
1000               if(!PyString_Check(o_0))
1001                 throw INTERP_KERNEL::Exception(msg);
1002               item.first=PyString_AsString(o_0);
1003               PyObject *o_1=PyTuple_GetItem(o,1);
1004               if(!fillStringVector(o_1,item.second))
1005                 throw INTERP_KERNEL::Exception(msg);
1006               arr[i]=item;
1007             }
1008           else
1009             throw INTERP_KERNEL::Exception(msg);
1010         }
1011     }
1012   else
1013     throw INTERP_KERNEL::Exception(msg);
1014 }
1015
1016 template<class T>
1017 PyObject *convertDblArrToPyList(const T *ptr, int size) throw(INTERP_KERNEL::Exception)
1018 {
1019   PyObject *ret(PyList_New(size));
1020   for(int i=0;i<size;i++)
1021     PyList_SetItem(ret,i,PyFloat_FromDouble(ptr[i]));
1022   return ret;
1023 }
1024
1025 static PyObject *convertDblArrToPyList2(const std::vector<double>& v) throw(INTERP_KERNEL::Exception)
1026 {
1027   int size(v.size());
1028   PyObject *ret(PyList_New(size));
1029   for(int i=0;i<size;i++)
1030     PyList_SetItem(ret,i,PyFloat_FromDouble(v[i]));
1031   return ret;
1032 }
1033
1034 template<class T>
1035 PyObject *convertDblArrToPyListOfTuple(const T *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
1036 {
1037   PyObject *ret(PyList_New(nbOfTuples));
1038   for(int i=0;i<nbOfTuples;i++)
1039     {
1040       PyObject *t=PyTuple_New(nbOfComp);
1041       for(int j=0;j<nbOfComp;j++)
1042         PyTuple_SetItem(t,j,PyFloat_FromDouble(vals[i*nbOfComp+j]));
1043       PyList_SetItem(ret,i,t);
1044     }
1045   return ret;
1046 }
1047
1048 static PyObject *convertCharArrToPyListOfTuple(const char *vals, int nbOfComp, int nbOfTuples) throw(INTERP_KERNEL::Exception)
1049 {
1050   PyObject *ret=PyList_New(nbOfTuples);
1051   INTERP_KERNEL::AutoPtr<char> tmp=new char[nbOfComp+1]; tmp[nbOfComp]='\0';
1052   for(int i=0;i<nbOfTuples;i++)
1053     {
1054       std::copy(vals+i*nbOfComp,vals+(i+1)*nbOfComp,(char *)tmp);
1055       PyList_SetItem(ret,i,PyString_FromString(tmp));
1056     }
1057   return ret;
1058 }
1059
1060 static double *convertPyToNewDblArr2(PyObject *pyLi, int *size) throw(INTERP_KERNEL::Exception)
1061 {
1062   if(PyList_Check(pyLi))
1063     {
1064       *size=PyList_Size(pyLi);
1065       double *tmp=(double *)malloc((*size)*sizeof(double));
1066       for(int i=0;i<*size;i++)
1067         {
1068           PyObject *o=PyList_GetItem(pyLi,i);
1069           if(PyFloat_Check(o))
1070             {
1071               double val=PyFloat_AS_DOUBLE(o);
1072               tmp[i]=val;
1073             }
1074           else if(PyInt_Check(o))
1075             {
1076               long val0=PyInt_AS_LONG(o);
1077               double val=val0;
1078               tmp[i]=val;
1079             }
1080           else
1081             {
1082               free(tmp);
1083               throw INTERP_KERNEL::Exception("convertPyToNewDblArr2 : list must contain floats/integers only");
1084             }
1085         }
1086       return tmp;
1087     }
1088   else if(PyTuple_Check(pyLi))
1089     {
1090       *size=PyTuple_Size(pyLi);
1091       double *tmp=(double *)malloc((*size)*sizeof(double));
1092       for(int i=0;i<*size;i++)
1093         {
1094           PyObject *o=PyTuple_GetItem(pyLi,i);
1095           if(PyFloat_Check(o))
1096             {
1097               double val=PyFloat_AS_DOUBLE(o);
1098               tmp[i]=val;
1099             }
1100           else if(PyInt_Check(o))
1101             {
1102               long val0=PyInt_AS_LONG(o);
1103               double val=val0;
1104               tmp[i]=val;
1105             }
1106           else
1107             {
1108               free(tmp);
1109               throw INTERP_KERNEL::Exception("convertPyToNewDblArr2 : tuple must contain floats/integers only");
1110             }
1111         }
1112       return tmp;
1113     }
1114   else
1115     throw INTERP_KERNEL::Exception("convertPyToNewDblArr2 : not a list");
1116 }
1117
1118 static void fillArrayWithPyListDbl3(PyObject *pyLi, int& nbOfElt, std::vector<double>& ret)
1119 {
1120   static const char MSG[]="fillArrayWithPyListDbl3 : It appears that the input list or tuple is composed by elts having different sizes !";
1121   if(PyFloat_Check(pyLi))
1122     {
1123       if(nbOfElt==-1)
1124         nbOfElt=1;
1125       else
1126         if(nbOfElt!=1)
1127           throw INTERP_KERNEL::Exception(MSG);
1128       double val=PyFloat_AS_DOUBLE(pyLi);
1129       ret.push_back(val);
1130     }
1131   else if(PyInt_Check(pyLi))
1132     {
1133       long val0=PyInt_AS_LONG(pyLi);
1134       double val=val0;
1135       if(nbOfElt==-1)
1136         nbOfElt=1;
1137       else
1138         if(nbOfElt!=1)
1139           throw INTERP_KERNEL::Exception(MSG);
1140       ret.push_back(val);
1141     }
1142   else if(PyList_Check(pyLi))
1143     {
1144       int size=PyList_Size(pyLi);
1145       int tmp=0;
1146       for(int i=0;i<size;i++)
1147         {
1148           PyObject *o=PyList_GetItem(pyLi,i);
1149           int tmp1=-1;
1150           fillArrayWithPyListDbl3(o,tmp1,ret);
1151           tmp+=tmp1;
1152         }
1153       if(nbOfElt==-1)
1154         nbOfElt=tmp;
1155       else
1156         {
1157           if(nbOfElt!=tmp)
1158             throw INTERP_KERNEL::Exception(MSG);
1159         }
1160     }
1161   else if(PyTuple_Check(pyLi))
1162     {
1163       int size=PyTuple_Size(pyLi);
1164       int tmp=0;
1165       for(int i=0;i<size;i++)
1166         {
1167           PyObject *o=PyTuple_GetItem(pyLi,i);
1168           int tmp1=-1;
1169           fillArrayWithPyListDbl3(o,tmp1,ret);
1170           tmp+=tmp1;
1171         }
1172       if(nbOfElt==-1)
1173         nbOfElt=tmp;
1174       else
1175         {
1176           if(nbOfElt!=tmp)
1177             throw INTERP_KERNEL::Exception(MSG);
1178         }
1179     }
1180   else
1181     throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl3 : Unrecognized type ! Should be a composition of tuple,list,int and float !");
1182 }
1183
1184 static std::vector<double> fillArrayWithPyListDbl2(PyObject *pyLi, int& nbOfTuples, int& nbOfComp) throw(INTERP_KERNEL::Exception)
1185 {
1186   std::vector<double> ret;
1187   int size1=-1,size2=-1;
1188   if(PyList_Check(pyLi))
1189     {
1190       size1=PyList_Size(pyLi);
1191       for(int i=0;i<size1;i++)
1192         {
1193           PyObject *o=PyList_GetItem(pyLi,i);
1194           fillArrayWithPyListDbl3(o,size2,ret);
1195         }
1196       if(size1==0)
1197         size2=1;
1198     }
1199   else if(PyTuple_Check(pyLi))
1200     {
1201       size1=PyTuple_Size(pyLi);
1202       for(int i=0;i<size1;i++)
1203         {
1204           PyObject *o=PyTuple_GetItem(pyLi,i);
1205           fillArrayWithPyListDbl3(o,size2,ret);
1206         }
1207       if(size1==0)
1208         size2=1;
1209     }
1210   else
1211     throw INTERP_KERNEL::Exception("fillArrayWithPyListDbl2 : Unrecognized type ! Should be a tuple or a list !");
1212   //
1213   checkFillArrayWithPyList(size1,size2,nbOfTuples,nbOfComp);
1214   return ret;
1215 }
1216
1217 //convertFromPyObjVectorOfObj<const MEDCoupling::MEDCouplingUMesh *>(pyLi,SWIGTYPE_p_MEDCoupling__MEDCouplingUMesh,"MEDCouplingUMesh")
1218 template<class T>
1219 static void convertFromPyObjVectorOfObj(PyObject *pyLi, swig_type_info *ty, const char *typeStr, typename std::vector<T>& ret)
1220 {
1221   void *argp=0;
1222   if(PyList_Check(pyLi))
1223     {
1224       int size=PyList_Size(pyLi);
1225       ret.resize(size);
1226       for(int i=0;i<size;i++)
1227         {
1228           PyObject *obj=PyList_GetItem(pyLi,i);
1229           int status=SWIG_ConvertPtr(obj,&argp,ty,0|0);
1230           if(!SWIG_IsOK(status))
1231             {
1232               std::ostringstream oss; oss << "convertFromPyObjVectorOfObj : list is excepted to contain only " << typeStr << " instances !";
1233               throw INTERP_KERNEL::Exception(oss.str().c_str());
1234             }
1235           T arg=reinterpret_cast< T >(argp);
1236           ret[i]=arg;
1237         }
1238     }
1239   else if(PyTuple_Check(pyLi))
1240     {
1241       int size=PyTuple_Size(pyLi);
1242       ret.resize(size);
1243       for(int i=0;i<size;i++)
1244         {
1245           PyObject *obj=PyTuple_GetItem(pyLi,i);
1246           int status=SWIG_ConvertPtr(obj,&argp,ty,0|0);
1247           if(!SWIG_IsOK(status))
1248             {
1249               std::ostringstream oss; oss << "convertFromPyObjVectorOfObj : tuple is excepted to contain only " << typeStr << " instances !";
1250               throw INTERP_KERNEL::Exception(oss.str().c_str());
1251             }
1252           T arg=reinterpret_cast< T >(argp);
1253           ret[i]=arg;
1254         }
1255     }
1256   else if(SWIG_IsOK(SWIG_ConvertPtr(pyLi,&argp,ty,0|0)))
1257     {
1258       ret.resize(1);
1259       T arg=reinterpret_cast< T >(argp);
1260       ret[0]=arg;
1261     }
1262   else
1263     throw INTERP_KERNEL::Exception("convertFromPyObjVectorOfObj : not a list nor a tuple");
1264 }
1265
1266 /*!
1267  * if python int -> cpp int sw=1
1268  * if python list[int] -> cpp vector<int> sw=2
1269  * if python tuple[int] -> cpp vector<int> sw=2
1270  * if python DataArrayInt -> cpp DataArrayInt sw=3
1271  * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
1272  *
1273  * switch between (int,vector<int>,DataArrayInt)
1274  */
1275 static void convertIntStarLikePyObjToCpp(PyObject *value, int& sw, int& iTyypp, std::vector<int>& stdvecTyypp, MEDCoupling::DataArrayInt *& daIntTyypp, MEDCoupling::DataArrayIntTuple *&daIntTuple) throw(INTERP_KERNEL::Exception)
1276 {
1277   sw=-1;
1278   if(PyInt_Check(value))
1279     {
1280       iTyypp=(int)PyInt_AS_LONG(value);
1281       sw=1;
1282       return;
1283     }
1284   if(PyTuple_Check(value))
1285     {
1286       int size=PyTuple_Size(value);
1287       stdvecTyypp.resize(size);
1288       for(int i=0;i<size;i++)
1289         {
1290           PyObject *o=PyTuple_GetItem(value,i);
1291           if(PyInt_Check(o))
1292             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1293           else
1294             {
1295               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
1296               throw INTERP_KERNEL::Exception(oss.str().c_str());
1297             }
1298         }
1299       sw=2;
1300       return;
1301     }
1302   if(PyList_Check(value))
1303     {
1304       int size=PyList_Size(value);
1305       stdvecTyypp.resize(size);
1306       for(int i=0;i<size;i++)
1307         {
1308           PyObject *o=PyList_GetItem(value,i);
1309           if(PyInt_Check(o))
1310             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1311           else
1312             {
1313               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
1314               throw INTERP_KERNEL::Exception(oss.str().c_str());
1315             }
1316         }
1317       sw=2;
1318       return;
1319     }
1320   void *argp;
1321   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1322   if(SWIG_IsOK(status))
1323     {
1324       daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1325       sw=3;
1326       return;
1327     }
1328   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
1329   if(SWIG_IsOK(status))
1330     {  
1331       daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
1332       sw=4;
1333       return ;
1334     }
1335   throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
1336 }
1337
1338 /*!
1339  * if python int -> cpp int sw=1
1340  * if python list[int] -> cpp vector<int> sw=2
1341  * if python tuple[int] -> cpp vector<int> sw=2
1342  * if python DataArrayInt -> cpp DataArrayInt sw=3
1343  * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4
1344  *
1345  * switch between (int,vector<int>,DataArrayInt)
1346  */
1347 static const int *convertIntStarLikePyObjToCppIntStar(PyObject *value, int& sw, int& sz, int& iTyypp, std::vector<int>& stdvecTyypp) throw(INTERP_KERNEL::Exception)
1348 {
1349   sw=-1;
1350   if(PyInt_Check(value))
1351     {
1352       iTyypp=(int)PyInt_AS_LONG(value);
1353       sw=1; sz=1;
1354       return &iTyypp;
1355     }
1356   if(PyTuple_Check(value))
1357     {
1358       int size=PyTuple_Size(value);
1359       stdvecTyypp.resize(size);
1360       for(int i=0;i<size;i++)
1361         {
1362           PyObject *o=PyTuple_GetItem(value,i);
1363           if(PyInt_Check(o))
1364             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1365           else
1366             {
1367               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
1368               throw INTERP_KERNEL::Exception(oss.str().c_str());
1369             }
1370         }
1371       sw=2; sz=size;
1372       return &stdvecTyypp[0];
1373     }
1374   if(PyList_Check(value))
1375     {
1376       int size=PyList_Size(value);
1377       stdvecTyypp.resize(size);
1378       for(int i=0;i<size;i++)
1379         {
1380           PyObject *o=PyList_GetItem(value,i);
1381           if(PyInt_Check(o))
1382             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1383           else
1384             {
1385               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
1386               throw INTERP_KERNEL::Exception(oss.str().c_str());
1387             }
1388         }
1389       sw=2; sz=size;
1390       return &stdvecTyypp[0];
1391     }
1392   void *argp;
1393   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1394   if(SWIG_IsOK(status))
1395     {
1396       MEDCoupling::DataArrayInt *daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1397       if(daIntTyypp)
1398         {
1399           sw=3; sz=daIntTyypp->getNbOfElems();
1400           return daIntTyypp->begin();
1401         }
1402       else
1403         {
1404           sz=0;
1405           return 0;
1406         }
1407     }
1408   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
1409   if(SWIG_IsOK(status))
1410     {  
1411       MEDCoupling::DataArrayIntTuple *daIntTuple=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
1412       sw=4; sz=daIntTuple->getNumberOfCompo();
1413       return daIntTuple->getConstPointer();
1414     }
1415   throw INTERP_KERNEL::Exception("5 types accepted : integer, tuple of integer, list of integer, DataArrayInt, DataArrayIntTuple");
1416 }
1417
1418 /*!
1419  * if python double -> cpp double sw=1
1420  * if python int -> cpp double sw=1
1421  * if python list[double] -> cpp vector<double> sw=2
1422  * if python list[int] -> cpp vector<double> sw=2
1423  * if python tuple[double] -> cpp vector<double> sw=2
1424  * if python tuple[int] -> cpp vector<double> sw=2
1425  * if python DataArrayDouble -> cpp DataArrayDouble sw=3
1426  *
1427  * switch between (int,vector<int>,DataArrayInt)
1428  */
1429 template<class T>
1430 void considerPyObjAsATStarLikeObject(PyObject *value, int& sw, T& iTyypp, std::vector<T>& stdvecTyypp, typename MEDCoupling::Traits<T>::ArrayType *& daIntTyypp, swig_type_info *ti) throw(INTERP_KERNEL::Exception)
1431 {
1432   sw=-1;
1433   if(PyFloat_Check(value))
1434     {
1435       iTyypp=(T)PyFloat_AS_DOUBLE(value);
1436       sw=1;
1437       return;
1438     }
1439   if(PyInt_Check(value))
1440     {
1441       iTyypp=(T)PyInt_AS_LONG(value);
1442       sw=1;
1443       return;
1444     }
1445   if(PyTuple_Check(value))
1446     {
1447       int size=PyTuple_Size(value);
1448       stdvecTyypp.resize(size);
1449       for(int i=0;i<size;i++)
1450         {
1451           PyObject *o=PyTuple_GetItem(value,i);
1452           if(PyFloat_Check(o))
1453             stdvecTyypp[i]=(T)PyFloat_AS_DOUBLE(o);
1454           else if(PyInt_Check(o))
1455             stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
1456           else
1457             {
1458               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
1459               throw INTERP_KERNEL::Exception(oss.str().c_str());
1460             }
1461         }
1462       sw=2;
1463       return;
1464     }
1465   if(PyList_Check(value))
1466     {
1467       int size=PyList_Size(value);
1468       stdvecTyypp.resize(size);
1469       for(int i=0;i<size;i++)
1470         {
1471           PyObject *o=PyList_GetItem(value,i);
1472           if(PyFloat_Check(o))
1473             stdvecTyypp[i]=(T)PyFloat_AS_DOUBLE(o);
1474           else if(PyInt_Check(o))
1475             stdvecTyypp[i]=(T)PyInt_AS_LONG(o);
1476           else
1477             {
1478               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
1479               throw INTERP_KERNEL::Exception(oss.str().c_str());
1480             }
1481         }
1482       sw=2;
1483       return;
1484     }
1485   void *argp;
1486   int status=SWIG_ConvertPtr(value,&argp,ti,0|0);
1487   if(!SWIG_IsOK(status))
1488     throw INTERP_KERNEL::Exception("5 types accepted : double float, integer, tuple of double float or int, list of double float or int, DataArrayDouble");
1489   daIntTyypp=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayType * >(argp);
1490   sw=3;
1491 }
1492
1493 /*!
1494  * if python double -> cpp double sw=1
1495  * if python int -> cpp double sw=1
1496  * if python list[double] -> cpp vector<double> sw=2
1497  * if python list[int] -> cpp vector<double> sw=2
1498  * if python tuple[double] -> cpp vector<double> sw=2
1499  * if python tuple[int] -> cpp vector<double> sw=2
1500  * if python DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
1501  *
1502  * switch between (int,vector<int>,DataArrayInt)
1503  */
1504 static void convertDoubleStarLikePyObjToCpp(PyObject *value, int& sw, double& iTyypp, std::vector<double>& stdvecTyypp, MEDCoupling::DataArrayDoubleTuple *& daIntTyypp) throw(INTERP_KERNEL::Exception)
1505 {
1506   sw=-1;
1507   if(PyFloat_Check(value))
1508     {
1509       iTyypp=PyFloat_AS_DOUBLE(value);
1510       sw=1;
1511       return;
1512     }
1513   if(PyInt_Check(value))
1514     {
1515       iTyypp=(double)PyInt_AS_LONG(value);
1516       sw=1;
1517       return;
1518     }
1519   if(PyTuple_Check(value))
1520     {
1521       int size=PyTuple_Size(value);
1522       stdvecTyypp.resize(size);
1523       for(int i=0;i<size;i++)
1524         {
1525           PyObject *o=PyTuple_GetItem(value,i);
1526           if(PyFloat_Check(o))
1527             stdvecTyypp[i]=PyFloat_AS_DOUBLE(o);
1528           else if(PyInt_Check(o))
1529             stdvecTyypp[i]=(double)PyInt_AS_LONG(o);
1530           else
1531             {
1532               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
1533               throw INTERP_KERNEL::Exception(oss.str().c_str());
1534             }
1535         }
1536       sw=2;
1537       return;
1538     }
1539   if(PyList_Check(value))
1540     {
1541       int size=PyList_Size(value);
1542       stdvecTyypp.resize(size);
1543       for(int i=0;i<size;i++)
1544         {
1545           PyObject *o=PyList_GetItem(value,i);
1546           if(PyFloat_Check(o))
1547             stdvecTyypp[i]=PyFloat_AS_DOUBLE(o);
1548           else if(PyInt_Check(o))
1549             stdvecTyypp[i]=(double)PyInt_AS_LONG(o);
1550           else
1551             {
1552               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
1553               throw INTERP_KERNEL::Exception(oss.str().c_str());
1554             }
1555         }
1556       sw=2;
1557       return;
1558     }
1559   void *argp;
1560   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
1561   if(!SWIG_IsOK(status))
1562     throw INTERP_KERNEL::Exception("5 types accepted : double float, integer, tuple of double float or int, list of double float or int, DataArrayDoubleTuple");
1563   daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
1564   sw=3;
1565 }
1566
1567 template<class T>
1568 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)
1569 {
1570   sw=-1;
1571   if(PyFloat_Check(value))
1572     {
1573       val=PyFloat_AS_DOUBLE(value);
1574       sw=1;
1575       return;
1576     }
1577   if(PyInt_Check(value))
1578     {
1579       val=(T)PyInt_AS_LONG(value);
1580       sw=1;
1581       return;
1582     }
1583   if(PyTuple_Check(value))
1584     {
1585       int size=PyTuple_Size(value);
1586       f.resize(size);
1587       for(int i=0;i<size;i++)
1588         {
1589           PyObject *o=PyTuple_GetItem(value,i);
1590           if(PyFloat_Check(o))
1591             f[i]=PyFloat_AS_DOUBLE(o);
1592           else if(PyInt_Check(o))
1593             f[i]=(T)PyInt_AS_LONG(o);
1594           else
1595             {
1596               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
1597               throw INTERP_KERNEL::Exception(oss.str().c_str());
1598             }
1599         }
1600       sw=4;
1601       return;
1602     }
1603   if(PyList_Check(value))
1604     {
1605       int size=PyList_Size(value);
1606       f.resize(size);
1607       for(int i=0;i<size;i++)
1608         {
1609           PyObject *o=PyList_GetItem(value,i);
1610           if(PyFloat_Check(o))
1611             f[i]=PyFloat_AS_DOUBLE(o);
1612           else if(PyInt_Check(o))
1613             f[i]=(T)PyInt_AS_LONG(o);
1614           else
1615             {
1616               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
1617               throw INTERP_KERNEL::Exception(oss.str().c_str());
1618             }
1619         }
1620       sw=4;
1621       return;
1622     }
1623   void *argp;
1624   int status=SWIG_ConvertPtr(value,&argp,ti_da,0|0);
1625   if(SWIG_IsOK(status))
1626     {  
1627       d=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayType * >(argp);
1628       sw=2;
1629       return ;
1630     }
1631   status=SWIG_ConvertPtr(value,&argp,ti_tuple,0|0);
1632   if(SWIG_IsOK(status))
1633     {  
1634       e=reinterpret_cast< typename MEDCoupling::Traits<T>::ArrayTuple * >(argp);
1635       sw=3;
1636       return ;
1637     }
1638   throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
1639 }
1640
1641 /*!
1642  * if value int -> cpp val sw=1
1643  * if value double -> cpp val sw=1
1644  * if value DataArrayDouble -> cpp DataArrayDouble sw=2
1645  * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
1646  * if value list[int,double] -> cpp std::vector<double> sw=4
1647  * if value tuple[int,double] -> cpp std::vector<double> sw=4
1648  */
1649 static void convertDoubleStarLikePyObjToCpp_2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f)
1650 {
1651   convertFPStarLikePyObjToCpp_2<double>(value,sw,val,d,e,f,SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple);
1652 }
1653
1654 /*!
1655  * if python int -> cpp int sw=1
1656  * if python list[int] -> cpp vector<int> sw=2
1657  * if python tuple[int] -> cpp vector<int> sw=2
1658  * if python slicp -> cpp pair sw=3 (begin,end,step)
1659  * if python DataArrayInt -> cpp DataArrayInt sw=4 . The returned pointer cannot be the null pointer ! If null an exception is thrown.
1660  *
1661  * switch between (int,vector<int>,DataArrayInt)
1662  */
1663 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) throw(INTERP_KERNEL::Exception)
1664 {
1665   const char *msg="5 types accepted : integer, tuple of integer, list of integer, slice, DataArrayInt, DataArrayIntTuple";
1666   sw=-1;
1667   if(PyInt_Check(value))
1668     {
1669       iTyypp=(int)PyInt_AS_LONG(value);
1670       sw=1;
1671       return;
1672     }
1673   if(PyTuple_Check(value))
1674     {
1675       int size=PyTuple_Size(value);
1676       stdvecTyypp.resize(size);
1677       for(int i=0;i<size;i++)
1678         {
1679           PyObject *o=PyTuple_GetItem(value,i);
1680           if(PyInt_Check(o))
1681             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1682           else
1683             {
1684               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
1685               throw INTERP_KERNEL::Exception(oss.str().c_str());
1686             }
1687         }
1688       sw=2;
1689       return;
1690     }
1691   if(PyList_Check(value))
1692     {
1693       int size=PyList_Size(value);
1694       stdvecTyypp.resize(size);
1695       for(int i=0;i<size;i++)
1696         {
1697           PyObject *o=PyList_GetItem(value,i);
1698           if(PyInt_Check(o))
1699             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1700           else
1701             {
1702               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
1703               throw INTERP_KERNEL::Exception(oss.str().c_str());
1704             }
1705         }
1706       sw=2;
1707       return;
1708     }
1709   if(PySlice_Check(value))
1710     {
1711       Py_ssize_t strt=2,stp=2,step=2;
1712       PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
1713       GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
1714       p.first=strt;
1715       p.second.first=stp;
1716       p.second.second=step;
1717       sw=3;
1718       return ;
1719     }
1720   void *argp;
1721   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
1722   if(SWIG_IsOK(status))
1723     {
1724       daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayInt * >(argp);
1725       if(!daIntTyypp)
1726         {
1727           std::ostringstream oss; oss << msg << " Instance in null !";
1728           throw INTERP_KERNEL::Exception(oss.str().c_str());
1729         }
1730       sw=4;
1731       return ;
1732     }
1733   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
1734   if(SWIG_IsOK(status))
1735     {
1736       MEDCoupling::DataArrayIntTuple *tmp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
1737       if(!tmp)
1738         {
1739           std::ostringstream oss; oss << msg << " Instance in null !";
1740           throw INTERP_KERNEL::Exception(oss.str().c_str());
1741         }
1742       stdvecTyypp.resize(tmp->getNumberOfCompo());
1743       std::copy(tmp->getConstPointer(),tmp->getConstPointer()+tmp->getNumberOfCompo(),stdvecTyypp.begin());
1744       sw=2;
1745       return ;
1746     }
1747   throw INTERP_KERNEL::Exception(msg);
1748 }
1749
1750 /*!
1751  * Idem than convertIntStarOrSliceLikePyObjToCpp
1752  */
1753 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) throw(INTERP_KERNEL::Exception)
1754 {
1755   convertIntStarOrSliceLikePyObjToCpp(value,nbelem,sw,iTyypp,stdvecTyypp,p,daIntTyypp);
1756   if(sw==1)
1757     {
1758       iTyypp=InterpreteNegativeInt(iTyypp,nbelem);
1759     }
1760 }
1761
1762 /*!
1763  * if python int -> cpp int sw=1
1764  * if python tuple[int] -> cpp vector<int> sw=2
1765  * if python list[int] -> cpp vector<int> sw=2
1766  * if python slice -> cpp pair sw=3
1767  * if python DataArrayIntTuple -> cpp DataArrayIntTuple sw=4 . WARNING The returned pointer can be the null pointer !
1768  */
1769 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)
1770 {
1771   sw=-1;
1772   if(PyInt_Check(value))
1773     {
1774       iTyypp=(int)PyInt_AS_LONG(value);
1775       sw=1;
1776       return;
1777     }
1778   if(PyTuple_Check(value))
1779     {
1780       int size=PyTuple_Size(value);
1781       stdvecTyypp.resize(size);
1782       for(int i=0;i<size;i++)
1783         {
1784           PyObject *o=PyTuple_GetItem(value,i);
1785           if(PyInt_Check(o))
1786             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1787           else
1788             {
1789               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not integer ! only tuples of integers accepted !";
1790               throw INTERP_KERNEL::Exception(oss.str().c_str());
1791             }
1792         }
1793       sw=2;
1794       return;
1795     }
1796   if(PyList_Check(value))
1797     {
1798       int size=PyList_Size(value);
1799       stdvecTyypp.resize(size);
1800       for(int i=0;i<size;i++)
1801         {
1802           PyObject *o=PyList_GetItem(value,i);
1803           if(PyInt_Check(o))
1804             stdvecTyypp[i]=(int)PyInt_AS_LONG(o);
1805           else
1806             {
1807               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not integer ! only lists of integers accepted !";
1808               throw INTERP_KERNEL::Exception(oss.str().c_str());
1809             }
1810         }
1811       sw=2;
1812       return;
1813     }
1814   if(PySlice_Check(value))
1815     {
1816       Py_ssize_t strt=2,stp=2,step=2;
1817       PySliceObject *oC=reinterpret_cast<PySliceObject *>(value);
1818       GetIndicesOfSlice(oC,nbelem,&strt,&stp,&step,"Slice in subscriptable object DataArray invalid !");
1819       p.first=strt;
1820       p.second.first=stp;
1821       p.second.second=step;
1822       sw=3;
1823       return ;
1824     }
1825   void *argp;
1826   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,0|0);
1827   if(!SWIG_IsOK(status))
1828     throw INTERP_KERNEL::Exception("4 types accepted : integer, tuple of integer, list of integer, slice, DataArrayIntTuple");
1829   daIntTyypp=reinterpret_cast< MEDCoupling::DataArrayIntTuple * >(argp);
1830   sw=4;
1831 }
1832
1833 /*!
1834  * if python string with size one -> cpp char sw=1
1835  * if python string with size different from one -> cpp string sw=2
1836  * if python tuple[string] or list[string] -> vector<string> sw=3
1837  * if python not null pointer of DataArrayChar -> cpp DataArrayChar sw=4
1838  * switch between (int,string,vector<string>,DataArrayChar)
1839  */
1840 static void convertObjToPossibleCpp6(PyObject *value, int& sw, char& cTyp, std::string& sType, std::vector<std::string>& vsType, MEDCoupling::DataArrayChar *& dacType) throw(INTERP_KERNEL::Exception)
1841 {
1842   const char *msg="4 types accepted : string, list or tuple of strings having same size, not null DataArrayChar instance.";
1843   sw=-1;
1844   if(PyString_Check(value))
1845     {
1846       const char *pt=PyString_AsString(value);
1847       Py_ssize_t sz=PyString_Size(value);
1848       if(sz==1)
1849         {
1850           cTyp=pt[0];
1851           sw=1;
1852           return;
1853         }
1854       else
1855         {
1856           sType=pt;
1857           sw=2;
1858           return;
1859         }
1860     }
1861   if(PyTuple_Check(value))
1862     {
1863       int size=PyTuple_Size(value);
1864       vsType.resize(size);
1865       for(int i=0;i<size;i++)
1866         {
1867           PyObject *o=PyTuple_GetItem(value,i);
1868           if(PyString_Check(o))
1869             vsType[i]=PyString_AsString(o);
1870           else
1871             {
1872               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not a string ! only tuples of strings accepted !";
1873               throw INTERP_KERNEL::Exception(oss.str().c_str());
1874             }
1875         }
1876       sw=3;
1877       return;
1878     }
1879   if(PyList_Check(value))
1880     {
1881       int size=PyList_Size(value);
1882       vsType.resize(size);
1883       for(int i=0;i<size;i++)
1884         {
1885           PyObject *o=PyList_GetItem(value,i);
1886           if(PyString_Check(o))
1887             vsType[i]=PyString_AsString(o);
1888           else
1889             {
1890               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not string ! only lists of strings accepted !";
1891               throw INTERP_KERNEL::Exception(oss.str().c_str());
1892             }
1893         }
1894       sw=3;
1895       return;
1896     }
1897   void *argp;
1898   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayChar,0|0);
1899   if(SWIG_IsOK(status))
1900     {
1901       dacType=reinterpret_cast< MEDCoupling::DataArrayChar * >(argp);
1902       if(!dacType)
1903         {
1904           std::ostringstream oss; oss << msg << " Instance in null !";
1905           throw INTERP_KERNEL::Exception(oss.str().c_str());
1906         }
1907       sw=4;
1908       return ;
1909     }
1910   throw INTERP_KERNEL::Exception(msg);
1911 }
1912
1913 /*!
1914  * if value int -> cpp it sw=1
1915  * if value list[int] -> vt sw=2
1916  * if value tuple[int] -> vt sw=2
1917  * if value slice -> pt sw=3
1918  * if value DataArrayInt -> dt sw=4
1919  * if value tuple [int,int] -> cpp it,ip sw=5
1920  * if value tuple [list[int],int] -> cpp vt,ip sw=6
1921  * if value tuple [tuple[int],int] -> cpp vt,ip sw=6
1922  * if value tuple [slice,int] -> cpp pt,ip sw=7
1923  * if value tuple [DaI,int] -> cpp dt,ip sw=8
1924  * if value tuple [int,list[int]] -> cpp it,vc sw=9
1925  * if value tuple [list[int],list[int]] -> cpp vt,vc sw=10
1926  * if value tuple [tuple[int],list[int]] -> cpp vt,vc sw=10
1927  * if value tuple [slice,list[int]] -> cpp pt,vc sw=11
1928  * if value tuple [DaI,list[int]] -> cpp dt,vc sw=12
1929  * if value tuple [int,tuple[int]] -> cpp it,vc sw=9
1930  * if value tuple [list[int],tuple[int]] -> cpp vt,vc sw=10
1931  * if value tuple [tuple[int],tuple[int]] -> cpp vt,vc sw=10
1932  * if value tuple [slice,tuple[int]] -> cpp pt,vc sw=11
1933  * if value tuple [DaI,tuple[int]] -> cpp dt,vc sw=12
1934  * if value tuple [int,slice] -> cpp it,pc sw=13
1935  * if value tuple [list[int],slice] -> cpp vt,pc sw=14
1936  * if value tuple [tuple[int],slice] -> cpp vt,pc sw=14
1937  * if value tuple [slice,slice] -> cpp pt,pc sw=15
1938  * if value tuple [DaI,slice] -> cpp dt,pc sw=16
1939  *
1940  * switch between (int,vector<int>,DataArrayInt)
1941  */
1942 static void convertObjToPossibleCpp3(PyObject *value, int nbTuple, int nbCompo, int& sw, int& it, int& ic, std::vector<int>& vt, std::vector<int>& vc,
1943                                      std::pair<int, std::pair<int,int> >& pt, std::pair<int, std::pair<int,int> >& pc,
1944                                      MEDCoupling::DataArrayInt *&dt, MEDCoupling::DataArrayInt *&dc) throw(INTERP_KERNEL::Exception)
1945 {
1946   if(!PyTuple_Check(value))
1947     {
1948       convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(value,nbTuple,sw,it,vt,pt,dt);
1949       return ;
1950     }
1951   else
1952     {
1953       int sz=PyTuple_Size(value);
1954       if(sz!=2)
1955         throw INTERP_KERNEL::Exception("Unexpected nb of slice element : 1 or 2 expected !\n1st is for tuple selection, 2nd for component selection !");
1956       PyObject *ob0=PyTuple_GetItem(value,0);
1957       int sw1,sw2;
1958       convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob0,nbTuple,sw1,it,vt,pt,dt);
1959       PyObject *ob1=PyTuple_GetItem(value,1);
1960       convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(ob1,nbCompo,sw2,ic,vc,pc,dc);
1961       sw=4*sw2+sw1;
1962     }
1963 }
1964
1965 /*!
1966  * if value int -> cpp val sw=1
1967  * if value double -> cpp val sw=1
1968  * if value DataArrayDouble -> cpp DataArrayDouble sw=2
1969  * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
1970  * if value list[int,double] -> cpp std::vector<double> sw=4
1971  * if value tuple[int,double] -> cpp std::vector<double> sw=4
1972  */
1973 static const double *convertObjToPossibleCpp5_Safe(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
1974                                                    const char *msg, int nbTuplesExpected, int nbCompExpected, bool throwIfNullPt) throw(INTERP_KERNEL::Exception)
1975 {
1976   sw=-1;
1977   if(PyFloat_Check(value))
1978     {
1979       val=PyFloat_AS_DOUBLE(value);
1980       sw=1;
1981       if(nbTuplesExpected*nbCompExpected!=1)
1982         {
1983           std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyFloat) !"; 
1984           throw INTERP_KERNEL::Exception(oss.str().c_str());
1985         }
1986       return &val;
1987     }
1988   if(PyInt_Check(value))
1989     {
1990       val=(double)PyInt_AS_LONG(value);
1991       sw=1;
1992       if(nbTuplesExpected*nbCompExpected!=1)
1993         {
1994           std::ostringstream oss; oss << msg << "dimension expected to be " << nbTuplesExpected*nbCompExpected << " , and your data in input has dimension one (single PyInt) !"; 
1995           throw INTERP_KERNEL::Exception(oss.str().c_str());
1996         }
1997       return &val;
1998     }
1999   if(PyTuple_Check(value) || PyList_Check(value))
2000     {
2001       try
2002         {
2003           int tmp1=nbTuplesExpected,tmp2=nbCompExpected;
2004           std::vector<double> ret=fillArrayWithPyListDbl2(value,tmp1,tmp2);
2005           sw=4;
2006           f=ret;
2007           return &f[0];
2008         }
2009       catch(INTERP_KERNEL::Exception& exc) { throw exc; }
2010     }
2011   void *argp;
2012   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
2013   if(SWIG_IsOK(status))
2014     {  
2015       d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
2016       sw=2;
2017       if(d)
2018         {
2019           if(d->getNumberOfTuples()==nbTuplesExpected)
2020             {
2021               if(d->getNumberOfComponents()==nbCompExpected)
2022                 {
2023                   return d->getConstPointer();
2024                 }
2025               else
2026                 {
2027                   std::ostringstream oss; oss << msg << "nb of components expected to be " << nbCompExpected << " , and input has " << d->getNumberOfComponents() << " components !";
2028                   throw INTERP_KERNEL::Exception(oss.str().c_str());
2029                 }
2030             }
2031           else
2032             {
2033               std::ostringstream oss; oss << msg << " input DataArrayDouble should have a number of tuples equal to " << nbTuplesExpected << " and there are " << d->getNumberOfTuples() << " tuples !";
2034               throw INTERP_KERNEL::Exception(oss.str().c_str());
2035             }
2036         }
2037       else
2038         {
2039           if(throwIfNullPt)
2040             {
2041               std::ostringstream oss; oss << msg << " null pointer not accepted!";
2042               throw INTERP_KERNEL::Exception(oss.str().c_str());
2043             }
2044           else
2045             return 0;
2046         }
2047     }
2048   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
2049   if(SWIG_IsOK(status))
2050     {  
2051       e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
2052       sw=3;
2053       if(e->getNumberOfCompo()==nbCompExpected)
2054         {
2055           if(nbTuplesExpected==1)
2056             return e->getConstPointer();
2057           else
2058             {
2059               std::ostringstream oss; oss << msg << "nb of tuples expected to be " << nbTuplesExpected << " , and input DataArrayDoubleTuple has always one tuple by contruction !";
2060               throw INTERP_KERNEL::Exception(oss.str().c_str());
2061             }
2062         }
2063       else
2064         {
2065           std::ostringstream oss; oss << msg << "nb of components expected to be " <<  nbCompExpected << " , and input DataArrayDoubleTuple has " << e->getNumberOfCompo() << " components !";
2066           throw INTERP_KERNEL::Exception(oss.str().c_str());
2067         }
2068     }
2069   throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
2070 }
2071
2072 /*!
2073  * if value int -> cpp val sw=1
2074  * if value double -> cpp val sw=1
2075  * if value DataArrayDouble -> cpp DataArrayDouble sw=2
2076  * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
2077  * if value list[int,double] -> cpp std::vector<double> sw=4
2078  * if value tuple[int,double] -> cpp std::vector<double> sw=4
2079  */
2080 static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, double& val, MEDCoupling::DataArrayDouble *&d, MEDCoupling::DataArrayDoubleTuple *&e, std::vector<double>& f,
2081                                                     const char *msg, int nbCompExpected, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception)
2082 {
2083   sw=-1;
2084   if(PyFloat_Check(value))
2085     {
2086       val=PyFloat_AS_DOUBLE(value);
2087       sw=1;
2088       if(nbCompExpected!=1)
2089         {
2090           std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyFloat) !"; 
2091           throw INTERP_KERNEL::Exception(oss.str().c_str());
2092         }
2093       nbTuples=1;
2094       return &val;
2095     }
2096   if(PyInt_Check(value))
2097     {
2098       val=(double)PyInt_AS_LONG(value);
2099       sw=1;
2100       if(nbCompExpected!=1)
2101         {
2102           std::ostringstream oss; oss << msg << "dimension expected to be " << nbCompExpected << " , and your data in input has dimension one (single PyInt) !"; 
2103           throw INTERP_KERNEL::Exception(oss.str().c_str());
2104         }
2105       nbTuples=1;
2106       return &val;
2107     }
2108   if(PyTuple_Check(value))
2109     {
2110       int size=PyTuple_Size(value);
2111       f.resize(size);
2112       for(int i=0;i<size;i++)
2113         {
2114           PyObject *o=PyTuple_GetItem(value,i);
2115           if(PyFloat_Check(o))
2116             f[i]=PyFloat_AS_DOUBLE(o);
2117           else if(PyInt_Check(o))
2118             f[i]=(double)PyInt_AS_LONG(o);
2119           else
2120             {
2121               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
2122               throw INTERP_KERNEL::Exception(oss.str().c_str());
2123             }
2124         }
2125       sw=4;
2126       if(size%nbCompExpected!=0)
2127         {
2128           std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !"; 
2129           throw INTERP_KERNEL::Exception(oss.str().c_str());
2130         }
2131       nbTuples=size/nbCompExpected;
2132       return &f[0];
2133     }
2134   if(PyList_Check(value))
2135     {
2136       int size=PyList_Size(value);
2137       f.resize(size);
2138       for(int i=0;i<size;i++)
2139         {
2140           PyObject *o=PyList_GetItem(value,i);
2141           if(PyFloat_Check(o))
2142             f[i]=PyFloat_AS_DOUBLE(o);
2143           else if(PyInt_Check(o))
2144             f[i]=(double)PyInt_AS_LONG(o);
2145           else
2146             {
2147               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
2148               throw INTERP_KERNEL::Exception(oss.str().c_str());
2149             }
2150         }
2151       sw=4;
2152       if(size%nbCompExpected!=0)
2153         {
2154           std::ostringstream oss; oss << msg << "dimension expected to be a multiple of " << nbCompExpected << " , and your data in input has dimension " << f.size() << " !"; 
2155           throw INTERP_KERNEL::Exception(oss.str().c_str());
2156         }
2157       nbTuples=size/nbCompExpected;
2158       return &f[0];
2159     }
2160   void *argp;
2161   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
2162   if(SWIG_IsOK(status))
2163     {  
2164       d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
2165       sw=2;
2166       if(d)
2167         {
2168           if(d->getNumberOfComponents()==nbCompExpected)
2169             {
2170               nbTuples=d->getNumberOfTuples();
2171               return d->getConstPointer();
2172             }
2173           else
2174             {
2175               std::ostringstream oss; oss << msg << "nb of components expected to be a multiple of " << nbCompExpected << " , and input has " << d->getNumberOfComponents() << " components !";
2176               throw INTERP_KERNEL::Exception(oss.str().c_str());
2177             }
2178         }
2179       else
2180         {
2181           if(throwIfNullPt)
2182             {
2183               std::ostringstream oss; oss << msg << " null pointer not accepted!";
2184               throw INTERP_KERNEL::Exception(oss.str().c_str());
2185             }
2186           else
2187             { nbTuples=0; return 0; }
2188         }
2189     }
2190   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
2191   if(SWIG_IsOK(status))
2192     {  
2193       e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
2194       sw=3;
2195       if(e)
2196         {
2197           if(e->getNumberOfCompo()==nbCompExpected)
2198             {
2199               nbTuples=1;
2200               return e->getConstPointer();
2201             }
2202           else
2203             {
2204               std::ostringstream oss; oss << msg << "nb of components expected to be " <<  nbCompExpected << " , and input DataArrayDoubleTuple has " << e->getNumberOfCompo() << " components !";
2205               throw INTERP_KERNEL::Exception(oss.str().c_str());
2206             }
2207         }
2208       else
2209         {
2210           if(throwIfNullPt)
2211             {
2212               std::ostringstream oss; oss << msg << " null pointer not accepted!";
2213               throw INTERP_KERNEL::Exception(oss.str().c_str());
2214             }
2215           else
2216             { nbTuples=0; return 0; }
2217         }
2218     }
2219   throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
2220 }
2221
2222 /*!
2223  * if value int -> cpp val sw=1
2224  * if value double -> cpp val sw=1
2225  * if value DataArrayDouble -> cpp DataArrayDouble sw=2
2226  * if value DataArrayDoubleTuple -> cpp DataArrayDoubleTuple sw=3
2227  * if value list[int,double] -> cpp std::vector<double> sw=4
2228  * if value tuple[int,double] -> cpp std::vector<double> sw=4
2229  */
2230 static const double *convertObjToPossibleCpp5_SingleCompo(PyObject *value, int& sw, double& val, std::vector<double>& f,
2231                                                           const char *msg, bool throwIfNullPt, int& nbTuples) throw(INTERP_KERNEL::Exception)
2232 {
2233   MEDCoupling::DataArrayDouble *d=0;
2234   MEDCoupling::DataArrayDoubleTuple *e=0;
2235   sw=-1;
2236   if(PyFloat_Check(value))
2237     {
2238       val=PyFloat_AS_DOUBLE(value);
2239       sw=1;
2240       nbTuples=1;
2241       return &val;
2242     }
2243   if(PyInt_Check(value))
2244     {
2245       val=(double)PyInt_AS_LONG(value);
2246       sw=1;
2247       nbTuples=1;
2248       return &val;
2249     }
2250   if(PyTuple_Check(value))
2251     {
2252       int size=PyTuple_Size(value);
2253       f.resize(size);
2254       for(int i=0;i<size;i++)
2255         {
2256           PyObject *o=PyTuple_GetItem(value,i);
2257           if(PyFloat_Check(o))
2258             f[i]=PyFloat_AS_DOUBLE(o);
2259           else if(PyInt_Check(o))
2260             f[i]=(double)PyInt_AS_LONG(o);
2261           else
2262             {
2263               std::ostringstream oss; oss << "Tuple as been detected but element #" << i << " is not double ! only tuples of doubles accepted or integer !";
2264               throw INTERP_KERNEL::Exception(oss.str().c_str());
2265             }
2266         }
2267       sw=4;
2268       nbTuples=size;
2269       return &f[0];
2270     }
2271   if(PyList_Check(value))
2272     {
2273       int size=PyList_Size(value);
2274       f.resize(size);
2275       for(int i=0;i<size;i++)
2276         {
2277           PyObject *o=PyList_GetItem(value,i);
2278           if(PyFloat_Check(o))
2279             f[i]=PyFloat_AS_DOUBLE(o);
2280           else if(PyInt_Check(o))
2281             f[i]=(double)PyInt_AS_LONG(o);
2282           else
2283             {
2284               std::ostringstream oss; oss << "List as been detected but element #" << i << " is not double ! only lists of doubles accepted or integer !";
2285               throw INTERP_KERNEL::Exception(oss.str().c_str());
2286             }
2287         }
2288       sw=4;
2289       nbTuples=size;
2290       return &f[0];
2291     }
2292   void *argp;
2293   int status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
2294   if(SWIG_IsOK(status))
2295     {  
2296       d=reinterpret_cast< MEDCoupling::DataArrayDouble * >(argp);
2297       sw=2;
2298       if(d)
2299         {
2300           if(d->getNumberOfComponents()==1)
2301             {
2302               nbTuples=d->getNumberOfTuples();
2303               return d->getConstPointer();
2304             }
2305           else
2306             {
2307               std::ostringstream oss; oss << msg << "nb of components expected to be one, and input has " << d->getNumberOfComponents() << " components !";
2308               throw INTERP_KERNEL::Exception(oss.str().c_str());
2309             }
2310         }
2311       else
2312         {
2313           if(throwIfNullPt)
2314             {
2315               std::ostringstream oss; oss << msg << " null pointer not accepted!";
2316               throw INTERP_KERNEL::Exception(oss.str().c_str());
2317             }
2318           else
2319             { nbTuples=0; return 0; }
2320         }
2321     }
2322   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,0|0);
2323   if(SWIG_IsOK(status))
2324     {  
2325       e=reinterpret_cast< MEDCoupling::DataArrayDoubleTuple * >(argp);
2326       sw=3;
2327       if(e)
2328         {
2329           nbTuples=e->getNumberOfCompo();
2330           return e->getConstPointer();
2331         }
2332       else
2333         {
2334           if(throwIfNullPt)
2335             {
2336               std::ostringstream oss; oss << msg << " null pointer not accepted!";
2337               throw INTERP_KERNEL::Exception(oss.str().c_str());
2338             }
2339           else
2340             { nbTuples=0; return 0; }
2341         }
2342     }
2343   throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");
2344 }
2345
2346 static MEDCoupling::DataArray *CheckAndRetrieveDataArrayInstance(PyObject *obj, const char *msg)
2347 {
2348   void *aBasePtrVS=0;
2349   int status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArray,0|0);
2350   if(!SWIG_IsOK(status))
2351     {
2352       status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayDouble,0|0);
2353       if(!SWIG_IsOK(status))
2354         {
2355           status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayInt,0|0);
2356           if(!SWIG_IsOK(status))
2357             {
2358               status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayAsciiChar,0|0);
2359               if(!SWIG_IsOK(status))
2360                 {
2361                   status=SWIG_ConvertPtr(obj,&aBasePtrVS,SWIGTYPE_p_MEDCoupling__DataArrayByte,0|0);
2362                   std::ostringstream oss; oss << msg << " ! Accepted instances are DataArrayDouble, DataArrayInt, DataArrayAsciiChar, DataArrayByte !";
2363                   throw INTERP_KERNEL::Exception(oss.str().c_str());
2364                 }
2365             }
2366         }
2367     }
2368   return reinterpret_cast< MEDCoupling::DataArray * >(aBasePtrVS);
2369 }
2370
2371 static PyObject *NewMethWrapCallInitOnlyIfEmptyDictInInput(PyObject *cls, PyObject *args, const char *clsName)
2372 {
2373   if(!PyTuple_Check(args))
2374     {
2375       std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !";
2376       throw INTERP_KERNEL::Exception(oss.str().c_str());
2377     }
2378   PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2379   PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2380   PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2381   //
2382   PyObject *tmp0(PyTuple_New(1));
2383   PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2384   PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2385   Py_DECREF(tmp0);
2386   Py_DECREF(selfMeth);
2387   if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==0 )
2388     {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2389       PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2390       PyObject *tmp3(PyTuple_New(0));
2391       PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2392       Py_XDECREF(tmp2);
2393       Py_DECREF(tmp3);
2394       Py_DECREF(initMeth);
2395     }
2396   return instance;
2397 }
2398
2399 static PyObject *NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(PyObject *cls, PyObject *args, const char *clsName)
2400 {
2401   if(!PyTuple_Check(args))
2402     {
2403       std::ostringstream oss; oss << clsName << ".__new__ : the args in input is expected to be a tuple !";
2404       throw INTERP_KERNEL::Exception(oss.str().c_str());
2405     }
2406   PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2407   PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2408   PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2409   //
2410   PyObject *tmp0(PyTuple_New(1));
2411   PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2412   PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2413   Py_DECREF(tmp0);
2414   Py_DECREF(selfMeth);
2415   if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2416     {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2417       PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2418       PyObject *zeNumpyRepr(0);
2419       {
2420         PyObject *tmp1(PyInt_FromLong(0));
2421        zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2422         Py_DECREF(tmp1);
2423       }
2424       {
2425         PyObject *tmp3(PyTuple_New(1));
2426         PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2427         PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2428         Py_XDECREF(tmp2);
2429         Py_DECREF(tmp3);
2430       }
2431       Py_DECREF(initMeth);
2432     }
2433   return instance;
2434 }
2435
2436 static PyObject *convertPartDefinition(MEDCoupling::PartDefinition *pd, int owner) throw(INTERP_KERNEL::Exception)
2437 {
2438   PyObject *ret=0;
2439   if(!pd)
2440     {
2441       Py_XINCREF(Py_None);
2442       return Py_None;
2443     }
2444   if(dynamic_cast<MEDCoupling::DataArrayPartDefinition *>(pd))
2445     ret=SWIG_NewPointerObj((void*)pd,SWIGTYPE_p_MEDCoupling__DataArrayPartDefinition,owner);
2446   else
2447     ret=SWIG_NewPointerObj((void*)pd,SWIGTYPE_p_MEDCoupling__SlicePartDefinition,owner);
2448   return ret;
2449 }
2450
2451 template<class T>
2452 static typename MEDCoupling::Traits<T>::ArrayType *DataArrayT_New(PyObject *elt0, PyObject *nbOfTuples, PyObject *elt2)
2453 {
2454   const char *msgBase="MEDCoupling::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
2455   std::string msg(msgBase);
2456 #ifdef WITH_NUMPY
2457   msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
2458 #endif
2459   msg+=" !";
2460   if(PyList_Check(elt0) || PyTuple_Check(elt0))
2461     {
2462       if(nbOfTuples)
2463         {
2464           if(PyInt_Check(nbOfTuples))
2465             {
2466               int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2467               if(nbOfTuples1<0)
2468                 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2469               if(elt2)
2470                 {
2471                   if(PyInt_Check(elt2))
2472                     {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
2473                       int nbOfCompo=PyInt_AS_LONG(elt2);
2474                       if(nbOfCompo<0)
2475                         throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2476                       MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
2477                       std::vector<double> tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo));
2478                       ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2479                       return ret.retn();
2480                     }
2481                   else
2482                     throw INTERP_KERNEL::Exception(msg.c_str());
2483                 }
2484               else
2485                 {//DataArrayDouble.New([1.,3.,4.],3)
2486                   MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
2487                   int tmpp1(-1);
2488                   std::vector<double> tmp(fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1));
2489                   ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2490                   return ret.retn();
2491                 }
2492             }
2493           else
2494             throw INTERP_KERNEL::Exception(msg.c_str());
2495         }
2496       else
2497         {// DataArrayDouble.New([1.,3.,4.])
2498           MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
2499           int tmpp1(-1),tmpp2(-1);
2500           std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
2501           ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2502           return ret.retn();
2503         }
2504     }
2505   else if(PyInt_Check(elt0))
2506     {
2507       int nbOfTuples1(PyInt_AS_LONG(elt0));
2508       if(nbOfTuples1<0)
2509         throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
2510       if(nbOfTuples)
2511         {
2512           if(!elt2)
2513             {
2514               if(PyInt_Check(nbOfTuples))
2515                 {//DataArrayDouble.New(5,2)
2516                   int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2517                   if(nbOfCompo<0)
2518                     throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
2519                   MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
2520                   ret->alloc(nbOfTuples1,nbOfCompo);
2521                   return ret.retn();
2522                 }
2523               else
2524                 throw INTERP_KERNEL::Exception(msg.c_str());
2525             }
2526           else
2527             throw INTERP_KERNEL::Exception(msg.c_str());
2528         }
2529       else
2530         {//DataArrayDouble.New(5)
2531           MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > ret(MEDCoupling::Traits<T>::ArrayType::New());
2532           ret->alloc(nbOfTuples1,1);
2533           return ret.retn();
2534         }
2535     }
2536 #ifdef WITH_NUMPY
2537   else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
2538     {//DataArrayDouble.New(numpyArray)
2539       return BuildNewInstance< typename MEDCoupling::Traits<T>::ArrayType , T >(elt0,NPYTraits<T>::NPYObjectType,NPYTraits<T>::NPYFunc,MEDCoupling::Traits<T>::NPYStr);
2540     }
2541 #endif
2542   else
2543     throw INTERP_KERNEL::Exception(msg.c_str());
2544   throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2545 }
2546
2547 template<class T>
2548 typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__internal(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, PyObject *value, swig_type_info *ti)
2549 {
2550   self->checkAllocated();
2551   const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
2552   int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
2553   int sw1,sw2;
2554   T i1;
2555   std::vector<T> v1;
2556   typename MEDCoupling::Traits<T>::ArrayType *d1=0;
2557   considerPyObjAsATStarLikeObject<T>(value,sw1,i1,v1,d1,ti);
2558   int it1,ic1;
2559   std::vector<int> vt1,vc1;
2560   std::pair<int, std::pair<int,int> > pt1,pc1;
2561   MEDCoupling::DataArrayInt *dt1=0,*dc1=0;
2562   convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
2563   MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > tmp;
2564   switch(sw2)
2565     {
2566     case 1:
2567       {
2568         switch(sw1)
2569           {
2570           case 1:
2571             self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
2572             return self;
2573           case 2:
2574             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2575             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2576             self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
2577             return self;
2578           case 3:
2579             self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
2580             return self;
2581           default:
2582             throw INTERP_KERNEL::Exception(msg);
2583           }
2584         break;
2585       }
2586     case 2:
2587       {
2588         switch(sw1)
2589           {
2590           case 1:
2591             self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
2592             return self;
2593           case 2:
2594             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2595             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2596             self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
2597             return self;
2598           case 3:
2599             self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
2600             return self;
2601           default:
2602             throw INTERP_KERNEL::Exception(msg);
2603           }
2604         break;
2605       }
2606     case 3:
2607       {
2608         switch(sw1)
2609           {
2610           case 1:
2611             self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
2612             return self;
2613           case 2:
2614             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2615             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2616             self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
2617             return self;
2618           case 3:
2619             self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
2620             return self;
2621           default:
2622             throw INTERP_KERNEL::Exception(msg);
2623           }
2624         break;
2625       }
2626     case 4:
2627       {
2628         switch(sw1)
2629           {
2630           case 1:
2631             self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
2632             return self;
2633           case 2:
2634             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2635             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2636             self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
2637             return self;
2638           case 3:
2639             self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
2640             return self;
2641           default:
2642             throw INTERP_KERNEL::Exception(msg);
2643           }
2644         break;
2645       }
2646     case 5:
2647       {
2648         switch(sw1)
2649           {
2650           case 1:
2651             self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
2652             return self;
2653           case 2:
2654             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2655             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2656             self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
2657             return self;
2658           case 3:
2659             self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
2660             return self;
2661           default:
2662             throw INTERP_KERNEL::Exception(msg);
2663           }
2664         break;
2665       }
2666     case 6:
2667       {
2668         switch(sw1)
2669           {
2670           case 1:
2671             self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
2672             return self;
2673           case 2:
2674             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2675             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2676             self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
2677             return self;
2678           case 3:
2679             self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
2680             return self;
2681           default:
2682             throw INTERP_KERNEL::Exception(msg);
2683           }
2684         break;
2685       }
2686     case 7:
2687       {
2688         switch(sw1)
2689           {
2690           case 1:
2691             self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
2692             return self;
2693           case 2:
2694             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2695             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2696             self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
2697             return self;
2698           case 3:
2699             self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
2700             return self;
2701           default:
2702             throw INTERP_KERNEL::Exception(msg);
2703           }
2704         break;
2705       }
2706     case 8:
2707       {
2708         switch(sw1)
2709           {
2710           case 1:
2711             self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
2712             return self;
2713           case 2:
2714             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2715             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2716             self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
2717             return self;
2718           case 3:
2719             self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
2720             return self;
2721           default:
2722             throw INTERP_KERNEL::Exception(msg);
2723           }
2724         break;
2725       }
2726     case 9:
2727       {
2728         switch(sw1)
2729           {
2730           case 1:
2731             self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
2732             return self;
2733           case 2:
2734             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2735             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2736             self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
2737             return self;
2738           case 3:
2739             self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
2740             return self;
2741           default:
2742             throw INTERP_KERNEL::Exception(msg);
2743           }
2744         break;
2745       }
2746     case 10:
2747       {
2748         switch(sw1)
2749           {
2750           case 1:
2751             self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
2752             return self;
2753           case 2:
2754             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2755             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2756             self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
2757             return self;
2758           case 3:
2759             self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
2760             return self;
2761           default:
2762             throw INTERP_KERNEL::Exception(msg);
2763           }
2764         break;
2765       }
2766     case 11:
2767       {
2768         switch(sw1)
2769           {
2770           case 1:
2771             self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
2772             return self;
2773           case 2:
2774             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2775             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2776             self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
2777             return self;
2778           case 3:
2779             self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
2780             return self;
2781           default:
2782             throw INTERP_KERNEL::Exception(msg);
2783           }
2784         break;
2785       }
2786     case 12:
2787       {
2788         switch(sw1)
2789           {
2790           case 1:
2791             self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
2792             return self;
2793           case 2:
2794             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2795             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2796             self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
2797             return self;
2798           case 3:
2799             self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
2800             return self;
2801           default:
2802             throw INTERP_KERNEL::Exception(msg);
2803           }
2804         break;
2805       }
2806     case 13:
2807       {
2808         switch(sw1)
2809           {
2810           case 1:
2811             self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
2812             return self;
2813           case 2:
2814             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2815             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2816             self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
2817             return self;
2818           case 3:
2819             self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
2820             return self;
2821           default:
2822             throw INTERP_KERNEL::Exception(msg);
2823           }
2824         break;
2825       }
2826     case 14:
2827       {
2828         switch(sw1)
2829           {
2830           case 1:
2831             self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
2832             return self;
2833           case 2:
2834             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2835             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2836             self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
2837             return self;
2838           case 3:
2839             self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
2840             return self;
2841           default:
2842             throw INTERP_KERNEL::Exception(msg);
2843           }
2844         break;
2845       }
2846     case 15:
2847       {
2848         switch(sw1)
2849           {
2850           case 1:
2851             self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
2852             return self;
2853           case 2:
2854             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2855             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2856             self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
2857             return self;
2858           case 3:
2859             self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
2860             return self;
2861           default:
2862             throw INTERP_KERNEL::Exception(msg);
2863           }
2864         break;
2865       }
2866     case 16:
2867       {
2868         switch(sw1)
2869           {
2870           case 1:
2871             self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
2872             return self;
2873           case 2:
2874             tmp=MEDCoupling::Traits<T>::ArrayType::New();
2875             tmp->useArray(&v1[0],false,MEDCoupling::CPP_DEALLOC,1,v1.size());
2876             self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
2877             return self;
2878           case 3:
2879             self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
2880             return self;
2881           default:
2882             throw INTERP_KERNEL::Exception(msg);
2883           }
2884         break;
2885       }
2886     default:
2887       throw INTERP_KERNEL::Exception(msg);
2888     }
2889   return self;
2890 }
2891
2892 template<class T>
2893 PyObject *DataArrayT__getitem__internal(const typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, swig_type_info *ti)
2894 {
2895   const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
2896   const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2897   self->checkAllocated();
2898   int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
2899   int it1,ic1;
2900   std::vector<int> vt1,vc1;
2901   std::pair<int, std::pair<int,int> > pt1,pc1;
2902   MEDCoupling::DataArrayInt *dt1=0,*dc1=0;
2903   int sw;
2904   convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
2905   MEDCoupling::MCAuto<typename MEDCoupling::Traits<T>::ArrayType > ret;
2906   switch(sw)
2907     {
2908     case 1:
2909       if(nbOfComponents==1)
2910         return PyFloat_FromDouble((T)self->getIJSafe(it1,0));
2911       return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),ti, SWIG_POINTER_OWN | 0 );
2912     case 2:
2913       return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),ti, SWIG_POINTER_OWN | 0 );
2914     case 3:
2915       return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),ti, SWIG_POINTER_OWN | 0 );
2916     case 4:
2917       return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),ti, SWIG_POINTER_OWN | 0 );
2918     case 5:
2919       return PyFloat_FromDouble((T)self->getIJSafe(it1,ic1));
2920     case 6:
2921       {
2922         ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
2923         std::vector<int> v2(1,ic1);
2924         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2925       }
2926     case 7:
2927       {
2928         ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
2929         std::vector<int> v2(1,ic1);
2930         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2931       }
2932     case 8:
2933       {
2934         ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
2935         std::vector<int> v2(1,ic1);
2936         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2937       }
2938     case 9:
2939       {
2940         ret=self->selectByTupleIdSafe(&it1,&it1+1);
2941         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
2942       }
2943     case 10:
2944       {
2945         ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
2946         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
2947       }
2948     case 11:
2949       {
2950         ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
2951         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
2952       }
2953     case 12:
2954       {
2955         ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
2956         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),ti, SWIG_POINTER_OWN | 0 );
2957       }
2958     case 13:
2959       {
2960         ret=self->selectByTupleIdSafe(&it1,&it1+1);
2961         int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
2962         std::vector<int> v2(nbOfComp);
2963         for(int i=0;i<nbOfComp;i++)
2964           v2[i]=pc1.first+i*pc1.second.second;
2965         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2966       }
2967     case 14:
2968       {
2969         ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
2970         int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
2971         std::vector<int> v2(nbOfComp);
2972         for(int i=0;i<nbOfComp;i++)
2973           v2[i]=pc1.first+i*pc1.second.second;
2974         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2975       }
2976     case 15:
2977       {
2978         ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
2979         int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
2980         std::vector<int> v2(nbOfComp);
2981         for(int i=0;i<nbOfComp;i++)
2982           v2[i]=pc1.first+i*pc1.second.second;
2983         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2984       }
2985     case 16:
2986       {
2987         ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
2988         int nbOfComp(MEDCoupling::DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2));
2989         std::vector<int> v2(nbOfComp);
2990         for(int i=0;i<nbOfComp;i++)
2991           v2[i]=pc1.first+i*pc1.second.second;
2992         return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),ti, SWIG_POINTER_OWN | 0 );
2993       }
2994     default:
2995       throw INTERP_KERNEL::Exception(msg);
2996     }
2997 }
2998
2999 template<class T>
3000 PyObject *DataArrayT_imul__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
3001 {
3002   const char msg[]="Unexpected situation in __imul__ !";
3003   T val;
3004   typename MEDCoupling::Traits<T>::ArrayType *a;
3005   typename MEDCoupling::Traits<T>::ArrayTuple *aa;
3006   std::vector<T> bb;
3007   int sw;
3008   convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
3009   switch(sw)
3010     {
3011     case 1:
3012       {
3013         self->applyLin(val,0.);
3014         Py_XINCREF(trueSelf);
3015         return trueSelf;
3016       }
3017     case 2:
3018       {
3019         self->multiplyEqual(a);
3020         Py_XINCREF(trueSelf);
3021         return trueSelf;
3022       }
3023     case 3:
3024       {
3025         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
3026         self->multiplyEqual(aaa);
3027         Py_XINCREF(trueSelf);
3028         return trueSelf;
3029       }
3030     case 4:
3031       {
3032         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
3033         self->multiplyEqual(aaa);
3034         Py_XINCREF(trueSelf);
3035         return trueSelf;
3036       }
3037     default:
3038       throw INTERP_KERNEL::Exception(msg);
3039     }
3040 }
3041
3042 template<class T>
3043 PyObject *DataArrayT_idiv__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
3044 {
3045   const char msg[]="Unexpected situation in __idiv__ !";
3046   T val;
3047   typename MEDCoupling::Traits<T>::ArrayType *a;
3048   typename MEDCoupling::Traits<T>::ArrayTuple *aa;
3049   std::vector<T> bb;
3050   int sw;
3051   convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
3052   switch(sw)
3053     {
3054     case 1:
3055       {
3056         if(val==0.)
3057           throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
3058         self->applyLin(1./val,0.);
3059         Py_XINCREF(trueSelf);
3060         return trueSelf;
3061       }
3062     case 2:
3063       {
3064         self->divideEqual(a);
3065         Py_XINCREF(trueSelf);
3066         return trueSelf;
3067       }
3068     case 3:
3069       {
3070         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
3071         self->divideEqual(aaa);
3072         Py_XINCREF(trueSelf);
3073         return trueSelf;
3074       }
3075     case 4:
3076       {
3077         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
3078         self->divideEqual(aaa);
3079         Py_XINCREF(trueSelf);
3080         return trueSelf;
3081       }
3082     default:
3083       throw INTERP_KERNEL::Exception(msg);
3084     }
3085 }
3086
3087 template<class T>
3088 PyObject *DataArrayT_iadd__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
3089 {
3090   const char msg[]="Unexpected situation in __iadd__ !";
3091   T val;
3092   typename MEDCoupling::Traits<T>::ArrayType *a;
3093   typename MEDCoupling::Traits<T>::ArrayTuple *aa;
3094   std::vector<T> bb;
3095   int sw;
3096   convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
3097   switch(sw)
3098     {
3099     case 1:
3100       {
3101         self->applyLin(1.,val);
3102         Py_XINCREF(trueSelf);
3103         return trueSelf;
3104       }
3105     case 2:
3106       {
3107         self->addEqual(a);
3108         Py_XINCREF(trueSelf);
3109         return trueSelf;
3110       }
3111     case 3:
3112       {
3113         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
3114         self->addEqual(aaa);
3115         Py_XINCREF(trueSelf);
3116         return trueSelf;
3117       }
3118     case 4:
3119       {
3120         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
3121         self->addEqual(aaa);
3122         Py_XINCREF(trueSelf);
3123         return trueSelf;
3124       }
3125     default:
3126       throw INTERP_KERNEL::Exception(msg);
3127     }
3128 }
3129   
3130 template<class T>
3131 PyObject *DataArrayT_isub__internal(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self, swig_type_info *ti_da, swig_type_info *ti_tuple)
3132 {
3133   const char msg[]="Unexpected situation in __isub__ !";
3134   T val;
3135   typename MEDCoupling::Traits<T>::ArrayType *a;
3136   typename MEDCoupling::Traits<T>::ArrayTuple *aa;
3137   std::vector<T> bb;
3138   int sw;
3139   convertFPStarLikePyObjToCpp_2<T>(obj,sw,val,a,aa,bb,ti_da,ti_tuple);
3140   switch(sw)
3141     {
3142     case 1:
3143       {
3144         self->applyLin(1.,-val);
3145         Py_XINCREF(trueSelf);
3146         return trueSelf;
3147       }
3148     case 2:
3149       {
3150         self->substractEqual(a);
3151         Py_XINCREF(trueSelf);
3152         return trueSelf;
3153       }
3154     case 3:
3155       {
3156         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(aa->buildDA(1,self->getNumberOfComponents()));
3157         self->substractEqual(aaa);
3158         Py_XINCREF(trueSelf);
3159         return trueSelf;
3160       }
3161     case 4:
3162       {
3163         MEDCoupling::MCAuto< typename MEDCoupling::Traits<T>::ArrayType > aaa(MEDCoupling::Traits<T>::ArrayType::New()); aaa->useArray(&bb[0],false,MEDCoupling::CPP_DEALLOC,1,(int)bb.size());
3164         self->substractEqual(aaa);
3165         Py_XINCREF(trueSelf);
3166         return trueSelf;
3167       }
3168     default:
3169       throw INTERP_KERNEL::Exception(msg);
3170     }
3171 }
3172
3173 template<class T>
3174 struct SWIGTITraits
3175 { };
3176
3177 template<>
3178 struct SWIGTITraits<double>
3179 { static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
3180
3181 template<>
3182 struct SWIGTITraits<float>
3183 { static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
3184
3185 template<>
3186 struct SWIGTITraits<int>
3187 { static swig_type_info *TI; static swig_type_info *TI_TUPLE; };
3188
3189 swig_type_info *SWIGTITraits<double>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
3190 swig_type_info *SWIGTITraits<float>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
3191 swig_type_info *SWIGTITraits<int>::TI=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
3192 swig_type_info *SWIGTITraits<double>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayDouble is null when called here ! Postpone initialization at inlined initializeMe()
3193 swig_type_info *SWIGTITraits<float>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
3194 swig_type_info *SWIGTITraits<int>::TI_TUPLE=NULL;//unfortunately SWIGTYPE_p_MEDCoupling__DataArrayFloat is null when called here ! Postpone initialization at inlined initializeMe()
3195
3196 PyTypeObject *NPYTraits<double>::NPYFunc=&PyCallBackDataArrayDouble_RefType;
3197
3198 PyTypeObject *NPYTraits<float>::NPYFunc=&PyCallBackDataArrayFloat_RefType;
3199
3200 template<class T>
3201 typename MEDCoupling::Traits<T>::ArrayType *DataArrayT__setitem__(typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj, PyObject *value)
3202 {
3203   return DataArrayT__setitem__internal<T>(self,obj,value,SWIGTITraits<T>::TI);
3204 }
3205
3206 template<class T>
3207 PyObject *DataArrayT__getitem(const typename MEDCoupling::Traits<T>::ArrayType *self, PyObject *obj)
3208 {
3209   return DataArrayT__getitem__internal<T>(self,obj,SWIGTITraits<T>::TI);
3210 }
3211
3212 template<class T>
3213 PyObject *DataArrayT_imul(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
3214 {
3215   return DataArrayT_imul__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
3216 }
3217
3218 template<class T>
3219 PyObject *DataArrayT_idiv(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
3220 {
3221   return DataArrayT_idiv__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
3222 }
3223
3224 template<class T>
3225 PyObject *DataArrayT_iadd(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
3226 {
3227   return DataArrayT_iadd__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
3228 }
3229
3230 template<class T>
3231 PyObject *DataArrayT_isub(PyObject *trueSelf, PyObject *obj, typename MEDCoupling::Traits<T>::ArrayType *self)
3232 {
3233   return DataArrayT_isub__internal<T>(trueSelf,obj,self,SWIGTITraits<T>::TI,SWIGTITraits<T>::TI_TUPLE);
3234 }
3235
3236 #endif