1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) ParaMEDMEM::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) ParaMEDMEM::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject ParaMEDMEM::DataArray::deepCpy;
46 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
47 %newobject ParaMEDMEM::DataArray::selectByTupleId;
48 %newobject ParaMEDMEM::DataArray::selectByTupleIdSafe;
49 %newobject ParaMEDMEM::DataArray::selectByTupleId2;
50 %newobject ParaMEDMEM::DataArray::Aggregate;
51 %newobject ParaMEDMEM::DataArrayInt::New;
52 %newobject ParaMEDMEM::DataArrayInt::__iter__;
53 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
54 %newobject ParaMEDMEM::DataArrayInt::performCpy;
55 %newobject ParaMEDMEM::DataArrayInt::substr;
56 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
57 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
58 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
59 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
60 %newobject ParaMEDMEM::DataArrayInt::renumber;
61 %newobject ParaMEDMEM::DataArrayInt::renumberR;
62 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
63 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
64 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
65 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
66 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
67 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
68 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
69 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
70 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
71 %newobject ParaMEDMEM::DataArrayInt::negate;
72 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
73 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
74 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
75 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
76 %newobject ParaMEDMEM::DataArrayInt::Meld;
77 %newobject ParaMEDMEM::DataArrayInt::Add;
78 %newobject ParaMEDMEM::DataArrayInt::Substract;
79 %newobject ParaMEDMEM::DataArrayInt::Multiply;
80 %newobject ParaMEDMEM::DataArrayInt::Divide;
81 %newobject ParaMEDMEM::DataArrayInt::Pow;
82 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
83 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
84 %newobject ParaMEDMEM::DataArrayInt::Range;
85 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
86 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
87 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
88 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
89 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
90 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
91 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
92 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
93 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
94 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
95 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
96 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
97 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
98 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
99 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
100 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
101 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
102 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
103 %newobject ParaMEDMEM::DataArrayInt::__neg__;
104 %newobject ParaMEDMEM::DataArrayInt::__add__;
105 %newobject ParaMEDMEM::DataArrayInt::__radd__;
106 %newobject ParaMEDMEM::DataArrayInt::__sub__;
107 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
108 %newobject ParaMEDMEM::DataArrayInt::__mul__;
109 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
110 %newobject ParaMEDMEM::DataArrayInt::__div__;
111 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
112 %newobject ParaMEDMEM::DataArrayInt::__mod__;
113 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
114 %newobject ParaMEDMEM::DataArrayInt::__pow__;
115 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
116 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
117 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
118 %newobject ParaMEDMEM::DataArrayChar::renumber;
119 %newobject ParaMEDMEM::DataArrayChar::renumberR;
120 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
121 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
122 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
123 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
124 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
125 %newobject ParaMEDMEM::DataArrayChar::Meld;
126 %newobject ParaMEDMEM::DataArrayByte::New;
127 %newobject ParaMEDMEM::DataArrayByte::__iter__;
128 %newobject ParaMEDMEM::DataArrayByte::performCpy;
129 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
130 %newobject ParaMEDMEM::DataArrayChar::substr;
131 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
132 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
133 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
134 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
135 %newobject ParaMEDMEM::DataArrayDouble::New;
136 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
137 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
138 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
139 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
140 %newobject ParaMEDMEM::DataArrayDouble::Meld;
141 %newobject ParaMEDMEM::DataArrayDouble::Dot;
142 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
143 %newobject ParaMEDMEM::DataArrayDouble::Add;
144 %newobject ParaMEDMEM::DataArrayDouble::Substract;
145 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
146 %newobject ParaMEDMEM::DataArrayDouble::Divide;
147 %newobject ParaMEDMEM::DataArrayDouble::Pow;
148 %newobject ParaMEDMEM::DataArrayDouble::substr;
149 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
150 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
151 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
152 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
153 %newobject ParaMEDMEM::DataArrayDouble::negate;
154 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
155 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
156 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
157 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
158 %newobject ParaMEDMEM::DataArrayDouble::determinant;
159 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
160 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
161 %newobject ParaMEDMEM::DataArrayDouble::inverse;
162 %newobject ParaMEDMEM::DataArrayDouble::trace;
163 %newobject ParaMEDMEM::DataArrayDouble::deviator;
164 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
165 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
166 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
167 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
168 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
169 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
170 %newobject ParaMEDMEM::DataArrayDouble::renumber;
171 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
172 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
173 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
174 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
175 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
176 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
177 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
178 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
179 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
180 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
181 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
182 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
183 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
184 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
185 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
186 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
187 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
188 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
189 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
191 %feature("unref") DataArray "$this->decrRef();"
192 %feature("unref") DataArrayDouble "$this->decrRef();"
193 %feature("unref") DataArrayInt "$this->decrRef();"
194 %feature("unref") DataArrayChar "$this->decrRef();"
195 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
196 %feature("unref") DataArrayByte "$this->decrRef();"
200 class DataArray : public RefCountObject, public TimeLabel
203 void setName(const char *name);
204 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
205 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
206 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
207 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
208 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
209 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
210 std::string getName() const;
211 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
212 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
213 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
214 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
215 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
216 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
217 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
218 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
219 int getNumberOfComponents() const;
220 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
221 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
222 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
223 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
224 virtual void desallocate() throw(INTERP_KERNEL::Exception);
225 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
226 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
227 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
228 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
229 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
230 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
231 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
232 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
233 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
234 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
235 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
236 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
237 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
238 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
239 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
240 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
241 void updateTime() const;
244 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
246 const std::vector<std::string>& comps=self->getInfoOnComponents();
247 PyObject *ret=PyList_New((int)comps.size());
248 for(int i=0;i<(int)comps.size();i++)
249 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
253 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
255 std::vector<int> tmp;
256 convertPyToNewIntArr3(li,tmp);
257 self->copyPartOfStringInfoFrom(other,tmp);
260 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
262 std::vector<int> tmp;
263 convertPyToNewIntArr3(li,tmp);
264 self->copyPartOfStringInfoFrom2(tmp,other);
267 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
270 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
271 if (!SWIG_IsOK(res1))
274 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
275 if(size!=self->getNumberOfTuples())
277 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
279 self->renumberInPlace(tmp);
283 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
285 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
286 da2->checkAllocated();
287 int size=self->getNumberOfTuples();
288 if(size!=self->getNumberOfTuples())
290 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
292 self->renumberInPlace(da2->getConstPointer());
296 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
299 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
300 if (!SWIG_IsOK(res1))
303 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
304 if(size!=self->getNumberOfTuples())
306 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
308 self->renumberInPlaceR(tmp);
312 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
314 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
315 da2->checkAllocated();
316 int size=self->getNumberOfTuples();
317 if(size!=self->getNumberOfTuples())
319 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
321 self->renumberInPlaceR(da2->getConstPointer());
325 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
326 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
328 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
329 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
330 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
331 DataArrayInt *tuplesSelecPtr2=0;
334 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
336 throw INTERP_KERNEL::Exception(msg);
338 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
341 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
343 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
344 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
347 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
349 std::vector<std::pair<int,int> > ranges;
350 convertPyToVectorPairInt(li,ranges);
351 return self->selectByTupleRanges(ranges);
354 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
357 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
358 if (!SWIG_IsOK(res1))
361 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
362 return self->selectByTupleId(tmp,tmp+size);
366 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
368 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
369 da2->checkAllocated();
370 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
374 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
377 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
378 if (!SWIG_IsOK(res1))
381 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
382 return self->selectByTupleIdSafe(tmp,tmp+size);
386 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
388 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
389 da2->checkAllocated();
390 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
394 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
396 std::vector<int> tmp;
397 convertPyToNewIntArr3(li,tmp);
398 DataArray *ret=self->keepSelectedComponents(tmp);
399 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
402 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
404 if(!PySlice_Check(slic))
405 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
406 Py_ssize_t strt=2,stp=2,step=2;
407 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
408 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
409 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
410 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
411 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
413 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
414 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
417 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
419 if(!PySlice_Check(slic))
420 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
421 Py_ssize_t strt=2,stp=2,step=2;
422 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
423 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
424 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
426 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
427 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
430 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
432 if(!PySlice_Check(slic))
433 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
434 Py_ssize_t strt=2,stp=2,step=2;
435 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
436 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
437 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
438 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
439 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
440 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
443 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
445 if(!PySlice_Check(slic))
446 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
447 Py_ssize_t strt=2,stp=2,step=2;
448 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
449 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
450 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
451 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
452 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
453 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
456 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
458 std::vector<const DataArray *> tmp;
459 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
460 return DataArray::Aggregate(tmp);
463 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
465 if(!PySlice_Check(slic))
466 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
467 Py_ssize_t strt=2,stp=2,step=2;
468 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
469 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
470 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
471 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
474 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
476 if(!PySlice_Check(slic))
477 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
478 Py_ssize_t strt=2,stp=2,step=2;
479 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
480 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
481 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
482 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
488 class DataArrayDoubleIterator;
490 class DataArrayDouble : public DataArray
493 static DataArrayDouble *New();
494 double doubleValue() const throw(INTERP_KERNEL::Exception);
495 bool empty() const throw(INTERP_KERNEL::Exception);
496 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
497 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
498 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
499 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
500 double popBackSilent() throw(INTERP_KERNEL::Exception);
501 void pack() const throw(INTERP_KERNEL::Exception);
502 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
503 void fillWithZero() throw(INTERP_KERNEL::Exception);
504 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
505 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
506 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
507 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
508 void reverse() throw(INTERP_KERNEL::Exception);
509 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
510 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
511 std::string repr() const throw(INTERP_KERNEL::Exception);
512 std::string reprZip() const throw(INTERP_KERNEL::Exception);
513 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
514 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
515 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
516 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
517 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
518 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
519 void transpose() throw(INTERP_KERNEL::Exception);
520 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
521 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
522 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
523 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
524 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
525 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
526 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
527 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
528 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
529 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
530 double front() const throw(INTERP_KERNEL::Exception);
531 double back() const throw(INTERP_KERNEL::Exception);
532 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
533 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
534 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
535 double *getPointer() throw(INTERP_KERNEL::Exception);
536 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
537 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
538 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
539 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
540 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
541 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
542 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
543 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
544 double getAverageValue() const throw(INTERP_KERNEL::Exception);
545 double norm2() const throw(INTERP_KERNEL::Exception);
546 double normMax() const throw(INTERP_KERNEL::Exception);
547 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
550 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
563 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
564 void abs() throw(INTERP_KERNEL::Exception);
565 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
566 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
567 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
568 void applyPow(double val) throw(INTERP_KERNEL::Exception);
569 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
570 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
571 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
572 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
573 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
574 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
575 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
576 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
577 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
578 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
579 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
580 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
581 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
582 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
583 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
584 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
585 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
586 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
587 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
588 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
589 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
590 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
591 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
592 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
593 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
594 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
595 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
598 DataArrayDouble() throw(INTERP_KERNEL::Exception)
600 return DataArrayDouble::New();
603 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
605 const char *msgBase="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
606 std::string msg(msgBase);
608 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
611 if(PyList_Check(elt0) || PyTuple_Check(elt0))
615 if(PyInt_Check(nbOfTuples))
617 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
619 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
622 if(PyInt_Check(elt2))
623 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
624 int nbOfCompo=PyInt_AS_LONG(elt2);
626 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
627 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
628 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
629 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
633 throw INTERP_KERNEL::Exception(msg.c_str());
636 {//DataArrayDouble.New([1.,3.,4.],3)
637 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
639 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
640 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
645 throw INTERP_KERNEL::Exception(msg.c_str());
648 {// DataArrayDouble.New([1.,3.,4.])
649 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
650 int tmpp1=-1,tmpp2=-1;
651 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
652 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
656 else if(PyInt_Check(elt0))
658 int nbOfTuples1=PyInt_AS_LONG(elt0);
660 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
665 if(PyInt_Check(nbOfTuples))
666 {//DataArrayDouble.New(5,2)
667 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
669 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
670 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
671 ret->alloc(nbOfTuples1,nbOfCompo);
675 throw INTERP_KERNEL::Exception(msg.c_str());
678 throw INTERP_KERNEL::Exception(msg.c_str());
681 {//DataArrayDouble.New(5)
682 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
683 ret->alloc(nbOfTuples1,1);
688 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
689 {//DataArrayDouble.New(numpyArray)
690 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
694 throw INTERP_KERNEL::Exception(msg.c_str());
697 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
699 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
702 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
705 std::vector<double> bb;
707 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
708 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
709 self->pushBackValsSilent(tmp,tmp+nbTuples);
712 std::string __repr__() const throw(INTERP_KERNEL::Exception)
714 std::ostringstream oss;
715 self->reprQuickOverview(oss);
719 std::string __str__() const throw(INTERP_KERNEL::Exception)
724 double __float__() const throw(INTERP_KERNEL::Exception)
726 return self->doubleValue();
729 int __len__() const throw(INTERP_KERNEL::Exception)
731 if(self->isAllocated())
733 return self->getNumberOfTuples();
737 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
741 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
743 return self->iterator();
746 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
748 const char *msg="ParaMEDMEM::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
749 if(PyList_Check(li) || PyTuple_Check(li))
753 if(PyInt_Check(nbOfTuples))
755 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
757 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
760 if(PyInt_Check(nbOfComp))
761 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
762 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
764 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
765 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
766 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
769 throw INTERP_KERNEL::Exception(msg);
772 {//DataArrayDouble.setValues([1.,3.,4.],3)
774 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
775 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
779 throw INTERP_KERNEL::Exception(msg);
782 {// DataArrayDouble.setValues([1.,3.,4.])
783 int tmpp1=-1,tmpp2=-1;
784 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
785 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
789 throw INTERP_KERNEL::Exception(msg);
792 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
794 const double *vals=self->getConstPointer();
795 return convertDblArrToPyList(vals,self->getNbOfElems());
799 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
801 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
805 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
808 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
809 PyObject *ret=PyTuple_New(2);
810 PyObject *ret0Py=ret0?Py_True:Py_False;
812 PyTuple_SetItem(ret,0,ret0Py);
813 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
817 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
819 const double *vals=self->getConstPointer();
820 int nbOfComp=self->getNumberOfComponents();
821 int nbOfTuples=self->getNumberOfTuples();
822 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
825 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
828 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
829 if (!SWIG_IsOK(res1))
832 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
833 if(size!=self->getNumberOfTuples())
835 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
837 return self->renumber(tmp);
841 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
843 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
844 da2->checkAllocated();
845 int size=self->getNumberOfTuples();
846 if(size!=self->getNumberOfTuples())
848 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
850 return self->renumber(da2->getConstPointer());
854 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
857 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
858 if (!SWIG_IsOK(res1))
861 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
862 if(size!=self->getNumberOfTuples())
864 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
866 return self->renumberR(tmp);
870 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
872 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
873 da2->checkAllocated();
874 int size=self->getNumberOfTuples();
875 if(size!=self->getNumberOfTuples())
877 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
879 return self->renumberR(da2->getConstPointer());
883 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
886 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
887 if (!SWIG_IsOK(res1))
890 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
891 if(size!=self->getNumberOfTuples())
893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
895 return self->renumberAndReduce(tmp,newNbOfTuple);
899 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
901 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
902 da2->checkAllocated();
903 int size=self->getNumberOfTuples();
904 if(size!=self->getNumberOfTuples())
906 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
908 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
912 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
914 int thisTupleId,otherTupleId;
915 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
916 PyObject *ret=PyTuple_New(3);
917 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
918 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
919 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
923 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
926 double r1=self->getMaxValue(tmp);
927 PyObject *ret=PyTuple_New(2);
928 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
929 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
933 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
936 double r1=self->getMaxValue2(tmp);
937 PyObject *ret=PyTuple_New(2);
938 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
939 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
943 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
946 double r1=self->getMinValue(tmp);
947 PyObject *ret=PyTuple_New(2);
948 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
949 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
953 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
956 double r1=self->getMinValue2(tmp);
957 PyObject *ret=PyTuple_New(2);
958 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
959 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
963 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
965 int nbOfCompo=self->getNumberOfComponents();
966 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
967 self->getMinMaxPerComponent(tmp);
968 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
972 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
974 int sz=self->getNumberOfComponents();
975 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
976 self->accumulate(tmp);
977 return convertDblArrToPyList(tmp,sz);
980 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
983 std::vector<int> val2;
984 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
985 return self->accumulatePerChunck(bg,bg+sz);
988 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
990 DataArrayInt *comm, *commIndex;
991 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
992 PyObject *res = PyList_New(2);
993 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
994 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
998 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1002 DataArrayDoubleTuple *aa;
1003 std::vector<double> bb;
1005 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1006 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1008 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1009 PyObject *ret=PyTuple_New(2);
1010 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1011 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1015 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1017 std::vector<int> tmp;
1018 convertPyToNewIntArr3(li,tmp);
1019 self->setSelectedComponents(a,tmp);
1022 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1024 int sz=self->getNumberOfComponents();
1025 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1026 self->getTuple(tupleId,tmp);
1027 return convertDblArrToPyList(tmp,sz);
1030 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1032 std::vector<const DataArrayDouble *> tmp;
1033 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1034 return DataArrayDouble::Aggregate(tmp);
1037 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1039 std::vector<const DataArrayDouble *> tmp;
1040 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1041 return DataArrayDouble::Meld(tmp);
1044 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1048 DataArrayDoubleTuple *aa;
1049 std::vector<double> bb;
1051 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1052 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1053 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1054 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1055 DataArrayInt *c=0,*cI=0;
1056 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1057 PyObject *ret=PyTuple_New(2);
1058 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1059 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1063 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1065 DataArrayInt *ret1=0;
1066 bool ret0=self->areIncludedInMe(other,prec,ret1);
1067 PyObject *ret=PyTuple_New(2);
1068 PyObject *ret0Py=ret0?Py_True:Py_False;
1070 PyTuple_SetItem(ret,0,ret0Py);
1071 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1075 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1077 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1078 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1079 self->checkAllocated();
1080 int nbOfTuples=self->getNumberOfTuples();
1081 int nbOfComponents=self->getNumberOfComponents();
1083 std::vector<int> vt1,vc1;
1084 std::pair<int, std::pair<int,int> > pt1,pc1;
1085 DataArrayInt *dt1=0,*dc1=0;
1087 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1088 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1092 if(nbOfComponents==1)
1093 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1094 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1096 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1098 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1100 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1102 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1105 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1106 std::vector<int> v2(1,ic1);
1107 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1111 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1112 std::vector<int> v2(1,ic1);
1113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1117 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1118 std::vector<int> v2(1,ic1);
1119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1123 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1124 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1128 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1133 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1134 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1138 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1139 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1143 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1144 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1145 std::vector<int> v2(nbOfComp);
1146 for(int i=0;i<nbOfComp;i++)
1147 v2[i]=pc1.first+i*pc1.second.second;
1148 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1152 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1153 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1154 std::vector<int> v2(nbOfComp);
1155 for(int i=0;i<nbOfComp;i++)
1156 v2[i]=pc1.first+i*pc1.second.second;
1157 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1161 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1162 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1163 std::vector<int> v2(nbOfComp);
1164 for(int i=0;i<nbOfComp;i++)
1165 v2[i]=pc1.first+i*pc1.second.second;
1166 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1170 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1171 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1172 std::vector<int> v2(nbOfComp);
1173 for(int i=0;i<nbOfComp;i++)
1174 v2[i]=pc1.first+i*pc1.second.second;
1175 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1178 throw INTERP_KERNEL::Exception(msg);
1182 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1184 self->checkAllocated();
1185 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1186 int nbOfTuples=self->getNumberOfTuples();
1187 int nbOfComponents=self->getNumberOfComponents();
1190 std::vector<double> v1;
1191 DataArrayDouble *d1=0;
1192 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1194 std::vector<int> vt1,vc1;
1195 std::pair<int, std::pair<int,int> > pt1,pc1;
1196 DataArrayInt *dt1=0,*dc1=0;
1197 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1198 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1206 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1209 tmp=DataArrayDouble::New();
1210 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1211 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1214 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1217 throw INTERP_KERNEL::Exception(msg);
1226 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1229 tmp=DataArrayDouble::New();
1230 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1231 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1234 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1237 throw INTERP_KERNEL::Exception(msg);
1246 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1249 tmp=DataArrayDouble::New();
1250 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1251 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1254 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1257 throw INTERP_KERNEL::Exception(msg);
1266 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1269 tmp=DataArrayDouble::New();
1270 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1271 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1274 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1277 throw INTERP_KERNEL::Exception(msg);
1286 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1289 tmp=DataArrayDouble::New();
1290 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1291 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1294 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1297 throw INTERP_KERNEL::Exception(msg);
1306 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1309 tmp=DataArrayDouble::New();
1310 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1311 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1314 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1317 throw INTERP_KERNEL::Exception(msg);
1326 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1329 tmp=DataArrayDouble::New();
1330 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1331 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1334 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1337 throw INTERP_KERNEL::Exception(msg);
1346 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1349 tmp=DataArrayDouble::New();
1350 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1351 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1354 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1357 throw INTERP_KERNEL::Exception(msg);
1366 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1369 tmp=DataArrayDouble::New();
1370 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1371 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1374 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1377 throw INTERP_KERNEL::Exception(msg);
1386 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1389 tmp=DataArrayDouble::New();
1390 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1391 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1394 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1397 throw INTERP_KERNEL::Exception(msg);
1406 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1409 tmp=DataArrayDouble::New();
1410 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1411 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1414 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1417 throw INTERP_KERNEL::Exception(msg);
1426 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1429 tmp=DataArrayDouble::New();
1430 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1431 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1434 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1437 throw INTERP_KERNEL::Exception(msg);
1446 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1449 tmp=DataArrayDouble::New();
1450 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1451 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1454 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1457 throw INTERP_KERNEL::Exception(msg);
1466 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1469 tmp=DataArrayDouble::New();
1470 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1471 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1474 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1477 throw INTERP_KERNEL::Exception(msg);
1486 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1489 tmp=DataArrayDouble::New();
1490 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1491 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1494 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1497 throw INTERP_KERNEL::Exception(msg);
1506 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1509 tmp=DataArrayDouble::New();
1510 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1511 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1514 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1517 throw INTERP_KERNEL::Exception(msg);
1522 throw INTERP_KERNEL::Exception(msg);
1527 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1529 return self->negate();
1532 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1534 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1537 DataArrayDoubleTuple *aa;
1538 std::vector<double> bb;
1541 #ifndef WITHOUT_AUTOFIELD
1543 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1545 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1548 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1549 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1551 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1554 throw INTERP_KERNEL::Exception(msg);
1558 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1563 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1564 ret->applyLin(1.,val);
1565 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1569 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1573 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1574 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1578 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1579 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1582 throw INTERP_KERNEL::Exception(msg);
1586 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1588 const char msg[]="Unexpected situation in __radd__ !";
1591 DataArrayDoubleTuple *aa;
1592 std::vector<double> bb;
1594 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1599 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1600 ret->applyLin(1.,val);
1605 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1606 return DataArrayDouble::Add(self,aaa);
1610 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1611 return DataArrayDouble::Add(self,aaa);
1614 throw INTERP_KERNEL::Exception(msg);
1618 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1620 const char msg[]="Unexpected situation in __iadd__ !";
1623 DataArrayDoubleTuple *aa;
1624 std::vector<double> bb;
1626 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1631 self->applyLin(1.,val);
1632 Py_XINCREF(trueSelf);
1638 Py_XINCREF(trueSelf);
1643 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1644 self->addEqual(aaa);
1645 Py_XINCREF(trueSelf);
1650 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1651 self->addEqual(aaa);
1652 Py_XINCREF(trueSelf);
1656 throw INTERP_KERNEL::Exception(msg);
1660 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1662 const char msg[]="Unexpected situation in __sub__ !";
1665 DataArrayDoubleTuple *aa;
1666 std::vector<double> bb;
1669 #ifndef WITHOUT_AUTOFIELD
1671 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1673 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1676 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1677 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1679 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1682 throw INTERP_KERNEL::Exception(msg);
1686 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1691 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1692 ret->applyLin(1.,-val);
1693 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1697 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1701 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1702 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1706 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1707 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1710 throw INTERP_KERNEL::Exception(msg);
1714 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1716 const char msg[]="Unexpected situation in __rsub__ !";
1719 DataArrayDoubleTuple *aa;
1720 std::vector<double> bb;
1722 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1727 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1728 ret->applyLin(-1.,val);
1733 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1734 return DataArrayDouble::Substract(aaa,self);
1738 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1739 return DataArrayDouble::Substract(aaa,self);
1742 throw INTERP_KERNEL::Exception(msg);
1746 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1748 const char msg[]="Unexpected situation in __isub__ !";
1751 DataArrayDoubleTuple *aa;
1752 std::vector<double> bb;
1754 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1759 self->applyLin(1,-val);
1760 Py_XINCREF(trueSelf);
1765 self->substractEqual(a);
1766 Py_XINCREF(trueSelf);
1771 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1772 self->substractEqual(aaa);
1773 Py_XINCREF(trueSelf);
1778 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1779 self->substractEqual(aaa);
1780 Py_XINCREF(trueSelf);
1784 throw INTERP_KERNEL::Exception(msg);
1788 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1790 const char msg[]="Unexpected situation in __mul__ !";
1793 DataArrayDoubleTuple *aa;
1794 std::vector<double> bb;
1797 #ifndef WITHOUT_AUTOFIELD
1799 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1801 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1804 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1805 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1807 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1810 throw INTERP_KERNEL::Exception(msg);
1814 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1819 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1820 ret->applyLin(val,0.);
1821 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1825 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1829 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1830 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1834 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1835 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1838 throw INTERP_KERNEL::Exception(msg);
1842 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1844 const char msg[]="Unexpected situation in __rmul__ !";
1847 DataArrayDoubleTuple *aa;
1848 std::vector<double> bb;
1850 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1855 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1856 ret->applyLin(val,0.);
1861 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1862 return DataArrayDouble::Multiply(self,aaa);
1866 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1867 return DataArrayDouble::Multiply(self,aaa);
1870 throw INTERP_KERNEL::Exception(msg);
1874 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1876 const char msg[]="Unexpected situation in __imul__ !";
1879 DataArrayDoubleTuple *aa;
1880 std::vector<double> bb;
1882 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1887 self->applyLin(val,0.);
1888 Py_XINCREF(trueSelf);
1893 self->multiplyEqual(a);
1894 Py_XINCREF(trueSelf);
1899 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1900 self->multiplyEqual(aaa);
1901 Py_XINCREF(trueSelf);
1906 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1907 self->multiplyEqual(aaa);
1908 Py_XINCREF(trueSelf);
1912 throw INTERP_KERNEL::Exception(msg);
1916 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1918 const char msg[]="Unexpected situation in __div__ !";
1921 DataArrayDoubleTuple *aa;
1922 std::vector<double> bb;
1925 #ifndef WITHOUT_AUTOFIELD
1927 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1929 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1932 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1933 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1935 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1938 throw INTERP_KERNEL::Exception(msg);
1942 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1948 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1949 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1950 ret->applyLin(1/val,0.);
1951 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1955 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1959 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1960 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1964 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1965 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1968 throw INTERP_KERNEL::Exception(msg);
1972 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1974 const char msg[]="Unexpected situation in __rdiv__ !";
1977 DataArrayDoubleTuple *aa;
1978 std::vector<double> bb;
1980 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1985 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1991 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1992 return DataArrayDouble::Divide(aaa,self);
1996 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1997 return DataArrayDouble::Divide(aaa,self);
2000 throw INTERP_KERNEL::Exception(msg);
2004 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2006 const char msg[]="Unexpected situation in __idiv__ !";
2009 DataArrayDoubleTuple *aa;
2010 std::vector<double> bb;
2012 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2018 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2019 self->applyLin(1./val,0.);
2020 Py_XINCREF(trueSelf);
2025 self->divideEqual(a);
2026 Py_XINCREF(trueSelf);
2031 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2032 self->divideEqual(aaa);
2033 Py_XINCREF(trueSelf);
2038 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2039 self->divideEqual(aaa);
2040 Py_XINCREF(trueSelf);
2044 throw INTERP_KERNEL::Exception(msg);
2048 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2050 const char msg[]="Unexpected situation in __pow__ !";
2053 DataArrayDoubleTuple *aa;
2054 std::vector<double> bb;
2056 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2061 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2067 return DataArrayDouble::Pow(self,a);
2071 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2072 return DataArrayDouble::Pow(self,aaa);
2076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2077 return DataArrayDouble::Pow(self,aaa);
2080 throw INTERP_KERNEL::Exception(msg);
2084 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2086 const char msg[]="Unexpected situation in __rpow__ !";
2089 DataArrayDoubleTuple *aa;
2090 std::vector<double> bb;
2092 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2097 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2098 ret->applyRPow(val);
2103 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2104 return DataArrayDouble::Pow(aaa,self);
2108 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2109 return DataArrayDouble::Pow(aaa,self);
2112 throw INTERP_KERNEL::Exception(msg);
2116 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2118 const char msg[]="Unexpected situation in __ipow__ !";
2121 DataArrayDoubleTuple *aa;
2122 std::vector<double> bb;
2124 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2129 self->applyPow(val);
2130 Py_XINCREF(trueSelf);
2136 Py_XINCREF(trueSelf);
2141 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2142 self->powEqual(aaa);
2143 Py_XINCREF(trueSelf);
2148 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2149 self->powEqual(aaa);
2150 Py_XINCREF(trueSelf);
2154 throw INTERP_KERNEL::Exception(msg);
2158 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2160 DataArrayInt *c=0,*cI=0;
2162 self->computeTupleIdsNearTuples(other,eps,c,cI);
2163 PyObject *ret=PyTuple_New(2);
2164 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2165 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2169 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2171 DataArrayInt *ret1=0;
2172 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2173 PyObject *ret=PyTuple_New(2);
2174 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2175 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2181 class DataArrayDoubleTuple;
2183 class DataArrayDoubleIterator
2186 DataArrayDoubleIterator(DataArrayDouble *da);
2187 ~DataArrayDoubleIterator();
2192 DataArrayDoubleTuple *ret=self->nextt();
2194 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2197 PyErr_SetString(PyExc_StopIteration,"No more data.");
2204 class DataArrayDoubleTuple
2207 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2208 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2211 std::string __str__() const throw(INTERP_KERNEL::Exception)
2213 return self->repr();
2216 double __float__() const throw(INTERP_KERNEL::Exception)
2218 return self->doubleValue();
2221 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2223 return self->buildDADouble(1,self->getNumberOfCompo());
2226 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2228 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2229 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2230 Py_XINCREF(trueSelf);
2234 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2236 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2237 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2238 Py_XINCREF(trueSelf);
2242 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2244 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2245 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2246 Py_XINCREF(trueSelf);
2250 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2252 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2253 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2254 Py_XINCREF(trueSelf);
2258 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2260 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2263 std::vector<int> multiVal;
2264 std::pair<int, std::pair<int,int> > slic;
2265 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2266 const double *pt=self->getConstPointer();
2267 int nbc=self->getNumberOfCompo();
2268 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2275 std::ostringstream oss;
2276 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2277 throw INTERP_KERNEL::Exception(oss.str().c_str());
2280 return PyFloat_FromDouble(pt[singleVal]);
2284 return PyFloat_FromDouble(pt[nbc+singleVal]);
2287 std::ostringstream oss;
2288 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2289 throw INTERP_KERNEL::Exception(oss.str().c_str());
2295 PyObject *t=PyTuple_New(multiVal.size());
2296 for(int j=0;j<(int)multiVal.size();j++)
2298 int cid=multiVal[j];
2301 std::ostringstream oss;
2302 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2303 throw INTERP_KERNEL::Exception(oss.str().c_str());
2305 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2311 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2312 PyObject *t=PyTuple_New(sz);
2313 for(int j=0;j<sz;j++)
2314 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2318 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2322 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2324 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2325 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2328 std::vector<double> multiValV;
2329 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2330 int nbc=self->getNumberOfCompo();
2331 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2333 std::vector<int> multiVal;
2334 std::pair<int, std::pair<int,int> > slic;
2335 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2336 double *pt=self->getPointer();
2337 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2344 std::ostringstream oss;
2345 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2346 throw INTERP_KERNEL::Exception(oss.str().c_str());
2352 pt[singleVal]=singleValV;
2357 if(multiValV.size()!=1)
2359 std::ostringstream oss;
2360 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2361 throw INTERP_KERNEL::Exception(oss.str().c_str());
2363 pt[singleVal]=multiValV[0];
2368 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2372 throw INTERP_KERNEL::Exception(msg);
2381 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2385 std::ostringstream oss;
2386 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2387 throw INTERP_KERNEL::Exception(oss.str().c_str());
2395 if(multiVal.size()!=multiValV.size())
2397 std::ostringstream oss;
2398 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2399 throw INTERP_KERNEL::Exception(oss.str().c_str());
2401 for(int i=0;i<(int)multiVal.size();i++)
2403 int pos=multiVal[i];
2406 std::ostringstream oss;
2407 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2408 throw INTERP_KERNEL::Exception(oss.str().c_str());
2410 pt[multiVal[i]]=multiValV[i];
2416 const double *ptV=daIntTyyppV->getConstPointer();
2417 if(nbc>daIntTyyppV->getNumberOfCompo())
2419 std::ostringstream oss;
2420 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2421 throw INTERP_KERNEL::Exception(oss.str().c_str());
2423 std::copy(ptV,ptV+nbc,pt);
2427 throw INTERP_KERNEL::Exception(msg);
2432 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2437 for(int j=0;j<sz;j++)
2438 pt[slic.first+j*slic.second.second]=singleValV;
2443 if(sz!=(int)multiValV.size())
2445 std::ostringstream oss;
2446 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2447 throw INTERP_KERNEL::Exception(oss.str().c_str());
2449 for(int j=0;j<sz;j++)
2450 pt[slic.first+j*slic.second.second]=multiValV[j];
2455 const double *ptV=daIntTyyppV->getConstPointer();
2456 if(sz>daIntTyyppV->getNumberOfCompo())
2458 std::ostringstream oss;
2459 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2460 throw INTERP_KERNEL::Exception(oss.str().c_str());
2462 for(int j=0;j<sz;j++)
2463 pt[slic.first+j*slic.second.second]=ptV[j];
2467 throw INTERP_KERNEL::Exception(msg);
2471 throw INTERP_KERNEL::Exception(msg);
2477 class DataArrayIntIterator;
2479 class DataArrayInt : public DataArray
2482 static DataArrayInt *New();
2483 int intValue() const throw(INTERP_KERNEL::Exception);
2484 int getHashCode() const throw(INTERP_KERNEL::Exception);
2485 bool empty() const throw(INTERP_KERNEL::Exception);
2486 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2487 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2488 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2489 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2490 int popBackSilent() throw(INTERP_KERNEL::Exception);
2491 void pack() const throw(INTERP_KERNEL::Exception);
2492 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2493 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2494 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2495 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2496 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2497 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2498 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2499 void reverse() throw(INTERP_KERNEL::Exception);
2500 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2501 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2502 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2503 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2504 void fillWithZero() throw(INTERP_KERNEL::Exception);
2505 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2506 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2507 std::string repr() const throw(INTERP_KERNEL::Exception);
2508 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2509 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2510 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2511 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2512 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2513 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2514 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2516 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2517 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2518 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2519 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2520 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2521 void transpose() throw(INTERP_KERNEL::Exception);
2522 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2523 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2524 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2525 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2526 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2527 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2528 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2529 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2530 int front() const throw(INTERP_KERNEL::Exception);
2531 int back() const throw(INTERP_KERNEL::Exception);
2532 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2533 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2534 int *getPointer() throw(INTERP_KERNEL::Exception);
2535 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2536 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2537 const int *begin() const throw(INTERP_KERNEL::Exception);
2538 const int *end() const throw(INTERP_KERNEL::Exception);
2539 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2540 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2541 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2542 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2543 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2544 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2545 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2546 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2547 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2548 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2549 int count(int value) const throw(INTERP_KERNEL::Exception);
2550 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2551 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2552 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2553 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2554 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2555 void abs() throw(INTERP_KERNEL::Exception);
2556 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2557 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2558 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2559 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2560 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2561 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2562 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2563 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2564 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2565 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2566 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2567 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2568 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2569 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2570 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2571 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2572 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2573 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2574 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2575 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2576 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2577 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2578 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2581 void computeOffsets() throw(INTERP_KERNEL::Exception);
2582 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2583 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2584 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2585 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2586 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2587 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2588 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2589 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2590 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2591 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2592 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2593 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2594 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2595 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2596 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2597 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2598 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2599 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2601 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2604 DataArrayInt() throw(INTERP_KERNEL::Exception)
2606 return DataArrayInt::New();
2609 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2611 const char *msgBase="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)";
2612 std::string msg(msgBase);
2614 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2617 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2621 if(PyInt_Check(nbOfTuples))
2623 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2625 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2628 if(PyInt_Check(nbOfComp))
2629 {//DataArrayInt.New([1,3,4,5],2,2)
2630 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2632 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2633 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2634 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2635 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2639 throw INTERP_KERNEL::Exception(msg.c_str());
2642 {//DataArrayInt.New([1,3,4],3)
2643 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2645 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2646 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2651 throw INTERP_KERNEL::Exception(msg.c_str());
2654 {// DataArrayInt.New([1,3,4])
2655 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2656 int tmpp1=-1,tmpp2=-1;
2657 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2658 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2662 else if(PyInt_Check(elt0))
2664 int nbOfTuples1=PyInt_AS_LONG(elt0);
2666 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2671 if(PyInt_Check(nbOfTuples))
2672 {//DataArrayInt.New(5,2)
2673 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2675 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2676 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2677 ret->alloc(nbOfTuples1,nbOfCompo);
2681 throw INTERP_KERNEL::Exception(msg.c_str());
2684 throw INTERP_KERNEL::Exception(msg.c_str());
2687 {//DataArrayInt.New(5)
2688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2689 ret->alloc(nbOfTuples1,1);
2694 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2695 {//DataArrayInt.New(numpyArray)
2696 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2700 throw INTERP_KERNEL::Exception(msg.c_str());
2703 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2705 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2708 std::string __str__() const throw(INTERP_KERNEL::Exception)
2710 return self->repr();
2713 int __len__() const throw(INTERP_KERNEL::Exception)
2715 if(self->isAllocated())
2717 return self->getNumberOfTuples();
2721 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2725 int __int__() const throw(INTERP_KERNEL::Exception)
2727 return self->intValue();
2730 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2732 return self->iterator();
2735 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2737 int sz=self->getNumberOfComponents();
2738 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2739 self->accumulate(tmp);
2740 return convertIntArrToPyList(tmp,sz);
2743 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2746 std::vector<int> val2;
2747 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2748 return self->accumulatePerChunck(bg,bg+sz);
2751 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2753 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2754 PyObject *ret=PyList_New(slcs.size());
2755 for(std::size_t i=0;i<slcs.size();i++)
2756 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2760 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2762 if(!PySlice_Check(slic))
2763 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2764 Py_ssize_t strt=2,stp=2,step=2;
2765 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2766 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2767 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2768 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2769 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
2770 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2773 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2775 int newNbOfTuples=-1;
2776 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2777 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2778 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2779 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2780 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2781 PyObject *ret=PyTuple_New(2);
2782 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2783 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2787 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2789 const char *msg="ParaMEDMEM::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !";
2790 if(PyList_Check(li) || PyTuple_Check(li))
2794 if(PyInt_Check(nbOfTuples))
2796 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2798 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2801 if(PyInt_Check(nbOfComp))
2802 {//DataArrayInt.setValues([1,3,4,5],2,2)
2803 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2805 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2806 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2807 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2810 throw INTERP_KERNEL::Exception(msg);
2813 {//DataArrayInt.setValues([1,3,4],3)
2815 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2816 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2820 throw INTERP_KERNEL::Exception(msg);
2823 {// DataArrayInt.setValues([1,3,4])
2824 int tmpp1=-1,tmpp2=-1;
2825 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2826 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2830 throw INTERP_KERNEL::Exception(msg);
2833 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2835 const int *vals=self->getConstPointer();
2836 return convertIntArrToPyList(vals,self->getNbOfElems());
2840 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2842 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2846 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2849 bool ret0=self->isEqualIfNotWhy(other,ret1);
2850 PyObject *ret=PyTuple_New(2);
2851 PyObject *ret0Py=ret0?Py_True:Py_False;
2853 PyTuple_SetItem(ret,0,ret0Py);
2854 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2858 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2860 const int *vals=self->getConstPointer();
2861 int nbOfComp=self->getNumberOfComponents();
2862 int nbOfTuples=self->getNumberOfTuples();
2863 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2866 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2868 std::vector<const DataArrayInt *> groups;
2869 std::vector< std::vector<int> > fidsOfGroups;
2870 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2871 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2872 PyObject *ret = PyList_New(2);
2873 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2874 int sz=fidsOfGroups.size();
2875 PyObject *ret1 = PyList_New(sz);
2876 for(int i=0;i<sz;i++)
2877 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2878 PyList_SetItem(ret,1,ret1);
2882 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2885 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2886 if (!SWIG_IsOK(res1))
2889 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2890 self->transformWithIndArr(tmp,tmp+size);
2894 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2895 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2899 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2903 std::vector<int> multiVal;
2904 std::pair<int, std::pair<int,int> > slic;
2905 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2906 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2910 return self->getIdsEqualList(&singleVal,&singleVal+1);
2912 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2914 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2916 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2920 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2924 std::vector<int> multiVal;
2925 std::pair<int, std::pair<int,int> > slic;
2926 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2927 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2931 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2933 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2935 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2937 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2941 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2943 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2945 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2946 if (!SWIG_IsOK(res1))
2949 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2950 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2954 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2956 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2957 da2->checkAllocated();
2958 int size=self->getNumberOfTuples();
2959 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2961 PyObject *ret = PyList_New(3);
2962 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2963 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2964 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2968 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2971 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2972 if (!SWIG_IsOK(res1))
2975 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2976 return self->transformWithIndArrR(tmp,tmp+size);
2980 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2981 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2985 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2988 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2989 if (!SWIG_IsOK(res1))
2992 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2993 if(size!=self->getNumberOfTuples())
2995 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2997 return self->renumberAndReduce(tmp,newNbOfTuple);
3001 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3003 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3004 da2->checkAllocated();
3005 int size=self->getNumberOfTuples();
3006 if(size!=self->getNumberOfTuples())
3008 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3010 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3014 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3017 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3018 if (!SWIG_IsOK(res1))
3021 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3022 if(size!=self->getNumberOfTuples())
3024 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3026 return self->renumber(tmp);
3030 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3032 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3033 da2->checkAllocated();
3034 int size=self->getNumberOfTuples();
3035 if(size!=self->getNumberOfTuples())
3037 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3039 return self->renumber(da2->getConstPointer());
3043 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3046 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3047 if (!SWIG_IsOK(res1))
3050 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3051 if(size!=self->getNumberOfTuples())
3053 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3055 return self->renumberR(tmp);
3059 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3061 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3062 da2->checkAllocated();
3063 int size=self->getNumberOfTuples();
3064 if(size!=self->getNumberOfTuples())
3066 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3068 return self->renumberR(da2->getConstPointer());
3072 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3074 std::vector<int> tmp;
3075 convertPyToNewIntArr3(li,tmp);
3076 self->setSelectedComponents(a,tmp);
3079 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3081 int sz=self->getNumberOfComponents();
3082 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3083 self->getTuple(tupleId,tmp);
3084 return convertIntArrToPyList(tmp,sz);
3087 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3089 DataArrayInt *arr=0;
3090 DataArrayInt *arrI=0;
3091 self->changeSurjectiveFormat(targetNb,arr,arrI);
3092 PyObject *res = PyList_New(2);
3093 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3094 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3098 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3100 std::vector<const DataArrayInt *> tmp;
3101 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3102 return DataArrayInt::Meld(tmp);
3105 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3107 std::vector<const DataArrayInt *> tmp;
3108 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3109 return DataArrayInt::Aggregate(tmp);
3112 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3114 std::vector<const DataArrayInt *> tmp;
3115 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3116 return DataArrayInt::AggregateIndexes(tmp);
3119 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3121 std::vector<const DataArrayInt *> tmp;
3122 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3123 return DataArrayInt::BuildUnion(tmp);
3126 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3128 std::vector<const DataArrayInt *> tmp;
3129 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3130 return DataArrayInt::BuildIntersection(tmp);
3133 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3136 int r1=self->getMaxValue(tmp);
3137 PyObject *ret=PyTuple_New(2);
3138 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3139 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3143 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3146 int r1=self->getMinValue(tmp);
3147 PyObject *ret=PyTuple_New(2);
3148 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3149 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3153 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3155 int nbOfCompo=self->getNumberOfComponents();
3160 if(PyInt_Check(obj))
3162 int val=(int)PyInt_AS_LONG(obj);
3163 return self->locateValue(val);
3166 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3170 std::vector<int> arr;
3171 convertPyToNewIntArr3(obj,arr);
3172 return self->locateTuple(arr);
3177 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3179 int nbOfCompo=self->getNumberOfComponents();
3186 if(PyInt_Check(obj))
3188 int val=(int)PyInt_AS_LONG(obj);
3189 return self->presenceOfValue(val);
3192 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3196 std::vector<int> arr;
3197 convertPyToNewIntArr3(obj,arr);
3198 return self->presenceOfTuple(arr);
3203 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3205 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3206 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3207 self->checkAllocated();
3208 int nbOfTuples=self->getNumberOfTuples();
3209 int nbOfComponents=self->getNumberOfComponents();
3211 std::vector<int> vt1,vc1;
3212 std::pair<int, std::pair<int,int> > pt1,pc1;
3213 DataArrayInt *dt1=0,*dc1=0;
3215 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3216 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3221 if(nbOfComponents==1)
3222 return PyInt_FromLong(self->getIJSafe(it1,0));
3223 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3226 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3228 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3230 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3232 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3235 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3236 std::vector<int> v2(1,ic1);
3237 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3241 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3242 std::vector<int> v2(1,ic1);
3243 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3247 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3248 std::vector<int> v2(1,ic1);
3249 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3253 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3254 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3258 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3263 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3264 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3268 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3269 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3273 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3274 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3275 std::vector<int> v2(nbOfComp);
3276 for(int i=0;i<nbOfComp;i++)
3277 v2[i]=pc1.first+i*pc1.second.second;
3278 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3282 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3283 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3284 std::vector<int> v2(nbOfComp);
3285 for(int i=0;i<nbOfComp;i++)
3286 v2[i]=pc1.first+i*pc1.second.second;
3287 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3291 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3292 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3293 std::vector<int> v2(nbOfComp);
3294 for(int i=0;i<nbOfComp;i++)
3295 v2[i]=pc1.first+i*pc1.second.second;
3296 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3300 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3301 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3302 std::vector<int> v2(nbOfComp);
3303 for(int i=0;i<nbOfComp;i++)
3304 v2[i]=pc1.first+i*pc1.second.second;
3305 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3308 throw INTERP_KERNEL::Exception(msg);
3312 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3314 self->checkAllocated();
3315 const char msg[]="Unexpected situation in __setitem__ !";
3316 int nbOfTuples=self->getNumberOfTuples();
3317 int nbOfComponents=self->getNumberOfComponents();
3320 std::vector<int> v1;
3322 DataArrayIntTuple *dd1=0;
3323 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3325 std::vector<int> vt1,vc1;
3326 std::pair<int, std::pair<int,int> > pt1,pc1;
3327 DataArrayInt *dt1=0,*dc1=0;
3328 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3329 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3337 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3340 tmp=DataArrayInt::New();
3341 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3342 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3345 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3348 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3349 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3352 throw INTERP_KERNEL::Exception(msg);
3361 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3364 tmp=DataArrayInt::New();
3365 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3366 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3369 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3372 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3373 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3376 throw INTERP_KERNEL::Exception(msg);
3385 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3388 tmp=DataArrayInt::New();
3389 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3390 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3393 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3396 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3397 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3400 throw INTERP_KERNEL::Exception(msg);
3409 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3412 tmp=DataArrayInt::New();
3413 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3414 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3417 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3420 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3421 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3424 throw INTERP_KERNEL::Exception(msg);
3433 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3436 tmp=DataArrayInt::New();
3437 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3438 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3441 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3444 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3445 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3448 throw INTERP_KERNEL::Exception(msg);
3457 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3460 tmp=DataArrayInt::New();
3461 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3462 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3465 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3468 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3469 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3472 throw INTERP_KERNEL::Exception(msg);
3481 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3484 tmp=DataArrayInt::New();
3485 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3486 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3489 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3492 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3493 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3496 throw INTERP_KERNEL::Exception(msg);
3505 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3508 tmp=DataArrayInt::New();
3509 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3510 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3513 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3516 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3517 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3520 throw INTERP_KERNEL::Exception(msg);
3529 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3532 tmp=DataArrayInt::New();
3533 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3534 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3537 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3540 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3541 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3544 throw INTERP_KERNEL::Exception(msg);
3553 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3556 tmp=DataArrayInt::New();
3557 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3558 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3561 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3564 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3565 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3568 throw INTERP_KERNEL::Exception(msg);
3577 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3580 tmp=DataArrayInt::New();
3581 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3582 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3585 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3588 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3589 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3592 throw INTERP_KERNEL::Exception(msg);
3601 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3604 tmp=DataArrayInt::New();
3605 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3606 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3609 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3612 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3613 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3616 throw INTERP_KERNEL::Exception(msg);
3625 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3628 tmp=DataArrayInt::New();
3629 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3630 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3633 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3636 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3637 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3640 throw INTERP_KERNEL::Exception(msg);
3649 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3652 tmp=DataArrayInt::New();
3653 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3654 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3657 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3660 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3661 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3664 throw INTERP_KERNEL::Exception(msg);
3673 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3676 tmp=DataArrayInt::New();
3677 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3678 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3681 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3684 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3685 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3688 throw INTERP_KERNEL::Exception(msg);
3697 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3700 tmp=DataArrayInt::New();
3701 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3702 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3705 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3708 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3709 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3712 throw INTERP_KERNEL::Exception(msg);
3717 throw INTERP_KERNEL::Exception(msg);
3722 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3724 return self->negate();
3727 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3729 const char msg[]="Unexpected situation in __add__ !";
3732 std::vector<int> aa;
3733 DataArrayIntTuple *aaa;
3735 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3740 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3741 ret->applyLin(1,val);
3746 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3747 return DataArrayInt::Add(self,aaaa);
3751 return DataArrayInt::Add(self,a);
3755 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3756 return DataArrayInt::Add(self,aaaa);
3759 throw INTERP_KERNEL::Exception(msg);
3763 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3765 const char msg[]="Unexpected situation in __radd__ !";
3768 std::vector<int> aa;
3769 DataArrayIntTuple *aaa;
3771 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3776 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3777 ret->applyLin(1,val);
3782 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3783 return DataArrayInt::Add(self,aaaa);
3787 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3788 return DataArrayInt::Add(self,aaaa);
3791 throw INTERP_KERNEL::Exception(msg);
3795 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3797 const char msg[]="Unexpected situation in __iadd__ !";
3800 std::vector<int> aa;
3801 DataArrayIntTuple *aaa;
3803 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3808 self->applyLin(1,val);
3809 Py_XINCREF(trueSelf);
3814 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3816 Py_XINCREF(trueSelf);
3822 Py_XINCREF(trueSelf);
3827 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3828 self->addEqual(aaaa);
3829 Py_XINCREF(trueSelf);
3833 throw INTERP_KERNEL::Exception(msg);
3837 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3839 const char msg[]="Unexpected situation in __sub__ !";
3842 std::vector<int> aa;
3843 DataArrayIntTuple *aaa;
3845 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3850 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3851 ret->applyLin(1,-val);
3856 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3857 return DataArrayInt::Substract(self,aaaa);
3861 return DataArrayInt::Substract(self,a);
3865 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3866 return DataArrayInt::Substract(self,aaaa);
3869 throw INTERP_KERNEL::Exception(msg);
3873 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3875 const char msg[]="Unexpected situation in __rsub__ !";
3878 std::vector<int> aa;
3879 DataArrayIntTuple *aaa;
3881 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3886 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3887 ret->applyLin(-1,val);
3892 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3893 return DataArrayInt::Substract(aaaa,self);
3897 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3898 return DataArrayInt::Substract(aaaa,self);
3901 throw INTERP_KERNEL::Exception(msg);
3905 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3907 const char msg[]="Unexpected situation in __isub__ !";
3910 std::vector<int> aa;
3911 DataArrayIntTuple *aaa;
3913 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3918 self->applyLin(1,-val);
3919 Py_XINCREF(trueSelf);
3924 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3925 self->substractEqual(bb);
3926 Py_XINCREF(trueSelf);
3931 self->substractEqual(a);
3932 Py_XINCREF(trueSelf);
3937 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3938 self->substractEqual(aaaa);
3939 Py_XINCREF(trueSelf);
3943 throw INTERP_KERNEL::Exception(msg);
3947 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3949 const char msg[]="Unexpected situation in __mul__ !";
3952 std::vector<int> aa;
3953 DataArrayIntTuple *aaa;
3955 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3960 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3961 ret->applyLin(val,0);
3966 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3967 return DataArrayInt::Multiply(self,aaaa);
3971 return DataArrayInt::Multiply(self,a);
3975 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3976 return DataArrayInt::Multiply(self,aaaa);
3979 throw INTERP_KERNEL::Exception(msg);
3983 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3985 const char msg[]="Unexpected situation in __rmul__ !";
3988 std::vector<int> aa;
3989 DataArrayIntTuple *aaa;
3991 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3996 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3997 ret->applyLin(val,0);
4002 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4003 return DataArrayInt::Multiply(self,aaaa);
4007 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4008 return DataArrayInt::Multiply(self,aaaa);
4011 throw INTERP_KERNEL::Exception(msg);
4015 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4017 const char msg[]="Unexpected situation in __imul__ !";
4020 std::vector<int> aa;
4021 DataArrayIntTuple *aaa;
4023 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4028 self->applyLin(val,0);
4029 Py_XINCREF(trueSelf);
4034 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4035 self->multiplyEqual(bb);
4036 Py_XINCREF(trueSelf);
4041 self->multiplyEqual(a);
4042 Py_XINCREF(trueSelf);
4047 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4048 self->multiplyEqual(aaaa);
4049 Py_XINCREF(trueSelf);
4053 throw INTERP_KERNEL::Exception(msg);
4057 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4059 const char msg[]="Unexpected situation in __div__ !";
4062 std::vector<int> aa;
4063 DataArrayIntTuple *aaa;
4065 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4070 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4071 ret->applyDivideBy(val);
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4077 return DataArrayInt::Divide(self,aaaa);
4081 return DataArrayInt::Divide(self,a);
4085 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4086 return DataArrayInt::Divide(self,aaaa);
4089 throw INTERP_KERNEL::Exception(msg);
4093 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4095 const char msg[]="Unexpected situation in __rdiv__ !";
4098 std::vector<int> aa;
4099 DataArrayIntTuple *aaa;
4101 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4106 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4112 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4113 return DataArrayInt::Divide(aaaa,self);
4117 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4118 return DataArrayInt::Divide(aaaa,self);
4121 throw INTERP_KERNEL::Exception(msg);
4125 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4127 const char msg[]="Unexpected situation in __idiv__ !";
4130 std::vector<int> aa;
4131 DataArrayIntTuple *aaa;
4133 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4138 self->applyDivideBy(val);
4139 Py_XINCREF(trueSelf);
4144 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4145 self->divideEqual(bb);
4146 Py_XINCREF(trueSelf);
4151 self->divideEqual(a);
4152 Py_XINCREF(trueSelf);
4157 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4158 self->divideEqual(aaaa);
4159 Py_XINCREF(trueSelf);
4163 throw INTERP_KERNEL::Exception(msg);
4167 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4169 const char msg[]="Unexpected situation in __mod__ !";
4172 std::vector<int> aa;
4173 DataArrayIntTuple *aaa;
4175 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4180 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4181 ret->applyModulus(val);
4186 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4187 return DataArrayInt::Modulus(self,aaaa);
4191 return DataArrayInt::Modulus(self,a);
4195 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4196 return DataArrayInt::Modulus(self,aaaa);
4199 throw INTERP_KERNEL::Exception(msg);
4203 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4205 const char msg[]="Unexpected situation in __rmod__ !";
4208 std::vector<int> aa;
4209 DataArrayIntTuple *aaa;
4211 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4216 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4217 ret->applyRModulus(val);
4222 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4223 return DataArrayInt::Modulus(aaaa,self);
4227 return DataArrayInt::Modulus(a,self);
4231 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4232 return DataArrayInt::Modulus(aaaa,self);
4235 throw INTERP_KERNEL::Exception(msg);
4239 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4241 const char msg[]="Unexpected situation in __imod__ !";
4244 std::vector<int> aa;
4245 DataArrayIntTuple *aaa;
4247 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4252 self->applyModulus(val);
4253 Py_XINCREF(trueSelf);
4258 self->modulusEqual(a);
4259 Py_XINCREF(trueSelf);
4264 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4265 self->modulusEqual(aaaa);
4266 Py_XINCREF(trueSelf);
4270 throw INTERP_KERNEL::Exception(msg);
4274 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4276 const char msg[]="Unexpected situation in __pow__ !";
4279 std::vector<int> aa;
4280 DataArrayIntTuple *aaa;
4282 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4287 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4293 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4294 return DataArrayInt::Pow(self,aaaa);
4298 return DataArrayInt::Pow(self,a);
4302 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4303 return DataArrayInt::Pow(self,aaaa);
4306 throw INTERP_KERNEL::Exception(msg);
4310 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4312 const char msg[]="Unexpected situation in __rpow__ !";
4315 std::vector<int> aa;
4316 DataArrayIntTuple *aaa;
4318 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4323 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4324 ret->applyRPow(val);
4329 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4330 return DataArrayInt::Pow(aaaa,self);
4334 return DataArrayInt::Pow(a,self);
4338 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4339 return DataArrayInt::Pow(aaaa,self);
4342 throw INTERP_KERNEL::Exception(msg);
4346 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4348 const char msg[]="Unexpected situation in __ipow__ !";
4351 std::vector<int> aa;
4352 DataArrayIntTuple *aaa;
4354 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4359 self->applyPow(val);
4360 Py_XINCREF(trueSelf);
4366 Py_XINCREF(trueSelf);
4371 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4372 self->powEqual(aaaa);
4373 Py_XINCREF(trueSelf);
4377 throw INTERP_KERNEL::Exception(msg);
4381 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4383 std::ostringstream oss;
4384 self->reprQuickOverview(oss);
4388 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4390 int szArr,sw,iTypppArr;
4391 std::vector<int> stdvecTyyppArr;
4392 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4393 self->pushBackValsSilent(tmp,tmp+szArr);
4396 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4398 std::vector<int> ret1;
4399 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4400 std::size_t sz=ret0.size();
4401 PyObject *pyRet=PyTuple_New(2);
4402 PyObject *pyRet0=PyList_New((int)sz);
4403 PyObject *pyRet1=PyList_New((int)sz);
4404 for(std::size_t i=0;i<sz;i++)
4406 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4407 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4409 PyTuple_SetItem(pyRet,0,pyRet0);
4410 PyTuple_SetItem(pyRet,1,pyRet1);
4414 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4416 DataArrayInt *ret0=0,*ret1=0;
4417 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4418 PyObject *pyRet=PyTuple_New(2);
4419 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4420 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4426 class DataArrayIntTuple;
4428 class DataArrayIntIterator
4431 DataArrayIntIterator(DataArrayInt *da);
4432 ~DataArrayIntIterator();
4437 DataArrayIntTuple *ret=self->nextt();
4439 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4442 PyErr_SetString(PyExc_StopIteration,"No more data.");
4449 class DataArrayIntTuple
4452 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4453 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4456 std::string __str__() const throw(INTERP_KERNEL::Exception)
4458 return self->repr();
4461 int __int__() const throw(INTERP_KERNEL::Exception)
4463 return self->intValue();
4466 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4468 return self->buildDAInt(1,self->getNumberOfCompo());
4471 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4473 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4474 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4475 Py_XINCREF(trueSelf);
4479 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4481 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4482 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4483 Py_XINCREF(trueSelf);
4487 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4489 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4490 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4491 Py_XINCREF(trueSelf);
4495 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4497 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4498 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4499 Py_XINCREF(trueSelf);
4503 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4505 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4506 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4507 Py_XINCREF(trueSelf);
4511 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4513 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4516 std::vector<int> multiVal;
4517 std::pair<int, std::pair<int,int> > slic;
4518 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4519 const int *pt=self->getConstPointer();
4520 int nbc=self->getNumberOfCompo();
4521 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4528 std::ostringstream oss;
4529 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4530 throw INTERP_KERNEL::Exception(oss.str().c_str());
4533 return PyInt_FromLong(pt[singleVal]);
4537 return PyInt_FromLong(pt[nbc+singleVal]);
4540 std::ostringstream oss;
4541 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4542 throw INTERP_KERNEL::Exception(oss.str().c_str());
4548 PyObject *t=PyTuple_New(multiVal.size());
4549 for(int j=0;j<(int)multiVal.size();j++)
4551 int cid=multiVal[j];
4554 std::ostringstream oss;
4555 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4556 throw INTERP_KERNEL::Exception(oss.str().c_str());
4558 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4564 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4565 PyObject *t=PyTuple_New(sz);
4566 for(int j=0;j<sz;j++)
4567 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4571 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4575 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4577 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4578 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4581 std::vector<int> multiValV;
4582 std::pair<int, std::pair<int,int> > slicV;
4583 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4584 int nbc=self->getNumberOfCompo();
4585 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4587 std::vector<int> multiVal;
4588 std::pair<int, std::pair<int,int> > slic;
4589 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4590 int *pt=self->getPointer();
4591 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4598 std::ostringstream oss;
4599 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4600 throw INTERP_KERNEL::Exception(oss.str().c_str());
4606 pt[singleVal]=singleValV;
4611 if(multiValV.size()!=1)
4613 std::ostringstream oss;
4614 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4615 throw INTERP_KERNEL::Exception(oss.str().c_str());
4617 pt[singleVal]=multiValV[0];
4622 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4626 throw INTERP_KERNEL::Exception(msg);
4635 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4639 std::ostringstream oss;
4640 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4641 throw INTERP_KERNEL::Exception(oss.str().c_str());
4649 if(multiVal.size()!=multiValV.size())
4651 std::ostringstream oss;
4652 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4653 throw INTERP_KERNEL::Exception(oss.str().c_str());
4655 for(int i=0;i<(int)multiVal.size();i++)
4657 int pos=multiVal[i];
4660 std::ostringstream oss;
4661 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4662 throw INTERP_KERNEL::Exception(oss.str().c_str());
4664 pt[multiVal[i]]=multiValV[i];
4670 const int *ptV=daIntTyyppV->getConstPointer();
4671 if(nbc>daIntTyyppV->getNumberOfCompo())
4673 std::ostringstream oss;
4674 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4675 throw INTERP_KERNEL::Exception(oss.str().c_str());
4677 std::copy(ptV,ptV+nbc,pt);
4681 throw INTERP_KERNEL::Exception(msg);
4686 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4691 for(int j=0;j<sz;j++)
4692 pt[slic.first+j*slic.second.second]=singleValV;
4697 if(sz!=(int)multiValV.size())
4699 std::ostringstream oss;
4700 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4701 throw INTERP_KERNEL::Exception(oss.str().c_str());
4703 for(int j=0;j<sz;j++)
4704 pt[slic.first+j*slic.second.second]=multiValV[j];
4709 const int *ptV=daIntTyyppV->getConstPointer();
4710 if(sz>daIntTyyppV->getNumberOfCompo())
4712 std::ostringstream oss;
4713 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4714 throw INTERP_KERNEL::Exception(oss.str().c_str());
4716 for(int j=0;j<sz;j++)
4717 pt[slic.first+j*slic.second.second]=ptV[j];
4721 throw INTERP_KERNEL::Exception(msg);
4725 throw INTERP_KERNEL::Exception(msg);
4731 class DataArrayChar : public DataArray
4734 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4735 int getHashCode() const throw(INTERP_KERNEL::Exception);
4736 bool empty() const throw(INTERP_KERNEL::Exception);
4737 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4738 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4739 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4740 char popBackSilent() throw(INTERP_KERNEL::Exception);
4741 void pack() const throw(INTERP_KERNEL::Exception);
4742 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4743 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4744 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4745 void reverse() throw(INTERP_KERNEL::Exception);
4746 void fillWithZero() throw(INTERP_KERNEL::Exception);
4747 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4748 std::string repr() const throw(INTERP_KERNEL::Exception);
4749 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4750 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4751 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4752 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4753 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4754 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4755 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4756 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4757 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4758 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4759 char front() const throw(INTERP_KERNEL::Exception);
4760 char back() const throw(INTERP_KERNEL::Exception);
4761 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4762 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4763 char *getPointer() throw(INTERP_KERNEL::Exception);
4764 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4765 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4766 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4767 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4768 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4769 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4770 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4771 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4772 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4773 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4774 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4777 int __len__() const throw(INTERP_KERNEL::Exception)
4779 if(self->isAllocated())
4781 return self->getNumberOfTuples();
4785 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4789 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4792 bool ret0=self->isEqualIfNotWhy(other,ret1);
4793 PyObject *ret=PyTuple_New(2);
4794 PyObject *ret0Py=ret0?Py_True:Py_False;
4796 PyTuple_SetItem(ret,0,ret0Py);
4797 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4801 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4804 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4805 if (!SWIG_IsOK(res1))
4808 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4809 if(size!=self->getNumberOfTuples())
4811 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4813 return self->renumber(tmp);
4817 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4819 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4820 da2->checkAllocated();
4821 int size=self->getNumberOfTuples();
4822 if(size!=self->getNumberOfTuples())
4824 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4826 return self->renumber(da2->getConstPointer());
4830 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4833 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4834 if (!SWIG_IsOK(res1))
4837 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4838 if(size!=self->getNumberOfTuples())
4840 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4842 return self->renumberR(tmp);
4846 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4848 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4849 da2->checkAllocated();
4850 int size=self->getNumberOfTuples();
4851 if(size!=self->getNumberOfTuples())
4853 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4855 return self->renumberR(da2->getConstPointer());
4859 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4862 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4863 if (!SWIG_IsOK(res1))
4866 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4867 if(size!=self->getNumberOfTuples())
4869 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4871 return self->renumberAndReduce(tmp,newNbOfTuple);
4875 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4877 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4878 da2->checkAllocated();
4879 int size=self->getNumberOfTuples();
4880 if(size!=self->getNumberOfTuples())
4882 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4884 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4888 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4890 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4891 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4892 return DataArrayChar::Aggregate(tmp);
4895 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4897 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4898 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4899 return DataArrayChar::Meld(tmp);
4904 class DataArrayByteIterator;
4906 class DataArrayByte : public DataArrayChar
4909 static DataArrayByte *New();
4910 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4911 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4912 char byteValue() const throw(INTERP_KERNEL::Exception);
4915 DataArrayByte() throw(INTERP_KERNEL::Exception)
4917 return DataArrayByte::New();
4920 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4922 const char *msg="ParaMEDMEM::DataArrayByte::New : Available API are : \n-DataArrayByte.New()\n--DataArrayByte.New([1,3,4])\n-DataArrayByte.New([1,3,4],3)\n-DataArrayByte.New([1,3,4,5],2,2)\n-DataArrayByte.New(5)\n-DataArrayByte.New(5,2) !";
4923 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4927 if(PyInt_Check(nbOfTuples))
4929 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4931 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4934 if(PyInt_Check(nbOfComp))
4935 {//DataArrayByte.New([1,3,4,5],2,2)
4936 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4938 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4939 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4940 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4941 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4945 throw INTERP_KERNEL::Exception(msg);
4948 {//DataArrayByte.New([1,3,4],3)
4949 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4951 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4952 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4957 throw INTERP_KERNEL::Exception(msg);
4960 {// DataArrayByte.New([1,3,4])
4961 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4962 int tmpp1=-1,tmpp2=-1;
4963 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4964 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4968 else if(PyInt_Check(elt0))
4970 int nbOfTuples1=PyInt_AS_LONG(elt0);
4972 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4977 if(PyInt_Check(nbOfTuples))
4978 {//DataArrayByte.New(5,2)
4979 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4981 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4982 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4983 ret->alloc(nbOfTuples1,nbOfCompo);
4987 throw INTERP_KERNEL::Exception(msg);
4990 throw INTERP_KERNEL::Exception(msg);
4993 {//DataArrayByte.New(5)
4994 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4995 ret->alloc(nbOfTuples1,1);
5000 throw INTERP_KERNEL::Exception(msg);
5003 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5005 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5008 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5010 std::ostringstream oss;
5011 self->reprQuickOverview(oss);
5015 int __int__() const throw(INTERP_KERNEL::Exception)
5017 return (int) self->byteValue();
5020 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5022 return self->iterator();
5025 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5027 return (int)self->getIJ(tupleId,compoId);
5030 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5032 return (int)self->getIJSafe(tupleId,compoId);
5035 std::string __str__() const throw(INTERP_KERNEL::Exception)
5037 return self->repr();
5040 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5042 const char *vals=self->getConstPointer();
5043 int nbOfComp=self->getNumberOfComponents();
5044 int nbOfTuples=self->getNumberOfTuples();
5045 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5048 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5051 int ival=-1; std::vector<int> ivval;
5052 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5053 std::vector<char> vals(sz);
5054 std::copy(pt,pt+sz,vals.begin());
5055 return self->presenceOfTuple(vals);
5058 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5061 int ival=-1; std::vector<int> ivval;
5062 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5063 std::vector<char> vals2(sz);
5064 std::copy(pt,pt+sz,vals2.begin());
5065 return self->presenceOfValue(vals2);
5068 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5071 int ival=-1; std::vector<int> ivval;
5072 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5073 std::vector<char> vals2(sz);
5074 std::copy(pt,pt+sz,vals2.begin());
5075 return self->locateValue(vals2);
5078 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5081 int ival=-1; std::vector<int> ivval;
5082 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5083 std::vector<char> vals(sz);
5084 std::copy(pt,pt+sz,vals.begin());
5085 return self->locateTuple(vals);
5088 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5091 int ival=-1; std::vector<int> ivval;
5092 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5093 std::vector<char> vals(sz);
5094 std::copy(pt,pt+sz,vals.begin());
5095 return self->search(vals);
5098 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5100 int sz=self->getNumberOfComponents();
5101 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5102 self->getTuple(tupleId,tmp);
5103 PyObject *ret=PyTuple_New(sz);
5104 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5108 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5111 int r1=(int)self->getMaxValue(tmp);
5112 PyObject *ret=PyTuple_New(2);
5113 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5114 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5118 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5121 int r1=(int)self->getMinValue(tmp);
5122 PyObject *ret=PyTuple_New(2);
5123 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5124 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5128 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5130 int nbOfCompo=self->getNumberOfComponents();
5135 if(PyInt_Check(obj))
5137 int val=(int)PyInt_AS_LONG(obj);
5138 return self->locateValue(val);
5141 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5144 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5148 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5150 int nbOfCompo=self->getNumberOfComponents();
5157 if(PyInt_Check(obj))
5159 int val=(int)PyInt_AS_LONG(obj);
5160 return self->presenceOfValue(val);
5163 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5166 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5172 class DataArrayByteTuple;
5174 class DataArrayByteIterator
5177 DataArrayByteIterator(DataArrayByte *da);
5178 ~DataArrayByteIterator();
5181 class DataArrayByteTuple
5184 std::string repr() const throw(INTERP_KERNEL::Exception);
5185 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5188 std::string __str__() const throw(INTERP_KERNEL::Exception)
5190 return self->repr();
5193 char __int__() const throw(INTERP_KERNEL::Exception)
5195 return self->byteValue();
5198 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5200 return self->buildDAByte(1,self->getNumberOfCompo());
5205 class DataArrayAsciiCharIterator;
5207 class DataArrayAsciiChar : public DataArrayChar
5210 static DataArrayAsciiChar *New();
5211 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5212 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5213 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5216 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5218 return DataArrayAsciiChar::New();
5221 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5223 const char *msg="ParaMEDMEM::DataArrayAsciiChar::New : Available API are : \n-DataArrayAsciiChar.New()\n-DataArrayAsciiChar.New([1,3,4])\n-DataArrayAsciiChar.New([\"abc\",\"de\",\"fghi\"])\n-DataArrayAsciiChar.New([\"abc\",\"de\",\"fghi\"],\"t\")\n-DataArrayAsciiChar.New([1,3,4],3)\n-DataArrayAsciiChar.New([1,3,4,5],2,2)\n-DataArrayAsciiChar.New(5)\n-DataArrayAsciiChar.New(5,2) !";
5224 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5228 if(PyInt_Check(nbOfTuples))
5230 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5232 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5235 if(PyInt_Check(nbOfComp))
5236 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5237 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5239 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5240 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5241 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5242 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5246 throw INTERP_KERNEL::Exception(msg);
5249 {//DataArrayAsciiChar.New([1,3,4],3)
5250 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5252 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5253 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5257 else if(PyString_Check(nbOfTuples))
5259 if(PyString_Size(nbOfTuples)!=1)
5260 throw INTERP_KERNEL::Exception(msg);
5261 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5262 std::vector<std::string> tmp;
5263 if(fillStringVector(elt0,tmp))
5264 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5266 throw INTERP_KERNEL::Exception(msg);
5269 throw INTERP_KERNEL::Exception(msg);
5273 std::vector<std::string> tmmp;
5274 if(fillStringVector(elt0,tmmp))
5275 //DataArrayAsciiChar.New(["abc","de","fghi"])
5276 return DataArrayAsciiChar::New(tmmp,' ');
5279 // DataArrayAsciiChar.New([1,3,4])
5280 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5281 int tmpp1=-1,tmpp2=-1;
5282 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5283 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5288 else if(PyInt_Check(elt0))
5290 int nbOfTuples1=PyInt_AS_LONG(elt0);
5292 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5297 if(PyInt_Check(nbOfTuples))
5298 {//DataArrayAsciiChar.New(5,2)
5299 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5301 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5302 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5303 ret->alloc(nbOfTuples1,nbOfCompo);
5307 throw INTERP_KERNEL::Exception(msg);
5310 throw INTERP_KERNEL::Exception(msg);
5313 {//DataArrayAsciiChar.New(5)
5314 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5315 ret->alloc(nbOfTuples1,1);
5320 throw INTERP_KERNEL::Exception(msg);
5323 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5325 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5328 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5330 std::ostringstream oss;
5331 self->reprQuickOverview(oss);
5335 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5337 return self->iterator();
5340 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5342 char tmp[2]; tmp[1]='\0';
5343 tmp[0]=self->getIJ(tupleId,compoId);
5344 return std::string(tmp);
5347 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5349 char tmp[2]; tmp[1]='\0';
5350 tmp[0]=self->getIJSafe(tupleId,compoId);
5351 return std::string(tmp);
5354 std::string __str__() const throw(INTERP_KERNEL::Exception)
5356 return self->repr();
5359 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5361 const char *vals=self->getConstPointer();
5362 int nbOfComp=self->getNumberOfComponents();
5363 int nbOfTuples=self->getNumberOfTuples();
5364 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5367 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5369 if(PyString_Check(tupl))
5371 Py_ssize_t sz=PyString_Size(tupl);
5372 std::vector<char> vals(sz);
5373 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5374 return self->presenceOfTuple(vals);
5377 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5380 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5382 if(PyString_Check(vals))
5384 Py_ssize_t sz=PyString_Size(vals);
5385 std::vector<char> vals2(sz);
5386 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5387 return self->presenceOfValue(vals2);
5390 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5393 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5395 if(PyString_Check(vals))
5397 Py_ssize_t sz=PyString_Size(vals);
5398 std::vector<char> vals2(sz);
5399 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5400 return self->locateValue(vals2);
5403 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5406 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5408 if(PyString_Check(tupl))
5410 Py_ssize_t sz=PyString_Size(tupl);
5411 std::vector<char> vals(sz);
5412 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5413 return self->locateTuple(vals);
5416 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5419 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5421 if(PyString_Check(strOrListOfInt))
5423 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5424 std::vector<char> vals(sz);
5425 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5426 return self->search(vals);
5429 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5432 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5434 int sz=self->getNumberOfComponents();
5435 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5436 self->getTuple(tupleId,tmp);
5437 return PyString_FromString(tmp);
5440 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5443 char tmp2[2]; tmp2[1]='\0';
5444 tmp2[0]=self->getMaxValue(tmp);
5445 PyObject *ret=PyTuple_New(2);
5446 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5447 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5451 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5454 char tmp2[2]; tmp2[1]='\0';
5455 tmp2[0]=self->getMinValue(tmp);
5456 PyObject *ret=PyTuple_New(2);
5457 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5458 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5462 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5464 int nbOfCompo=self->getNumberOfComponents();
5469 if(PyString_Check(obj))
5471 Py_ssize_t sz=PyString_Size(obj);
5472 char *pt=PyString_AsString(obj);
5474 return self->locateValue(pt[0]);
5476 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5479 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5482 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5486 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5488 int nbOfCompo=self->getNumberOfComponents();
5495 if(PyString_Check(obj))
5497 Py_ssize_t sz=PyString_Size(obj);
5498 char *pt=PyString_AsString(obj);
5500 return self->presenceOfValue(pt[0]);
5502 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5505 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5508 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5512 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5515 std::vector<int> stdvecTyyppArr;
5516 std::pair<int, std::pair<int,int> > sTyyppArr;
5517 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5518 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5522 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5524 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5526 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5528 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5530 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5534 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5536 static const char msg[]="DataArrayAsciiChar::__setitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input, and 4 types accepted in value : string, list or tuple of strings having same size, not null DataArrayChar instance.";
5538 std::vector<int> stdvecTyyppArr;
5539 std::pair<int, std::pair<int,int> > sTyyppArr;
5540 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5541 int nbOfCompo=self->getNumberOfComponents();
5542 int nbOfTuples=self->getNumberOfTuples();
5543 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5545 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5546 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5555 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5561 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5562 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5565 //value vector<string>
5568 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5569 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5572 //value DataArrayChar
5575 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5579 throw INTERP_KERNEL::Exception(msg);
5583 {//obj list-tuple[int]
5589 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5595 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5596 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5599 //value vector<string>
5602 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5603 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5606 //value DataArrayChar
5609 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5613 throw INTERP_KERNEL::Exception(msg);
5624 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5630 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5631 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5634 //value vector<string>
5637 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5638 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5641 //value DataArrayChar
5644 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5648 throw INTERP_KERNEL::Exception(msg);
5659 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5665 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5666 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5669 //value vector<string>
5672 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5673 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5676 //value DataArrayChar
5679 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5683 throw INTERP_KERNEL::Exception(msg);
5688 throw INTERP_KERNEL::Exception(msg);
5694 class DataArrayAsciiCharTuple;
5696 class DataArrayAsciiCharIterator
5699 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5700 ~DataArrayAsciiCharIterator();
5705 DataArrayAsciiCharTuple *ret=self->nextt();
5707 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5710 PyErr_SetString(PyExc_StopIteration,"No more data.");
5717 class DataArrayAsciiCharTuple
5720 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5721 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5724 std::string __str__() const throw(INTERP_KERNEL::Exception)
5726 return self->repr();
5729 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5731 return self->buildDAAsciiChar(1,self->getNumberOfCompo());