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