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