Salome HOME
Merge branch 'master' of https://codev-tuleap.cea.fr/plugins/git/salome/medcoupling
[tools/medcoupling.git] / src / MEDCoupling_Swig / DataArrayInt.i
1 // Copyright (C) 2007-2020  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 %include "MEDCouplingMemArray.i"
22
23 %define ARRAYDEF( ARRAY, INT )
24
25 // namespace MEDCoupling
26 // {
27 //   class ARRAY ## Iterator;
28
29 //   class ARRAY : public DataArray -- #ifdef doesn't work inside
30 //   {
31   public:
32     static ARRAY *New();
33     INT intValue() const;
34     INT getHashCode() const;
35     bool empty() const;
36     void aggregate(const ARRAY *other);
37     ARRAY *performCopyOrIncrRef(bool deepCopy) const;
38     void deepCopyFrom(const ARRAY& other);
39     void reserve(std::size_t nbOfElems);
40     void pushBackSilent(INT val);
41     INT popBackSilent();
42     void pack() const;
43     void allocIfNecessary(INT nbOfTuple, INT nbOfCompo);
44     bool isEqual(const ARRAY& other) const;
45     bool isEqualWithoutConsideringStr(const ARRAY& other) const;
46     bool isEqualWithoutConsideringStrAndOrder(const ARRAY& other) const;
47     DataArrayIdType *buildPermutationArr(const ARRAY& other) const;
48     ARRAY *sumPerTuple() const;
49     void sort(bool asc=true);
50     void reverse();
51     void checkMonotonic(bool increasing) const;
52     bool isMonotonic(bool increasing) const;
53     void checkStrictlyMonotonic(bool increasing) const;
54     bool isStrictlyMonotonic(bool increasing) const;
55     void fillWithZero();
56     void fillWithValue(INT val);
57     void iota(INT init=0);
58     std::string repr() const;
59     std::string reprZip() const;
60     std::string reprNotTooLong() const;
61     ARRAY *invertArrayO2N2N2O(mcIdType newNbOfElem) const;
62     ARRAY *invertArrayN2O2O2N(mcIdType oldNbOfElem) const;
63     ARRAY *invertArrayO2N2N2OBis(mcIdType newNbOfElem) const;
64     DataArrayIdType *indicesOfSubPart(const ARRAY& partOfThis) const;
65     ARRAY *fromNoInterlace() const;
66     ARRAY *toNoInterlace() const;
67     ARRAY *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end, mcIdType step) const;
68     DataArrayIdType *checkAndPreparePermutation() const;
69     DataArrayIdType *buildPermArrPerLevel() const;
70     bool isIota(mcIdType sizeExpected) const;
71     bool isUniform(INT val) const;
72     INT checkUniformAndGuess() const;
73     bool hasUniqueValues() const;
74     ARRAY *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const;
75     void transpose();
76     ARRAY *changeNbOfComponents(std::size_t newNbOfComp, INT dftValue) const;
77     void meldWith(const ARRAY *other);
78     void setPartOfValues1(const ARRAY *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true);
79     void setPartOfValuesSimple1(INT a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp);
80     void setPartOfValuesAdv(const ARRAY *a, const DataArrayIdType *tuplesSelec);
81     void getTuple(mcIdType tupleId, INT *res) const;
82     INT getIJ(std::size_t tupleId, std::size_t compoId) const;
83     INT getIJSafe(std::size_t tupleId, std::size_t compoId) const;
84     INT front() const;
85     INT back() const;
86     void setIJ(mcIdType tupleId, mcIdType compoId, INT newVal);
87     void setIJSilent(mcIdType tupleId, mcIdType compoId, INT newVal);
88     INT *getPointer();
89     const INT *getConstPointer() const;
90     ARRAY ## Iterator *iterator();
91     const INT *begin() const;
92     const INT *end() const;
93     DataArrayIdType *findIdsEqual(INT val) const;
94     DataArrayIdType *findIdsNotEqual(INT val) const;
95     mcIdType changeValue(INT oldValue, INT newValue);
96     mcIdType findIdFirstEqualTuple(const std::vector<INT>& tupl) const;
97     mcIdType findIdFirstEqual(INT value) const;
98     mcIdType findIdFirstEqual(const std::vector<INT>& vals) const;
99     mcIdType findIdSequence(const std::vector<INT>& vals) const;
100     bool presenceOfTuple(const std::vector<INT>& tupl) const;
101     bool presenceOfValue(INT value) const;
102     bool presenceOfValue(const std::vector<INT>& vals) const;
103     INT count(INT value) const;
104     INT accumulate(INT compId) const;
105     INT getMaxValueInArray() const;
106     INT getMaxAbsValueInArray() const;
107     INT getMinValueInArray() const;
108     void abs();
109     ARRAY *computeAbs() const;
110     void applyLin(INT a, INT b, INT compoId);
111     void applyLin(INT a, INT b);
112     void applyInv(INT numerator);
113     ARRAY *negate() const;
114     void applyDivideBy(INT val);
115     void applyModulus(INT val);
116     void applyRModulus(INT val);
117     void applyPow(INT val);
118     void applyRPow(INT val);
119     ARRAY *findIdsInRange(INT vmin, INT vmax) const;
120     ARRAY *findIdsNotInRange(INT vmin, INT vmax) const;
121     ARRAY *findIdsStrictlyNegative() const;
122     bool checkAllIdsInRange(INT vmin, INT vmax) const;
123     static ARRAY *Aggregate(const ARRAY *a1, const ARRAY *a2, INT offsetA2);
124     static ARRAY *Meld(const ARRAY *a1, const ARRAY *a2);
125     static DataArrayIdType *MakePartition(const std::vector<const ARRAY *>& groups, mcIdType newNb, std::vector< std::vector<mcIdType> >& fidsOfGroups);
126     static ARRAY *BuildUnion(const std::vector<const ARRAY *>& arr);
127     static ARRAY *BuildIntersection(const std::vector<const ARRAY *>& arr);
128     static DataArrayIdType *FindPermutationFromFirstToSecond(const ARRAY *ids1, const ARRAY *ids2);
129     DataArrayIdType *buildComplement(mcIdType nbOfElement) const;
130     ARRAY *buildSubstraction(const ARRAY *other) const;
131     ARRAY *buildSubstractionOptimized(const ARRAY *other) const;
132     ARRAY *buildUnion(const ARRAY *other) const;
133     ARRAY *buildIntersection(const ARRAY *other) const;
134     ARRAY *buildUnique() const;
135     ARRAY *buildUniqueNotSorted() const;
136     ARRAY *deltaShiftIndex() const;
137     void computeOffsets();
138     void computeOffsetsFull();
139     ARRAY *buildExplicitArrByRanges(const ARRAY *offsets) const;
140     DataArrayIdType *findRangeIdForEachTuple(const ARRAY *ranges) const;
141     ARRAY *findIdInRangeForEachTuple(const ARRAY *ranges) const;
142     void sortEachPairToMakeALinkedList();
143     ARRAY *duplicateEachTupleNTimes(mcIdType nbTimes) const;
144     ARRAY *getDifferentValues() const;
145     static ARRAY *Add(const ARRAY *a1, const ARRAY *a2);
146     void addEqual(const ARRAY *other);
147     static ARRAY *Substract(const ARRAY *a1, const ARRAY *a2);
148     void substractEqual(const ARRAY *other);
149     static ARRAY *Multiply(const ARRAY *a1, const ARRAY *a2);
150     void multiplyEqual(const ARRAY *other);
151     static ARRAY *Divide(const ARRAY *a1, const ARRAY *a2);
152     void divideEqual(const ARRAY *other);
153     static ARRAY *Modulus(const ARRAY *a1, const ARRAY *a2);
154     void modulusEqual(const ARRAY *other);
155     static ARRAY *Pow(const ARRAY *a1, const ARRAY *a2);
156     void powEqual(const ARRAY *other);
157     MCAuto<ARRAY> fromLinkedListOfPairToList() const;
158     MCAuto<DataArrayIdType> findIdsGreaterOrEqualTo(INT val) const;
159     MCAuto<DataArrayIdType> findIdsGreaterThan(INT val) const;
160     MCAuto<DataArrayIdType> findIdsLowerOrEqualTo(INT val) const;
161     MCAuto<DataArrayIdType> findIdsLowerThan(INT val) const;
162     MCAuto<ARRAY> selectPartDef(const PartDefinition* pd) const;
163     MCAuto<DataArrayDouble> convertToDblArr() const;
164     MCAuto<DataArrayFloat> convertToFloatArr() const;
165   public:
166     static ARRAY *Range(INT begin, INT end, INT step);
167     %extend
168     {
169       ARRAY()
170         {
171           return ARRAY::New();
172         }
173
174       static ARRAY *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
175       {
176         const char *msgBase="MEDCoupling::ARRAY::New : Available API are : \n-ARRAY.New()\n-ARRAY.New([1,3,4])\n-ARRAY.New([1,3,4],3)\n-ARRAY.New([1,3,4,5],2,2)\n-ARRAY.New([1,3,4,5,7,8],3,2)\n-ARRAY.New([(1,3),(4,5),(7,8)])\n-ARRAY.New(5)\n-ARRAY.New(5,2)";
177         std::string msg(msgBase);
178         if ( MEDCouplingHasNumPyBindings() )
179           msg+="\n-ARRAY.New(numpy array with dtype=int32)";
180
181         msg+=" !";
182         if(PyList_Check(elt0) || PyTuple_Check(elt0))
183           {
184             if(nbOfTuples)
185               {
186                 if(PyInt_Check(nbOfTuples))
187                   {
188                     mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
189                     if(nbOfTuples1<0)
190                       throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !");
191                     if(nbOfComp)
192                       {
193                         if(PyInt_Check(nbOfComp))
194                           {//ARRAY.New([1,3,4,5],2,2)
195                             mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
196                             if(nbOfCompo<0)
197                               throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !");
198                             MCAuto<ARRAY> ret=ARRAY::New();
199                             std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(elt0,nbOfTuples1,nbOfCompo);
200                             ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
201                             return ret.retn();
202                           }
203                         else
204                           throw INTERP_KERNEL::Exception(msg.c_str());
205                       }
206                     else
207                       {//ARRAY.New([1,3,4],3)
208                         MCAuto<ARRAY> ret=ARRAY::New();
209                         mcIdType tmpp1=-1;
210                         std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(elt0,nbOfTuples1,tmpp1);
211                         ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
212                         return ret.retn();
213                       }
214                   }
215                 else
216                   throw INTERP_KERNEL::Exception(msg.c_str());
217               }
218             else
219               {// ARRAY.New([1,3,4])
220                 MCAuto<ARRAY> ret=ARRAY::New();
221                 mcIdType tmpp1=-1,tmpp2=-1;
222                 std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(elt0,tmpp1,tmpp2);
223                 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
224                 return ret.retn();
225               }
226           }
227         else if(PyInt_Check(elt0))
228           {
229             INT nbOfTuples1=(INT)PyInt_AS_LONG(elt0);
230             if(nbOfTuples1<0)
231               throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive set of allocated memory !");
232             if(nbOfTuples)
233               {
234                 if(!nbOfComp)
235                   {
236                     if(PyInt_Check(nbOfTuples))
237                       {//ARRAY.New(5,2)
238                         INT nbOfCompo=(INT)PyInt_AS_LONG(nbOfTuples);
239                         if(nbOfCompo<0)
240                           throw INTERP_KERNEL::Exception("ARRAY::New : should be a positive number of components !");
241                         MCAuto<ARRAY> ret=ARRAY::New();
242                         ret->alloc(nbOfTuples1,nbOfCompo);
243                         return ret.retn();
244                       }
245                     else
246                       throw INTERP_KERNEL::Exception(msg.c_str());
247                   }
248                 else
249                   throw INTERP_KERNEL::Exception(msg.c_str());
250               }
251             else
252               {//ARRAY.New(5)
253                 MCAuto<ARRAY> ret=ARRAY::New();
254                 ret->alloc(nbOfTuples1,1);
255                 return ret.retn();
256               }
257           }
258         else if(MEDCouplingHasNumPyBindings() && PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
259           {//ARRAY.New(numpyArray)
260             return BuildNewInstance<ARRAY,INT>(elt0,NPYTraits<INT>::NPYObjectType,NPYTraits<INT>::NPYFunc,MEDCoupling::Traits<INT>::NPYStr);
261           }
262         else
263           throw INTERP_KERNEL::Exception(msg.c_str());
264         throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
265       }
266
267       ARRAY(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
268         {
269           return MEDCoupling_ ## ARRAY ## _New__SWIG_1(elt0,nbOfTuples,nbOfComp);
270         }
271       
272       std::string __str__() const
273       {
274         return self->reprNotTooLong();
275       }
276
277       mcIdType __len__() const
278       {
279         if(self->isAllocated())
280           {
281             return self->getNumberOfTuples();
282           }
283         else
284           {
285             throw INTERP_KERNEL::Exception("ARRAY::__len__ : Instance is NOT allocated !");
286           }
287       }
288
289       INT __int__() const
290       {
291         return self->intValue();
292       }
293
294       ARRAY ## Iterator *__iter__()
295       {
296         return self->iterator();
297       }
298    
299       PyObject *accumulate() const
300       {
301         mcIdType sz=ToIdType(self->getNumberOfComponents());
302         INTERP_KERNEL::AutoPtr<INT> tmp=new INT[sz];
303         self->accumulate((INT *)tmp);
304         return convertIntArrToPyList((const INT *)tmp,sz);
305       }
306
307       ARRAY *accumulatePerChunck(PyObject *indexArr) const
308       {
309         mcIdType sw,sz,val;
310         std::vector<mcIdType> val2;
311         const mcIdType *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
312         return self->accumulatePerChunck(bg,bg+sz);
313       }
314
315       DataArrayIdType *findIdsEqualTuple(PyObject *inputTuple) const
316       {
317         mcIdType sw,sz;
318         INT val;
319         std::vector<INT> val2;
320         const INT *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
321         return self->findIdsEqualTuple(bg,bg+sz);
322       }
323
324       DataArrayIdType *findIdForEach(PyObject *vals) const
325       {
326         mcIdType sw,sz;
327         INT val;
328         std::vector<INT> val2;
329         const INT *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
330         MCAuto<DataArrayIdType> ret(self->findIdForEach(bg,bg+sz));
331         return ret.retn();
332       }
333
334       PyObject *splitInBalancedSlices(mcIdType nbOfSlices) const
335       {
336         std::vector< std::pair<mcIdType,mcIdType> > slcs(self->splitInBalancedSlices(nbOfSlices));
337         PyObject *ret=PyList_New(slcs.size());
338         for(std::size_t i=0;i<slcs.size();i++)
339           PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
340         return ret;
341       }
342
343       ARRAY *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const
344       {
345         if(!PySlice_Check(slic))
346           throw INTERP_KERNEL::Exception("ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
347         Py_ssize_t strt=2,stp=2,step=2;
348         GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
349         if(strt==std::numeric_limits<INT>::max() || stp==std::numeric_limits<INT>::max())
350           throw INTERP_KERNEL::Exception("ARRAY::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
351         return self->buildExplicitArrOfSliceOnScaledArr((INT)strt,(INT)stp,(INT)step);
352       }
353
354       PyObject *getMinMaxValues() const
355       {
356         INT a,b;
357         self->getMinMaxValues(a,b);
358         PyObject *ret=PyTuple_New(2);
359         PyTuple_SetItem(ret,0,PyInt_FromLong(a));
360         PyTuple_SetItem(ret,1,PyInt_FromLong(b));
361         return ret;
362       }
363    
364       static PyObject *ConvertIndexArrayToO2N(mcIdType nbOfOldTuples, PyObject *arr, PyObject *arrI)
365       {
366         mcIdType newNbOfTuples=-1;
367         mcIdType szArr,szArrI,sw,iTypppArr,iTypppArrI;
368         std::vector<mcIdType> stdvecTyyppArr;
369         std::vector<mcIdType> stdvecTyyppArrI;
370         const mcIdType *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
371         const mcIdType *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
372         DataArrayIdType *ret0=MEDCoupling::ARRAY::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
373         PyObject *ret=PyTuple_New(2);
374         PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
375         PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
376         return ret;
377       }
378
379       static DataArrayIdType *CheckAndPreparePermutation(PyObject *arr)
380       {
381         MCAuto<DataArrayIdType> ret(DataArrayIdType::New());
382         mcIdType szArr,sw;
383         INT iTypppArr;
384         std::vector<INT> stdvecTyyppArr;
385         const INT *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
386         mcIdType *pt(MEDCoupling::ARRAY::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
387         ret->useArray(pt,true,MEDCoupling::DeallocType::C_DEALLOC,szArr,1);
388         return ret.retn();
389       }
390
391       void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0)
392       {
393         const char *msg="MEDCoupling::ARRAY::setValues : Available API are : \n-ARRAY.setValues([1,3,4])\n-ARRAY.setValues([1,3,4],3)\n-ARRAY.setValues([1,3,4,5],2,2)\n-ARRAY.New(5)\n !";
394         if(PyList_Check(li) || PyTuple_Check(li))
395           {
396             if(nbOfTuples && nbOfTuples != Py_None)
397               {
398                 if(PyInt_Check(nbOfTuples))
399                   {
400                     mcIdType nbOfTuples1=ToIdType(PyInt_AS_LONG(nbOfTuples));
401                     if(nbOfTuples1<0)
402                       throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive set of allocated memory !");
403                     if(nbOfComp && nbOfComp != Py_None)
404                       {
405                         if(PyInt_Check(nbOfComp))
406                           {//ARRAY.setValues([1,3,4,5],2,2)
407                             mcIdType nbOfCompo=ToIdType(PyInt_AS_LONG(nbOfComp));
408                             if(nbOfCompo<0)
409                               throw INTERP_KERNEL::Exception("ARRAY::setValue : should be a positive number of components !");
410                             std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,nbOfTuples1,nbOfCompo);
411                             self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
412                           }
413                         else
414                           throw INTERP_KERNEL::Exception(msg);
415                       }
416                     else
417                       {//ARRAY.setValues([1,3,4],3)
418                         mcIdType tmpp1=-1;
419                         std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,nbOfTuples1,tmpp1);
420                         self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
421                       }
422                   }
423                 else
424                   throw INTERP_KERNEL::Exception(msg);
425               }
426             else
427               {// ARRAY.setValues([1,3,4])
428                 mcIdType tmpp1=-1,tmpp2=-1;
429                 std::vector<INT> tmp=fillArrayWithPyListInt2<INT>(li,tmpp1,tmpp2);
430                 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
431               }
432           }
433         else
434           throw INTERP_KERNEL::Exception(msg);
435       }
436
437       PyObject *getValues() const
438       {
439         const INT *vals=self->getConstPointer();
440         return convertIntArrToPyList(vals,self->getNbOfElems());
441       }
442
443       PyObject *isEqualIfNotWhy(const ARRAY& other) const
444       {
445         std::string ret1;
446         bool ret0=self->isEqualIfNotWhy(other,ret1);
447         PyObject *ret=PyTuple_New(2);
448         PyObject *ret0Py=ret0?Py_True:Py_False;
449         Py_XINCREF(ret0Py);
450         PyTuple_SetItem(ret,0,ret0Py);
451         PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
452         return ret;
453       }
454
455       PyObject *getValuesAsTuple() const
456       {
457         const INT *vals=self->getConstPointer();
458         mcIdType nbOfComp=ToIdType(self->getNumberOfComponents());
459         mcIdType nbOfTuples=self->getNumberOfTuples();
460         return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
461       }
462
463       static PyObject *MakePartition(PyObject *gps, mcIdType newNb)
464       {
465         std::vector<const ARRAY *> groups;
466         std::vector< std::vector<mcIdType> > fidsOfGroups;
467         convertFromPyObjVectorOfObj(gps,SWIGTITraits<INT>::TI,"ARRAY",groups);
468         DataArrayIdType *ret0=MEDCoupling::ARRAY::MakePartition(groups,newNb,fidsOfGroups);
469         PyObject *ret = PyList_New(2);
470         PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
471         std::size_t sz=fidsOfGroups.size();
472         PyObject *ret1 = PyList_New(sz);
473         for(std::size_t i=0;i<sz;i++)
474           PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
475         PyList_SetItem(ret,1,ret1);
476         return ret;
477       }
478
479       DataArrayIdType *findIdsEqualList(PyObject *obj)
480       {
481         mcIdType sw;
482         INT singleVal;
483         std::vector<INT> multiVal;
484         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
485         ARRAY *daIntTyypp=0;
486         convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
487         switch(sw)
488           {
489           case 1:
490             return self->findIdsEqualList(&singleVal,&singleVal+1);
491           case 2:
492             return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
493           case 4:
494             return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
495           default:
496             throw INTERP_KERNEL::Exception("ARRAY::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
497           }
498       }
499
500       DataArrayIdType *findIdsNotEqualList(PyObject *obj)
501       {
502         mcIdType sw;
503         INT singleVal;
504         std::vector<INT> multiVal;
505         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
506         ARRAY *daIntTyypp=0;
507         convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
508         switch(sw)
509           {
510           case 1:
511             return self->findIdsNotEqualList(&singleVal,&singleVal+1);
512           case 2:
513             return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
514           case 4:
515             return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
516           default:
517             throw INTERP_KERNEL::Exception("ARRAY::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
518           }
519       }
520
521       PyObject *splitByValueRange(PyObject *li) const
522       {
523         ARRAY *ret0=0,*ret1=0,*ret2=0;
524         void *da=0;
525         int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 |  0 );
526         if (!SWIG_IsOK(res1))
527           {
528             mcIdType size;
529             INTERP_KERNEL::AutoPtr<INT> tmp=convertPyToNewIntArr2<INT>(li,&size);
530             self->splitByValueRange(tmp,(INT *)tmp+size,ret0,ret1,ret2);
531           }
532         else
533           {
534             ARRAY *da2=reinterpret_cast< ARRAY * >(da);
535             if(!da2)
536               throw INTERP_KERNEL::Exception("Not null ARRAY instance expected !");
537             da2->checkAllocated();
538             self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
539           }
540         PyObject *ret = PyList_New(3);
541         PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
542         PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
543         PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
544         return ret;
545       }
546
547       DataArrayIdType *transformWithIndArrR(PyObject *li) const
548       {
549         void *da=0;
550         int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 |  0 );
551         if (!SWIG_IsOK(res1))
552           {
553             mcIdType size;
554             INTERP_KERNEL::AutoPtr<INT> tmp=convertPyToNewIntArr2<INT>(li,&size);
555             return self->transformWithIndArrR(tmp,tmp+size);
556           }
557         else
558           {
559             ARRAY *da2=reinterpret_cast< ARRAY * >(da);
560             return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
561           }
562       }
563
564       ARRAY *renumberAndReduce(PyObject *li, mcIdType newNbOfTuple)
565       {
566         void *da=0;
567         int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 |  0 );
568         if (!SWIG_IsOK(res1))
569           {
570             mcIdType size;
571             INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
572             if(size!=self->getNumberOfTuples())
573               {
574                 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
575               }
576             return self->renumberAndReduce(tmp,newNbOfTuple);
577           }
578         else
579           {
580             DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
581             if(!da2)
582               throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
583             da2->checkAllocated();
584             mcIdType size=self->getNumberOfTuples();
585             if(size!=self->getNumberOfTuples())
586               {
587                 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
588               }
589             return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
590           }
591       }
592
593       ARRAY *renumber(PyObject *li)
594       {
595         void *da=0;
596         int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 |  0 );
597         if (!SWIG_IsOK(res1))
598           {
599             mcIdType size;
600             INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
601             if(size!=self->getNumberOfTuples())
602               {
603                 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
604               }
605             return self->renumber(tmp);
606           }
607         else
608           {
609             DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
610             if(!da2)
611               throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
612             da2->checkAllocated();
613             mcIdType size=self->getNumberOfTuples();
614             if(size!=self->getNumberOfTuples())
615               {
616                 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
617               }
618             return self->renumber(da2->getConstPointer());
619           }
620       }
621
622       ARRAY *renumberR(PyObject *li)
623       {
624         void *da=0;
625         int res1=SWIG_ConvertPtr(li,&da,SWIGTITraits<mcIdType>::TI, 0 |  0 );
626         if (!SWIG_IsOK(res1))
627           {
628             mcIdType size;
629             INTERP_KERNEL::AutoPtr<mcIdType> tmp=convertPyToNewIntArr2(li,&size);
630             if(size!=self->getNumberOfTuples())
631               {
632                 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
633               }
634             return self->renumberR(tmp);
635           }
636         else
637           {
638             DataArrayIdType *da2=reinterpret_cast< DataArrayIdType * >(da);
639             if(!da2)
640               throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
641             da2->checkAllocated();
642             mcIdType size=self->getNumberOfTuples();
643             if(size!=self->getNumberOfTuples())
644               {
645                 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
646               }
647             return self->renumberR(da2->getConstPointer());
648           }
649       }
650
651       void setSelectedComponents(const ARRAY *a, PyObject *li)
652       {
653         std::vector<std::size_t> tmp;
654         convertPyToNewIntArr3(li,tmp);
655         self->setSelectedComponents(a,tmp);
656       }
657
658       PyObject *explodeComponents() const
659       {
660         std::vector< MCAuto<ARRAY> > retCpp(self->explodeComponents());
661         std::size_t sz(retCpp.size());
662         PyObject *res(PyList_New(sz));
663         for(std::size_t i=0;i<sz;i++)
664           PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
665         return res;
666       }
667
668       PyObject *getTuple(mcIdType tupleId)
669       {
670         mcIdType sz=ToIdType(self->getNumberOfComponents());
671         INTERP_KERNEL::AutoPtr<INT> tmp=new INT[sz];
672         self->getTuple(tupleId,tmp);
673         return convertIntArrToPyList((const INT*)tmp,sz);
674       }
675
676       PyObject *changeSurjectiveFormat(INT targetNb) const
677       {
678         DataArrayIdType *arr=0;
679         DataArrayIdType *arrI=0;
680         self->changeSurjectiveFormat(targetNb,arr,arrI);
681         PyObject *res = PyList_New(2);
682         PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
683         PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTITraits<mcIdType>::TI,SWIG_POINTER_OWN | 0));
684         return res;
685       }
686
687       static ARRAY *Meld(PyObject *li)
688       {
689         std::vector<const ARRAY *> tmp;
690         convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
691         return ARRAY::Meld(tmp);
692       }
693
694       static ARRAY *Aggregate(PyObject *li)
695       {
696         std::vector<const ARRAY *> tmp;
697         convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
698         return ARRAY::Aggregate(tmp);
699       }
700
701       static ARRAY *AggregateIndexes(PyObject *li)
702       {
703         std::vector<const ARRAY *> tmp;
704         convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
705         return ARRAY::AggregateIndexes(tmp);
706       }
707
708       static ARRAY *BuildUnion(PyObject *li)
709       {
710         std::vector<const ARRAY *> tmp;
711         convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
712         return ARRAY::BuildUnion(tmp);
713       }
714
715       static ARRAY *BuildIntersection(PyObject *li)
716       {
717         std::vector<const ARRAY *> tmp;
718         convertFromPyObjVectorOfObj(li,SWIGTITraits<INT>::TI,"ARRAY",tmp);
719         return ARRAY::BuildIntersection(tmp);
720       }
721
722       PyObject *getMaxValue() const
723       {
724         mcIdType tmp;
725         INT r1=self->getMaxValue(tmp);
726         PyObject *ret=PyTuple_New(2);
727         PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
728         PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
729         return ret;
730       }
731     
732       PyObject *getMaxAbsValue(std::size_t& tupleId) const
733       {
734         std::size_t tmp;
735         INT r1=self->getMaxAbsValue(tmp);
736         PyObject *ret=PyTuple_New(2);
737         PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
738         PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
739         return ret;
740       }
741
742       PyObject *getMinValue() const
743       {
744         mcIdType tmp;
745         INT r1=self->getMinValue(tmp);
746         PyObject *ret=PyTuple_New(2);
747         PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
748         PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
749         return ret;
750       }
751
752       mcIdType index(PyObject *obj) const
753       {
754         std::size_t nbOfCompo=self->getNumberOfComponents();
755         switch(nbOfCompo)
756           {
757           case 1:
758             {
759               if(PyInt_Check(obj))
760                 {
761                   INT val=(INT)PyInt_AS_LONG(obj);
762                   return self->findIdFirstEqual(val);
763                 }
764               else
765                 throw INTERP_KERNEL::Exception("ARRAY::index : 'this' contains one component and trying to find an element which is not an integer !");
766             }
767           default:
768             {
769               std::vector<INT> arr;
770               convertPyToNewIntArr3(obj,arr);
771               return self->findIdFirstEqualTuple(arr);
772             }
773           }
774       }
775
776       bool __contains__(PyObject *obj) const
777       {
778         std::size_t nbOfCompo=self->getNumberOfComponents();
779         switch(nbOfCompo)
780           {
781           case 0:
782             return false;
783           case 1:
784             {
785               if(PyInt_Check(obj))
786                 {
787                   INT val=(INT)PyInt_AS_LONG(obj);
788                   return self->presenceOfValue(val);
789                 }
790               else
791                 throw INTERP_KERNEL::Exception("ARRAY::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
792             }
793           default:
794             {
795               std::vector<INT> arr;
796               convertPyToNewIntArr3(obj,arr);
797               return self->presenceOfTuple(arr);
798             }
799           }
800       }
801
802       PyObject *__getitem__(PyObject *obj)
803       {
804         const char msg[]="Unexpected situation in ARRAY::__getitem__ !";
805         const char msg2[]="ARRAY::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
806         self->checkAllocated();
807         mcIdType nbOfTuples=self->getNumberOfTuples();
808         std::size_t nbOfComponents=self->getNumberOfComponents();
809         mcIdType it1;
810         std::size_t ic1;
811         std::vector<mcIdType> vt1;
812         std::vector<std::size_t> vc1;
813         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
814         DataArrayIdType *dt1=0,*dc1=0;
815         mcIdType sw;
816         convertObjToPossibleCpp3(obj,nbOfTuples,(int)nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
817         MCAuto<ARRAY> ret;
818         switch(sw)
819           {
820           case 1:
821             {
822               if(nbOfComponents==1)
823                 return PyInt_FromLong(self->getIJSafe(it1,0));
824               return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
825             }
826           case 2:
827             return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
828           case 3:
829             return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
830           case 4:
831             return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
832           case 5:
833             return PyInt_FromLong(self->getIJSafe(it1,ic1));
834           case 6:
835             {
836               ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
837               std::vector<std::size_t> v2(1,ic1);
838               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
839             }
840           case 7:
841             {
842               ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
843               std::vector<std::size_t> v2(1,ic1);
844               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
845             }
846           case 8:
847             {
848               ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
849               std::vector<std::size_t> v2(1,ic1);
850               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
851             }
852           case 9:
853             {
854               ret=self->selectByTupleIdSafe(&it1,&it1+1);
855               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
856             }
857           case 10:
858             {
859               ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
860               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
861             }
862           case 11:
863             {
864               ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
865               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
866             }
867           case 12:
868             {
869               ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
870               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
871             }
872           case 13:
873             {
874               ret=self->selectByTupleIdSafe(&it1,&it1+1);
875               mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
876               std::vector<std::size_t> v2(nbOfComp);
877               for(INT i=0;i<nbOfComp;i++)
878                 v2[i]=pc1.first+i*pc1.second.second;
879               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
880             }
881           case 14:
882             {
883               ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
884               mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
885               std::vector<std::size_t> v2(nbOfComp);
886               for(INT i=0;i<nbOfComp;i++)
887                 v2[i]=pc1.first+i*pc1.second.second;
888               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
889             }
890           case 15:
891             {
892               ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
893               mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
894               std::vector<std::size_t> v2(nbOfComp);
895               for(mcIdType i=0;i<nbOfComp;i++)
896                 v2[i]=pc1.first+i*pc1.second.second;
897               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
898             }
899           case 16:
900             {
901               ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
902               mcIdType nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
903               std::vector<std::size_t> v2(nbOfComp);
904               for(INT i=0;i<nbOfComp;i++)
905                 v2[i]=pc1.first+i*pc1.second.second;
906               return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 );
907             }
908           default:
909             throw INTERP_KERNEL::Exception(msg);
910           }
911       }
912
913       ARRAY *__setitem__(PyObject *obj, PyObject *value)
914       {
915         self->checkAllocated();
916         const char msg[]="Unexpected situation in __setitem__ !";
917         mcIdType nbOfTuples=self->getNumberOfTuples();
918         int nbOfComponents=(int)self->getNumberOfComponents();
919         mcIdType sw1,sw2;
920         INT i1;
921         std::vector<INT> v1;
922         ARRAY *d1=0;
923         ARRAY ## Tuple *dd1=0;
924         convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
925         mcIdType it1,ic1;
926         std::vector<mcIdType> vt1,vc1;
927         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > pt1,pc1;
928         DataArrayIdType *dt1=0,*dc1=0;
929         convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
930         MCAuto<ARRAY> tmp;
931         switch(sw2)
932           {
933           case 1:
934             {
935               switch(sw1)
936                 {
937                 case 1:
938                   self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
939                   return self;
940                 case 2:
941                   tmp=ARRAY::New();
942                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
943                   self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
944                   return self;
945                 case 3:
946                   self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
947                   return self;
948                 case 4:
949                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
950                   self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
951                   return self;
952                 default:
953                   throw INTERP_KERNEL::Exception(msg);
954                 }
955               break;
956             }
957           case 2:
958             {
959               switch(sw1)
960                 {
961                 case 1:
962                   self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
963                   return self;
964                 case 2:
965                   tmp=ARRAY::New();
966                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
967                   self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
968                   return self;
969                 case 3:
970                   self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
971                   return self;
972                 case 4:
973                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
974                   self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
975                   return self;
976                 default:
977                   throw INTERP_KERNEL::Exception(msg);
978                 }
979               break;
980             }
981           case 3:
982             {
983               switch(sw1)
984                 {
985                 case 1:
986                   self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
987                   return self;
988                 case 2:
989                   tmp=ARRAY::New();
990                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
991                   self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
992                   return self;
993                 case 3:
994                   self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
995                   return self;
996                 case 4:
997                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
998                   self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
999                   return self;
1000                 default:
1001                   throw INTERP_KERNEL::Exception(msg);
1002                 }
1003               break;
1004             }
1005           case 4:
1006             {
1007               switch(sw1)
1008                 {
1009                 case 1:
1010                   self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1011                   return self;
1012                 case 2:
1013                   tmp=ARRAY::New();
1014                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1015                   self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1016                   return self;
1017                 case 3:
1018                   self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1019                   return self;
1020                 case 4:
1021                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1022                   self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1023                   return self;
1024                 default:
1025                   throw INTERP_KERNEL::Exception(msg);
1026                 }
1027               break;
1028             }
1029           case 5:
1030             {
1031               switch(sw1)
1032                 {
1033                 case 1:
1034                   self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1035                   return self;
1036                 case 2:
1037                   tmp=ARRAY::New();
1038                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1039                   self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1040                   return self;
1041                 case 3:
1042                   self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1043                   return self;
1044                 case 4:
1045                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1046                   self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
1047                   return self;
1048                 default:
1049                   throw INTERP_KERNEL::Exception(msg);
1050                 }
1051               break;
1052             }
1053           case 6:
1054             {
1055               switch(sw1)
1056                 {
1057                 case 1:
1058                   self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1059                   return self;
1060                 case 2:
1061                   tmp=ARRAY::New();
1062                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1063                   self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1064                   return self;
1065                 case 3:
1066                   self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1067                   return self;
1068                 case 4:
1069                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1070                   self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1071                   return self;
1072                 default:
1073                   throw INTERP_KERNEL::Exception(msg);
1074                 }
1075               break;
1076             }
1077           case 7:
1078             {
1079               switch(sw1)
1080                 {
1081                 case 1:
1082                   self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1083                   return self;
1084                 case 2:
1085                   tmp=ARRAY::New();
1086                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1087                   self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1088                   return self;
1089                 case 3:
1090                   self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1091                   return self;
1092                 case 4:
1093                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1094                   self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1095                   return self;
1096                 default:
1097                   throw INTERP_KERNEL::Exception(msg);
1098                 }
1099               break;
1100             }
1101           case 8:
1102             {
1103               switch(sw1)
1104                 {
1105                 case 1:
1106                   self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1107                   return self;
1108                 case 2:
1109                   tmp=ARRAY::New();
1110                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1111                   self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1112                   return self;
1113                 case 3:
1114                   self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1115                   return self;
1116                 case 4:
1117                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1118                   self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1119                   return self;
1120                 default:
1121                   throw INTERP_KERNEL::Exception(msg);
1122                 }
1123               break;
1124             }
1125           case 9:
1126             {
1127               switch(sw1)
1128                 {
1129                 case 1:
1130                   self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1131                   return self;
1132                 case 2:
1133                   tmp=ARRAY::New();
1134                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1135                   self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1136                   return self;
1137                 case 3:
1138                   self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1139                   return self;
1140                 case 4:
1141                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1142                   self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1143                   return self;
1144                 default:
1145                   throw INTERP_KERNEL::Exception(msg);
1146                 }
1147               break;
1148             }
1149           case 10:
1150             {
1151               switch(sw1)
1152                 {
1153                 case 1:
1154                   self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1155                   return self;
1156                 case 2:
1157                   tmp=ARRAY::New();
1158                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1159                   self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1160                   return self;
1161                 case 3:
1162                   self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1163                   return self;
1164                 case 4:
1165                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1166                   self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1167                   return self;
1168                 default:
1169                   throw INTERP_KERNEL::Exception(msg);
1170                 }
1171               break;
1172             }
1173           case 11:
1174             {
1175               switch(sw1)
1176                 {
1177                 case 1:
1178                   self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1179                   return self;
1180                 case 2:
1181                   tmp=ARRAY::New();
1182                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1183                   self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1184                   return self;
1185                 case 3:
1186                   self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1187                   return self;
1188                 case 4:
1189                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1190                   self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1191                   return self;
1192                 default:
1193                   throw INTERP_KERNEL::Exception(msg);
1194                 }
1195               break;
1196             }
1197           case 12:
1198             {
1199               switch(sw1)
1200                 {
1201                 case 1:
1202                   self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1203                   return self;
1204                 case 2:
1205                   tmp=ARRAY::New();
1206                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1207                   self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1208                   return self;
1209                 case 3:
1210                   self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1211                   return self;
1212                 case 4:
1213                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1214                   self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1215                   return self;
1216                 default:
1217                   throw INTERP_KERNEL::Exception(msg);
1218                 }
1219               break;
1220             }
1221           case 13:
1222             {
1223               switch(sw1)
1224                 {
1225                 case 1:
1226                   self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1227                   return self;
1228                 case 2:
1229                   tmp=ARRAY::New();
1230                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1231                   self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1232                   return self;
1233                 case 3:
1234                   self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1235                   return self;
1236                 case 4:
1237                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1238                   self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1239                   return self;
1240                 default:
1241                   throw INTERP_KERNEL::Exception(msg);
1242                 }
1243               break;
1244             }
1245           case 14:
1246             {
1247               switch(sw1)
1248                 {
1249                 case 1:
1250                   self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1251                   return self;
1252                 case 2:
1253                   tmp=ARRAY::New();
1254                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1255                   self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1256                   return self;
1257                 case 3:
1258                   self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1259                   return self;
1260                 case 4:
1261                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1262                   self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1263                   return self;
1264                 default:
1265                   throw INTERP_KERNEL::Exception(msg);
1266                 }
1267               break;
1268             }
1269           case 15:
1270             {
1271               switch(sw1)
1272                 {
1273                 case 1:
1274                   self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1275                   return self;
1276                 case 2:
1277                   tmp=ARRAY::New();
1278                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1279                   self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1280                   return self;
1281                 case 3:
1282                   self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1283                   return self;
1284                 case 4:
1285                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1286                   self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1287                   return self;
1288                 default:
1289                   throw INTERP_KERNEL::Exception(msg);
1290                 }
1291               break;
1292             }
1293           case 16:
1294             {
1295               switch(sw1)
1296                 {
1297                 case 1:
1298                   self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1299                   return self;
1300                 case 2:
1301                   tmp=ARRAY::New();
1302                   tmp->useArray(&v1[0],false,DeallocType::CPP_DEALLOC,1,v1.size());
1303                   self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1304                   return self;
1305                 case 3:
1306                   self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1307                   return self;
1308                 case 4:
1309                   tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
1310                   self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1311                   return self;
1312                 default:
1313                   throw INTERP_KERNEL::Exception(msg);
1314                 }
1315               break;
1316             }
1317           default:
1318             throw INTERP_KERNEL::Exception(msg);
1319           }
1320         return self;
1321       }
1322
1323       ARRAY *__neg__() const
1324       {
1325         return self->negate();
1326       }
1327  
1328       ARRAY *__add__(PyObject *obj)
1329       {
1330         const char msg[]="Unexpected situation in __add__ !";
1331         INT val;
1332         ARRAY *a;
1333         std::vector<INT> aa;
1334         ARRAY ## Tuple *aaa;
1335         mcIdType sw;
1336         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1337         switch(sw)
1338           {
1339           case 1:
1340             {
1341               MCAuto<ARRAY> ret=self->deepCopy();
1342               ret->applyLin(1,val);
1343               return ret.retn();
1344             }
1345           case 2:
1346             {
1347               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1348               return ARRAY::Add(self,aaaa);
1349             }
1350           case 3:
1351             {
1352               return ARRAY::Add(self,a);
1353             }
1354           case 4:
1355             {
1356               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1357               return ARRAY::Add(self,aaaa);
1358             }
1359           default:
1360             throw INTERP_KERNEL::Exception(msg);
1361           }
1362       }
1363
1364       ARRAY *__radd__(PyObject *obj)
1365       {
1366         const char msg[]="Unexpected situation in __radd__ !";
1367         INT val;
1368         ARRAY *a;
1369         std::vector<INT> aa;
1370         ARRAY ## Tuple *aaa;
1371         mcIdType sw;
1372         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1373         switch(sw)
1374           {
1375           case 1:
1376             {
1377               MCAuto<ARRAY> ret=self->deepCopy();
1378               ret->applyLin(1,val);
1379               return ret.retn();
1380             }
1381           case 2:
1382             {
1383               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1384               return ARRAY::Add(self,aaaa);
1385             }
1386           case 4:
1387             {
1388               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1389               return ARRAY::Add(self,aaaa);
1390             }
1391           default:
1392             throw INTERP_KERNEL::Exception(msg);
1393           }
1394       }
1395
1396       PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
1397       {
1398         const char msg[]="Unexpected situation in __iadd__ !";
1399         INT val;
1400         ARRAY *a;
1401         std::vector<INT> aa;
1402         ARRAY ## Tuple *aaa;
1403         mcIdType sw;
1404         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1405         switch(sw)
1406           {
1407           case 1:
1408             {
1409               self->applyLin(1,val);
1410               Py_XINCREF(trueSelf);
1411               return trueSelf;
1412             }
1413           case 2:
1414             {
1415               MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1416               self->addEqual(bb);
1417               Py_XINCREF(trueSelf);
1418               return trueSelf;
1419             }
1420           case 3:
1421             {
1422               self->addEqual(a);
1423               Py_XINCREF(trueSelf);
1424               return trueSelf;
1425             }
1426           case 4:
1427             {
1428               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1429               self->addEqual(aaaa);
1430               Py_XINCREF(trueSelf);
1431               return trueSelf;
1432             }
1433           default:
1434             throw INTERP_KERNEL::Exception(msg);
1435           }
1436       }
1437
1438       ARRAY *__sub__(PyObject *obj)
1439       {
1440         const char msg[]="Unexpected situation in __sub__ !";
1441         INT val;
1442         ARRAY *a;
1443         std::vector<INT> aa;
1444         ARRAY ## Tuple *aaa;
1445         mcIdType sw;
1446         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1447         switch(sw)
1448           {
1449           case 1:
1450             {
1451               MCAuto<ARRAY> ret=self->deepCopy();
1452               ret->applyLin(1,-val);
1453               return ret.retn();
1454             }
1455           case 2:
1456             {
1457               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1458               return ARRAY::Substract(self,aaaa);
1459             }
1460           case 3:
1461             {
1462               return ARRAY::Substract(self,a);
1463             }
1464           case 4:
1465             {
1466               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1467               return ARRAY::Substract(self,aaaa);
1468             }
1469           default:
1470             throw INTERP_KERNEL::Exception(msg);
1471           }
1472       }
1473
1474       ARRAY *__rsub__(PyObject *obj)
1475       {
1476         const char msg[]="Unexpected situation in __rsub__ !";
1477         INT val;
1478         ARRAY *a;
1479         std::vector<INT> aa;
1480         ARRAY ## Tuple *aaa;
1481         mcIdType sw;
1482         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1483         switch(sw)
1484           {
1485           case 1:
1486             {
1487               MCAuto<ARRAY> ret=self->deepCopy();
1488               ret->applyLin(-1,val);
1489               return ret.retn();
1490             }
1491           case 2:
1492             {
1493               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1494               return ARRAY::Substract(aaaa,self);
1495             }
1496           case 4:
1497             {
1498               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1499               return ARRAY::Substract(aaaa,self);
1500             }
1501           default:
1502             throw INTERP_KERNEL::Exception(msg);
1503           }
1504       }
1505
1506       PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
1507       {
1508         const char msg[]="Unexpected situation in __isub__ !";
1509         INT val;
1510         ARRAY *a;
1511         std::vector<INT> aa;
1512         ARRAY ## Tuple *aaa;
1513         mcIdType sw;
1514         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1515         switch(sw)
1516           {
1517           case 1:
1518             {
1519               self->applyLin(1,-val);
1520               Py_XINCREF(trueSelf);
1521               return trueSelf;
1522             }
1523           case 2:
1524             {
1525               MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1526               self->substractEqual(bb);
1527               Py_XINCREF(trueSelf);
1528               return trueSelf;
1529             }
1530           case 3:
1531             {
1532               self->substractEqual(a);
1533               Py_XINCREF(trueSelf);
1534               return trueSelf;
1535             }
1536           case 4:
1537             {
1538               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1539               self->substractEqual(aaaa);
1540               Py_XINCREF(trueSelf);
1541               return trueSelf;
1542             }
1543           default:
1544             throw INTERP_KERNEL::Exception(msg);
1545           }
1546       }
1547
1548       ARRAY *__mul__(PyObject *obj)
1549       {
1550         const char msg[]="Unexpected situation in __mul__ !";
1551         INT val;
1552         ARRAY *a;
1553         std::vector<INT> aa;
1554         ARRAY ## Tuple *aaa;
1555         mcIdType sw;
1556         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1557         switch(sw)
1558           {
1559           case 1:
1560             {
1561               MCAuto<ARRAY> ret=self->deepCopy();
1562               ret->applyLin(val,0);
1563               return ret.retn();
1564             }
1565           case 2:
1566             {
1567               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1568               return ARRAY::Multiply(self,aaaa);
1569             }
1570           case 3:
1571             {
1572               return ARRAY::Multiply(self,a);
1573             }
1574           case 4:
1575             {
1576               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1577               return ARRAY::Multiply(self,aaaa);
1578             }
1579           default:
1580             throw INTERP_KERNEL::Exception(msg);
1581           }
1582       }
1583
1584       ARRAY *__rmul__(PyObject *obj)
1585       {
1586         const char msg[]="Unexpected situation in __rmul__ !";
1587         INT val;
1588         ARRAY *a;
1589         std::vector<INT> aa;
1590         ARRAY ## Tuple *aaa;
1591         mcIdType sw;
1592         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1593         switch(sw)
1594           {
1595           case 1:
1596             {
1597               MCAuto<ARRAY> ret=self->deepCopy();
1598               ret->applyLin(val,0);
1599               return ret.retn();
1600             }
1601           case 2:
1602             {
1603               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1604               return ARRAY::Multiply(self,aaaa);
1605             }
1606           case 4:
1607             {
1608               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1609               return ARRAY::Multiply(self,aaaa);
1610             }
1611           default:
1612             throw INTERP_KERNEL::Exception(msg);
1613           }
1614       }
1615
1616       PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
1617       {
1618         const char msg[]="Unexpected situation in __imul__ !";
1619         INT val;
1620         ARRAY *a;
1621         std::vector<INT> aa;
1622         ARRAY ## Tuple *aaa;
1623         mcIdType sw;
1624         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1625         switch(sw)
1626           {
1627           case 1:
1628             {
1629               self->applyLin(val,0);
1630               Py_XINCREF(trueSelf);
1631               return trueSelf;
1632             }
1633           case 2:
1634             {
1635               MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1636               self->multiplyEqual(bb);
1637               Py_XINCREF(trueSelf);
1638               return trueSelf;
1639             }
1640           case 3:
1641             {
1642               self->multiplyEqual(a);
1643               Py_XINCREF(trueSelf);
1644               return trueSelf;
1645             }
1646           case 4:
1647             {
1648               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1649               self->multiplyEqual(aaaa);
1650               Py_XINCREF(trueSelf);
1651               return trueSelf;
1652             }
1653           default:
1654             throw INTERP_KERNEL::Exception(msg);
1655           }
1656       }
1657
1658       ARRAY *__div__(PyObject *obj)
1659       {
1660         const char msg[]="Unexpected situation in __div__ !";
1661         INT val;
1662         ARRAY *a;
1663         std::vector<INT> aa;
1664         ARRAY ## Tuple *aaa;
1665         mcIdType sw;
1666         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1667         switch(sw)
1668           {
1669           case 1:
1670             {
1671               MCAuto<ARRAY> ret=self->deepCopy();
1672               ret->applyDivideBy(val);
1673               return ret.retn();
1674             }
1675           case 2:
1676             {
1677               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1678               return ARRAY::Divide(self,aaaa);
1679             }
1680           case 3:
1681             {
1682               return ARRAY::Divide(self,a);
1683             }
1684           case 4:
1685             {
1686               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1687               return ARRAY::Divide(self,aaaa);
1688             }
1689           default:
1690             throw INTERP_KERNEL::Exception(msg);
1691           }
1692       }
1693
1694       ARRAY *__rdiv__(PyObject *obj)
1695       {
1696         const char msg[]="Unexpected situation in __rdiv__ !";
1697         INT val;
1698         ARRAY *a;
1699         std::vector<INT> aa;
1700         ARRAY ## Tuple *aaa;
1701         mcIdType sw;
1702         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1703         switch(sw)
1704           {
1705           case 1:
1706             {
1707               MCAuto<ARRAY> ret=self->deepCopy();
1708               ret->applyInv(val);
1709               return ret.retn();
1710             }
1711           case 2:
1712             {
1713               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1714               return ARRAY::Divide(aaaa,self);
1715             }
1716           case 4:
1717             {
1718               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1719               return ARRAY::Divide(aaaa,self);
1720             }
1721           default:
1722             throw INTERP_KERNEL::Exception(msg);
1723           }
1724       }
1725
1726       PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
1727       {
1728         const char msg[]="Unexpected situation in __idiv__ !";
1729         INT val;
1730         ARRAY *a;
1731         std::vector<INT> aa;
1732         ARRAY ## Tuple *aaa;
1733         mcIdType sw;
1734         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1735         switch(sw)
1736           {
1737           case 1:
1738             {
1739               self->applyDivideBy(val);
1740               Py_XINCREF(trueSelf);
1741               return trueSelf;
1742             }
1743           case 2:
1744             {
1745               MCAuto<ARRAY> bb=ARRAY::New(); bb->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1746               self->divideEqual(bb);
1747               Py_XINCREF(trueSelf);
1748               return trueSelf;
1749             }
1750           case 3:
1751             {
1752               self->divideEqual(a);
1753               Py_XINCREF(trueSelf);
1754               return trueSelf;
1755             }
1756           case 4:
1757             {
1758               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1759               self->divideEqual(aaaa);
1760               Py_XINCREF(trueSelf);
1761               return trueSelf;
1762             }
1763           default:
1764             throw INTERP_KERNEL::Exception(msg);
1765           }
1766       }
1767
1768       ARRAY *__mod__(PyObject *obj)
1769       {
1770         const char msg[]="Unexpected situation in __mod__ !";
1771         INT val;
1772         ARRAY *a;
1773         std::vector<INT> aa;
1774         ARRAY ## Tuple *aaa;
1775         mcIdType sw;
1776         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1777         switch(sw)
1778           {
1779           case 1:
1780             {
1781               MCAuto<ARRAY> ret=self->deepCopy();
1782               ret->applyModulus(val);
1783               return ret.retn();
1784             }
1785           case 2:
1786             {
1787               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1788               return ARRAY::Modulus(self,aaaa);
1789             }
1790           case 3:
1791             {
1792               return ARRAY::Modulus(self,a);
1793             }
1794           case 4:
1795             {
1796               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1797               return ARRAY::Modulus(self,aaaa);
1798             }
1799           default:
1800             throw INTERP_KERNEL::Exception(msg);
1801           }
1802       }
1803
1804       ARRAY *__rmod__(PyObject *obj)
1805       {
1806         const char msg[]="Unexpected situation in __rmod__ !";
1807         INT val;
1808         ARRAY *a;
1809         std::vector<INT> aa;
1810         ARRAY ## Tuple *aaa;
1811         mcIdType sw;
1812         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1813         switch(sw)
1814           {
1815           case 1:
1816             {
1817               MCAuto<ARRAY> ret=self->deepCopy();
1818               ret->applyRModulus(val);
1819               return ret.retn();
1820             }
1821           case 2:
1822             {
1823               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1824               return ARRAY::Modulus(aaaa,self);
1825             }
1826           case 3:
1827             {
1828               return ARRAY::Modulus(a,self);
1829             }
1830           case 4:
1831             {
1832               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1833               return ARRAY::Modulus(aaaa,self);
1834             }
1835           default:
1836             throw INTERP_KERNEL::Exception(msg);
1837           }
1838       }
1839
1840       PyObject *___imod___(PyObject *trueSelf, PyObject *obj)
1841       {
1842         const char msg[]="Unexpected situation in __imod__ !";
1843         INT val;
1844         ARRAY *a;
1845         std::vector<INT> aa;
1846         ARRAY ## Tuple *aaa;
1847         mcIdType sw;
1848         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1849         switch(sw)
1850           {
1851           case 1:
1852             {
1853               self->applyModulus(val);
1854               Py_XINCREF(trueSelf);
1855               return trueSelf;
1856             }
1857           case 3:
1858             {
1859               self->modulusEqual(a);
1860               Py_XINCREF(trueSelf);
1861               return trueSelf;
1862             }
1863           case 4:
1864             {
1865               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1866               self->modulusEqual(aaaa);
1867               Py_XINCREF(trueSelf);
1868               return trueSelf;
1869             }
1870           default:
1871             throw INTERP_KERNEL::Exception(msg);
1872           }
1873       }
1874
1875       ARRAY *__pow__(PyObject *obj)
1876       {
1877         const char msg[]="Unexpected situation in __pow__ !";
1878         INT val;
1879         ARRAY *a;
1880         std::vector<INT> aa;
1881         ARRAY ## Tuple *aaa;
1882         mcIdType sw;
1883         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1884         switch(sw)
1885           {
1886           case 1:
1887             {
1888               MCAuto<ARRAY> ret=self->deepCopy();
1889               ret->applyPow(val);
1890               return ret.retn();
1891             }
1892           case 2:
1893             {
1894               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1895               return ARRAY::Pow(self,aaaa);
1896             }
1897           case 3:
1898             {
1899               return ARRAY::Pow(self,a);
1900             }
1901           case 4:
1902             {
1903               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1904               return ARRAY::Pow(self,aaaa);
1905             }
1906           default:
1907             throw INTERP_KERNEL::Exception(msg);
1908           }
1909       }
1910
1911       ARRAY *__rpow__(PyObject *obj)
1912       {
1913         const char msg[]="Unexpected situation in __rpow__ !";
1914         INT val;
1915         ARRAY *a;
1916         std::vector<INT> aa;
1917         ARRAY ## Tuple *aaa;
1918         mcIdType sw;
1919         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1920         switch(sw)
1921           {
1922           case 1:
1923             {
1924               MCAuto<ARRAY> ret=self->deepCopy();
1925               ret->applyRPow(val);
1926               return ret.retn();
1927             }
1928           case 2:
1929             {
1930               MCAuto<ARRAY> aaaa=ARRAY::New(); aaaa->useArray(&aa[0],false,DeallocType::CPP_DEALLOC,1,aa.size());
1931               return ARRAY::Pow(aaaa,self);
1932             }
1933           case 3:
1934             {
1935               return ARRAY::Pow(a,self);
1936             }
1937           case 4:
1938             {
1939               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1940               return ARRAY::Pow(aaaa,self);
1941             }
1942           default:
1943             throw INTERP_KERNEL::Exception(msg);
1944           }
1945       }
1946    
1947       PyObject *___ipow___(PyObject *trueSelf, PyObject *obj)
1948       {
1949         const char msg[]="Unexpected situation in __ipow__ !";
1950         INT val;
1951         ARRAY *a;
1952         std::vector<INT> aa;
1953         ARRAY ## Tuple *aaa;
1954         mcIdType sw;
1955         convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
1956         switch(sw)
1957           {
1958           case 1:
1959             {
1960               self->applyPow(val);
1961               Py_XINCREF(trueSelf);
1962               return trueSelf;
1963             }
1964           case 3:
1965             {
1966               self->powEqual(a);
1967               Py_XINCREF(trueSelf);
1968               return trueSelf;
1969             }
1970           case 4:
1971             {
1972               MCAuto<ARRAY> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
1973               self->powEqual(aaaa);
1974               Py_XINCREF(trueSelf);
1975               return trueSelf;
1976             }
1977           default:
1978             throw INTERP_KERNEL::Exception(msg);
1979           }
1980       }
1981
1982       std::string __repr__() const
1983       {
1984         std::ostringstream oss;
1985         self->reprQuickOverview(oss);
1986         return oss.str();
1987       }
1988       
1989       void pushBackValsSilent(PyObject *li)
1990       {
1991         mcIdType szArr,sw;
1992         INT iTypppArr;
1993         std::vector<INT> stdvecTyyppArr;
1994         const INT *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
1995         self->pushBackValsSilent(tmp,tmp+szArr);
1996       }
1997       
1998       PyObject *partitionByDifferentValues() const
1999       {
2000         std::vector<INT> ret1;
2001         std::vector<DataArrayIdType *> ret0=self->partitionByDifferentValues(ret1);
2002         std::size_t sz=ret0.size();
2003         PyObject *pyRet=PyTuple_New(2);
2004         PyObject *pyRet0=PyList_New((INT)sz);
2005         PyObject *pyRet1=PyList_New((INT)sz);
2006         for(std::size_t i=0;i<sz;i++)
2007           {
2008             PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2009             PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
2010           }
2011         PyTuple_SetItem(pyRet,0,pyRet0);
2012         PyTuple_SetItem(pyRet,1,pyRet1);
2013         return pyRet;
2014       }
2015       
2016       PyObject *findIdsRangesInListOfIds(const ARRAY *listOfIds) const
2017       {
2018         DataArrayIdType *ret0=0;
2019         ARRAY *ret1=0;
2020         self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
2021         PyObject *pyRet=PyTuple_New(2);
2022         PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2023         PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTITraits<INT>::TI, SWIG_POINTER_OWN | 0 ));
2024         return pyRet;
2025       }
2026
2027       PyObject *isRange() const
2028       {
2029         INT a(0),b(0),c(0);
2030         bool ret(self->isRange(a,b,c));
2031         PyObject *pyRet=PyTuple_New(2);
2032         PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
2033         Py_XINCREF(ret0Py);
2034         PyTuple_SetItem(pyRet,0,ret0Py);
2035         if(ret)
2036           ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
2037         else
2038           {
2039             ret1Py=Py_None;
2040             Py_XINCREF(ret1Py);
2041           }
2042         PyTuple_SetItem(pyRet,1,ret1Py);
2043         return pyRet;
2044       }
2045
2046       static bool RemoveIdsFromIndexedArrays(PyObject *li, ARRAY *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0) throw(INTERP_KERNEL::Exception)
2047       {
2048         mcIdType sw;
2049         INT singleVal;
2050         std::vector<INT> multiVal;
2051         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2052         MEDCoupling::ARRAY *daIntTyypp=0;
2053         if(!arrIndx)
2054           throw INTERP_KERNEL::Exception("ARRAY::RemoveIdsFromIndexedArrays : null pointer as arrIndex !");
2055         convertIntStarOrSliceLikePyObjToCpp(li,arrIndx->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2056         switch(sw)
2057           {
2058           case 1:
2059             return ARRAY::RemoveIdsFromIndexedArrays(&singleVal,&singleVal+1,arr,arrIndx,offsetForRemoval);
2060           case 2:
2061             return ARRAY::RemoveIdsFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arr,arrIndx,offsetForRemoval);
2062           case 4:
2063             return ARRAY::RemoveIdsFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arr,arrIndx,offsetForRemoval);
2064           default:
2065             throw INTERP_KERNEL::Exception("MEDCouplingUMesh::RemoveIdsFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
2066           }
2067       }
2068
2069       static PyObject *ExtractFromIndexedArrays(PyObject *li, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception)
2070       {
2071         ARRAY *arrOut=0;
2072         DataArrayIdType *arrIndexOut=0;
2073         mcIdType sw;
2074         mcIdType singleVal;
2075         std::vector<mcIdType> multiVal;
2076         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2077         MEDCoupling::DataArrayIdType *daIntTyypp=0;
2078         if(!arrIndxIn)
2079           throw INTERP_KERNEL::Exception("ARRAY::ExtractFromIndexedArrays : null pointer as arrIndxIn !");
2080         convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2081         switch(sw)
2082           {
2083           case 1:
2084             {
2085               ARRAY::ExtractFromIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,arrOut,arrIndexOut);
2086               break;
2087             }
2088           case 2:
2089             {
2090               ARRAY::ExtractFromIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2091               break;
2092             }
2093           case 4:
2094             {
2095               ARRAY::ExtractFromIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,arrOut,arrIndexOut);
2096               break;
2097             }
2098           default:
2099             throw INTERP_KERNEL::Exception("ARRAY::ExtractFromIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
2100           }
2101         PyObject *ret=PyTuple_New(2);
2102         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2103         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2104         return ret;
2105       }
2106
2107       static PyObject *ExtractFromIndexedArraysSlice(mcIdType strt, mcIdType stp, mcIdType step, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception)
2108       {
2109         ARRAY *arrOut=0;
2110         DataArrayIdType *arrIndexOut=0;
2111         ARRAY::ExtractFromIndexedArraysSlice(strt,stp,step,arrIn,arrIndxIn,arrOut,arrIndexOut);
2112         PyObject *ret=PyTuple_New(2);
2113         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2114         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2115         return ret;
2116       }
2117
2118       static PyObject *ExtractFromIndexedArraysSlice(PyObject *slic, const ARRAY *arrIn, const DataArrayIdType *arrIndxIn) throw(INTERP_KERNEL::Exception)
2119       {
2120         if(!PySlice_Check(slic))
2121           throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : the first param is not a pyslice !");
2122         Py_ssize_t strt=2,stp=2,step=2;
2123         if(!arrIndxIn)
2124           throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : last array is null !");
2125         arrIndxIn->checkAllocated();
2126         if(arrIndxIn->getNumberOfComponents()!=1)
2127           throw INTERP_KERNEL::Exception("ExtractFromIndexedArraysSlice (wrap) : number of components of last argument must be equal to one !");
2128         GetIndicesOfSlice(slic,arrIndxIn->getNumberOfTuples(),&strt,&stp,&step,"ExtractFromIndexedArraysSlice (wrap) : Invalid slice regarding nb of elements !");
2129         ARRAY *arrOut=0;
2130         DataArrayIdType *arrIndexOut=0;
2131         ARRAY::ExtractFromIndexedArraysSlice(ToIdType(strt),ToIdType(stp),ToIdType(step),arrIn,arrIndxIn,arrOut,arrIndexOut);
2132         PyObject *ret=PyTuple_New(2);
2133         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2134         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2135         return ret;
2136       }
2137
2138       static PyObject *SetPartOfIndexedArrays(PyObject *li,
2139                                               const ARRAY *arrIn, const DataArrayIdType *arrIndxIn,
2140                                               const ARRAY *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception)
2141       {
2142         ARRAY *arrOut=0;
2143         DataArrayIdType *arrIndexOut=0;
2144         mcIdType sw;
2145         mcIdType singleVal;
2146         std::vector<mcIdType> multiVal;
2147         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2148         MEDCoupling::DataArrayIdType *daIntTyypp=0;
2149         if(!arrIndxIn)
2150           throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArrays : null pointer as arrIndex !");
2151         convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2152         switch(sw)
2153           {
2154           case 1:
2155             {
2156               ARRAY::SetPartOfIndexedArrays(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2157               break;
2158             }
2159           case 2:
2160             {
2161               ARRAY::SetPartOfIndexedArrays(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2162               break;
2163             }
2164           case 4:
2165             {
2166               ARRAY::SetPartOfIndexedArrays(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex,arrOut,arrIndexOut);
2167               break;
2168             }
2169           default:
2170             throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArrays : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
2171           }
2172         PyObject *ret=PyTuple_New(2);
2173         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(arrOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2174         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(arrIndexOut),SWIGTITraits<mcIdType>::TI, SWIG_POINTER_OWN | 0 ));
2175         return ret;
2176       }
2177
2178       static void SetPartOfIndexedArraysSameIdx(PyObject *li, ARRAY *arrIn, const DataArrayIdType *arrIndxIn,
2179                                                 const ARRAY *srcArr, const DataArrayIdType *srcArrIndex) throw(INTERP_KERNEL::Exception)
2180       {
2181         mcIdType sw;
2182         mcIdType singleVal;
2183         std::vector<mcIdType> multiVal;
2184         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2185         MEDCoupling::DataArrayIdType *daIntTyypp=0;
2186         if(!arrIndxIn)
2187           throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArraysSameIdx : null pointer as arrIndex !");
2188         convertIntStarOrSliceLikePyObjToCpp(li,arrIndxIn->getNumberOfTuples()-1,sw,singleVal,multiVal,slic,daIntTyypp);
2189         switch(sw)
2190           {
2191           case 1:
2192             {
2193               ARRAY::SetPartOfIndexedArraysSameIdx(&singleVal,&singleVal+1,arrIn,arrIndxIn,srcArr,srcArrIndex);
2194               break;
2195             }
2196           case 2:
2197             {
2198               ARRAY::SetPartOfIndexedArraysSameIdx(&multiVal[0],&multiVal[0]+multiVal.size(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2199               break;
2200             }
2201           case 4:
2202             {
2203               ARRAY::SetPartOfIndexedArraysSameIdx(daIntTyypp->begin(),daIntTyypp->end(),arrIn,arrIndxIn,srcArr,srcArrIndex);
2204               break;
2205             }
2206           default:
2207             throw INTERP_KERNEL::Exception("ARRAY::SetPartOfIndexedArraysSameIdx : unrecognized type entered, expected list of int, tuple of int or ARRAY !");
2208           }
2209       }
2210
2211     } // end extent
2212   };
2213
2214   class ARRAY ## Tuple;
2215
2216   class ARRAY ## Iterator
2217   {
2218   public:
2219     ARRAY ## Iterator(ARRAY *da);
2220     ~ARRAY ## Iterator();
2221     %extend
2222     {
2223       PyObject *next()
2224       {
2225         ARRAY ## Tuple *ret=self->nextt();
2226         if(ret)
2227           return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__ ## ARRAY ## Tuple,SWIG_POINTER_OWN | 0);
2228         else
2229           {
2230             PyErr_SetString(PyExc_StopIteration,"No more data.");
2231             return 0;
2232           }
2233       }
2234     }
2235   };
2236
2237   class ARRAY ## Tuple
2238   {
2239   public:
2240     std::size_t getNumberOfCompo() const;
2241     ARRAY *buildDAInt(INT nbOfTuples, INT nbOfCompo) const;
2242     %extend
2243     {
2244       std::string __str__() const
2245       {
2246         return self->repr();
2247       }
2248
2249       INT __int__() const
2250       {
2251         return self->intValue();
2252       }
2253
2254       ARRAY *buildDAInt()
2255       {
2256         return self->buildDAInt(1,self->getNumberOfCompo());
2257       }
2258
2259       PyObject *___iadd___(PyObject *trueSelf, PyObject *obj)
2260       {
2261         MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
2262         MEDCoupling_ ## ARRAY ## ____iadd___(ret,0,obj);
2263         Py_XINCREF(trueSelf);
2264         return trueSelf;
2265       }
2266   
2267       PyObject *___isub___(PyObject *trueSelf, PyObject *obj)
2268       {
2269         MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
2270         MEDCoupling_ ## ARRAY ## ____isub___(ret,0,obj);
2271         Py_XINCREF(trueSelf);
2272         return trueSelf;
2273       }
2274   
2275       PyObject *___imul___(PyObject *trueSelf, PyObject *obj)
2276       {
2277         MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
2278         MEDCoupling_ ## ARRAY ## ____imul___(ret,0,obj);
2279         Py_XINCREF(trueSelf);
2280         return trueSelf;
2281       }
2282       PyObject *___idiv___(PyObject *trueSelf, PyObject *obj)
2283       {
2284         MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
2285         MEDCoupling_ ## ARRAY ## ____idiv___(ret,0,obj);
2286         Py_XINCREF(trueSelf);
2287         return trueSelf;
2288       }
2289
2290       PyObject *___imod___(PyObject *trueSelf, PyObject *obj)
2291       {
2292         MCAuto<ARRAY> ret=self->buildDAInt(1,self->getNumberOfCompo());
2293         MEDCoupling_ ## ARRAY ## ____imod___(ret,0,obj);
2294         Py_XINCREF(trueSelf);
2295         return trueSelf;
2296       }
2297
2298       PyObject *__len__()
2299       {
2300         return PyInt_FromLong(self->getNumberOfCompo());
2301       }
2302   
2303       PyObject *__getitem__(PyObject *obj)
2304       {
2305         const char msg2[]="ARRAY ## Tuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2306         mcIdType sw;
2307         INT singleVal;
2308         std::vector<INT> multiVal;
2309         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2310         MEDCoupling::DataArrayIdType *daIntTyypp=0;
2311         const INT *pt=self->getConstPointer();
2312         INT nbc=(INT)self->getNumberOfCompo();
2313         convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,ToIdType(nbc),sw,singleVal,multiVal,slic,daIntTyypp);
2314         switch(sw)
2315           {
2316           case 1:
2317             {
2318               if(singleVal>=(INT)nbc)
2319                 {
2320                   std::ostringstream oss;
2321                   oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2322                   PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2323                   return 0;
2324                 }
2325               if(singleVal>=0)
2326                 return PyInt_FromLong(pt[singleVal]);
2327               else
2328                 {
2329                   if(nbc+singleVal>0)
2330                     return PyInt_FromLong(pt[nbc+singleVal]);
2331                   else
2332                     {
2333                       std::ostringstream oss;
2334                       oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2335                       throw INTERP_KERNEL::Exception(oss.str().c_str());
2336                     }
2337                 }
2338             }
2339           case 2:
2340             {
2341               PyObject *t=PyTuple_New(multiVal.size());
2342               for(std::size_t j=0;j<multiVal.size();j++)
2343                 {
2344                   INT cid=multiVal[j];
2345                   if(cid>=(INT)nbc)
2346                     {
2347                       std::ostringstream oss;
2348                       oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2349                       throw INTERP_KERNEL::Exception(oss.str().c_str());
2350                     }
2351                   PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
2352                 }
2353               return t;
2354             }
2355           case 3:
2356             {
2357               mcIdType sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2358               PyObject *t=PyTuple_New(sz);
2359               for(INT j=0;j<sz;j++)
2360                 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
2361               return t;
2362             }
2363           default:
2364             throw INTERP_KERNEL::Exception("ARRAY ## Tuple::__getitem__ : unrecognized type entered !");
2365           }
2366       }
2367
2368       ARRAY ## Tuple *__setitem__(PyObject *obj, PyObject *value)
2369       {
2370         const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2371         const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2372         mcIdType sw1,sw2;
2373         mcIdType singleValV;
2374         std::vector<mcIdType> multiValV;
2375         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slicV;
2376         MEDCoupling::ARRAY ## Tuple *daIntTyyppV=0;
2377         mcIdType nbc=ToIdType(self->getNumberOfCompo());
2378         convertObjToPossibleCpp22<INT>(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
2379         INT singleVal;
2380         std::vector<INT> multiVal;
2381         std::pair<mcIdType, std::pair<mcIdType,mcIdType> > slic;
2382         MEDCoupling::ARRAY *daIntTyypp=0;
2383         INT *pt=self->getPointer();
2384         convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2385         switch(sw2)
2386           {
2387           case 1:
2388             {
2389               if(singleVal>=nbc)
2390                 {
2391                   std::ostringstream oss;
2392                   oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2393                   throw INTERP_KERNEL::Exception(oss.str().c_str());
2394                 }
2395               switch(sw1)
2396                 {
2397                 case 1:
2398                   {
2399                     pt[singleVal]=(INT)singleValV;
2400                     return self;
2401                   }
2402                 case 2:
2403                   {
2404                     if(multiValV.size()!=1)
2405                       {
2406                         std::ostringstream oss;
2407                         oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2408                         throw INTERP_KERNEL::Exception(oss.str().c_str());
2409                       }
2410                     pt[singleVal]=(INT)multiValV[0];
2411                     return self;
2412                   }
2413                 case 4:
2414                   {
2415                     pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2416                     return self;
2417                   }
2418                 default:
2419                   throw INTERP_KERNEL::Exception(msg);
2420                 }
2421             }
2422           case 2:
2423             {
2424               switch(sw1)
2425                 {
2426                 case 1:
2427                   {
2428                     for(std::vector<INT>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2429                       {
2430                         if(*it>=nbc)
2431                           {
2432                             std::ostringstream oss;
2433                             oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2434                             throw INTERP_KERNEL::Exception(oss.str().c_str());
2435                           }
2436                         pt[*it]=(INT)singleValV;
2437                       }
2438                     return self;
2439                   }
2440                 case 2:
2441                   {
2442                     if(multiVal.size()!=multiValV.size())
2443                       {
2444                         std::ostringstream oss;
2445                         oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2446                         throw INTERP_KERNEL::Exception(oss.str().c_str());
2447                       }
2448                     for(INT i=0;i<(INT)multiVal.size();i++)
2449                       {
2450                         INT pos=multiVal[i];
2451                         if(pos>=nbc)
2452                           {
2453                             std::ostringstream oss;
2454                             oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2455                             throw INTERP_KERNEL::Exception(oss.str().c_str());
2456                           }
2457                         pt[multiVal[i]]=(INT)multiValV[i];
2458                       }
2459                     return self;
2460                   }
2461                 case 4:
2462                   {
2463                     const INT *ptV=daIntTyyppV->getConstPointer();
2464                     if(nbc>(INT)daIntTyyppV->getNumberOfCompo())
2465                       {
2466                         std::ostringstream oss;
2467                         oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2468                         throw INTERP_KERNEL::Exception(oss.str().c_str());
2469                       }
2470                     std::copy(ptV,ptV+nbc,pt);
2471                     return self;
2472                   }
2473                 default:
2474                   throw INTERP_KERNEL::Exception(msg);
2475                 }
2476             }
2477           case 3:
2478             {
2479               std::size_t sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2480               switch(sw1)
2481                 {
2482                 case 1:
2483                   {
2484                     for(std::size_t j=0;j<sz;j++)
2485                       pt[slic.first+j*slic.second.second]=(INT)singleValV;
2486                     return self;
2487                   }
2488                 case 2:
2489                   {
2490                     if(sz!=multiValV.size())
2491                       {
2492                         std::ostringstream oss;
2493                         oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2494                         throw INTERP_KERNEL::Exception(oss.str().c_str());
2495                       }
2496                     for(std::size_t j=0;j<sz;j++)
2497                       pt[slic.first+j*slic.second.second]=(INT)multiValV[j];
2498                     return self;
2499                   }
2500                 case 4:
2501                   {
2502                     const INT *ptV=daIntTyyppV->getConstPointer();
2503                     if(sz>daIntTyyppV->getNumberOfCompo())
2504                       {
2505                         std::ostringstream oss;
2506                         oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2507                         throw INTERP_KERNEL::Exception(oss.str().c_str());
2508                       }
2509                     for(std::size_t j=0;j<sz;j++)
2510                       pt[slic.first+j*slic.second.second]=ptV[j];
2511                     return self;
2512                   }
2513                 default:
2514                   throw INTERP_KERNEL::Exception(msg);
2515                 }
2516             }
2517           default:
2518             throw INTERP_KERNEL::Exception(msg);
2519           }
2520       }
2521     }
2522 //   };
2523 // }
2524 %enddef
2525
2526
2527 %define TRANSFORMWITHINDARR( ARRAY, INT )
2528 void transformWithIndArr(PyObject *li)
2529 {
2530   void *da=0;
2531   int res1(SWIG_ConvertPtr(li,&da,SWIGTITraits<INT>::TI, 0 |  0 ));
2532   if (!SWIG_IsOK(res1))
2533     {
2534       int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 |  0 ));
2535       if(SWIG_IsOK(res2))
2536         {
2537           MapII *m=reinterpret_cast<MapII *>(da);
2538           self->transformWithIndArr(*m);
2539         }
2540       else
2541         {
2542           mcIdType size;
2543           INTERP_KERNEL::AutoPtr<INT> tmp=convertPyToNewIntArr2<INT>(li,&size);
2544           self->transformWithIndArr(tmp,tmp+size);
2545         }
2546     }
2547   else
2548     {
2549       ARRAY *da2=reinterpret_cast< ARRAY * >(da);
2550       self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2551     }
2552 }
2553 %enddef
2554
2555 namespace MEDCoupling
2556 {
2557   typedef int      Int32;
2558 #ifdef WIN32
2559   typedef long long Int64;
2560 #else
2561   typedef long int  Int64;
2562 #endif
2563
2564   class DataArrayInt32Iterator;
2565
2566   class DataArrayInt32 : public DataArray
2567   {
2568     ARRAYDEF( DataArrayInt32, Int32 )
2569   };
2570   %extend DataArrayInt32 {
2571 #ifdef WITH_NUMPY
2572     PyObject *toNumPyArray() // not const. It is not a bug !
2573     {
2574       return ToNumPyArray<DataArrayInt32,MEDCoupling::Int32>(self,NPY_INT32,"DataArrayInt32");
2575     }
2576 #endif
2577 #ifndef MEDCOUPLING_USE_64BIT_IDS
2578     MCAuto< MapII > invertArrayN2O2O2NOptimized()
2579     {
2580       return self->invertArrayN2O2O2NOptimized();
2581     }
2582     MCAuto< MapII > giveN2OOptimized()
2583     {
2584       return self->giveN2OOptimized();
2585     }
2586     TRANSFORMWITHINDARR( DataArrayInt32, Int32 )
2587 #endif
2588   };
2589   
2590   class DataArrayInt64Iterator;
2591
2592   class DataArrayInt64 : public DataArray
2593   {
2594     ARRAYDEF( DataArrayInt64, Int64 )
2595   };
2596   %extend DataArrayInt64 {
2597 #ifdef WITH_NUMPY
2598     PyObject *toNumPyArray() // not const. It is not a bug !
2599     {
2600       return ToNumPyArray<DataArrayInt64,MEDCoupling::Int64>(self,NPY_INT64,"DataArrayInt64");
2601     }
2602 #endif
2603 #ifdef MEDCOUPLING_USE_64BIT_IDS
2604     MCAuto< MapII > invertArrayN2O2O2NOptimized()
2605     {
2606       return self->invertArrayN2O2O2NOptimized();
2607     }
2608     MCAuto< MapII > giveN2OOptimized()
2609     {
2610       return self->giveN2OOptimized();
2611     }
2612     TRANSFORMWITHINDARR( DataArrayInt64, Int64 )
2613 #endif
2614   };
2615
2616 }