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