1 // Copyright (C) 2007-2014 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, or (at your option) any later version.
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::getIdsEqualTuple;
71 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
72 %newobject ParaMEDMEM::DataArrayInt::negate;
73 %newobject ParaMEDMEM::DataArrayInt::computeAbs;
74 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
75 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
76 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
77 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
78 %newobject ParaMEDMEM::DataArrayInt::Meld;
79 %newobject ParaMEDMEM::DataArrayInt::Add;
80 %newobject ParaMEDMEM::DataArrayInt::Substract;
81 %newobject ParaMEDMEM::DataArrayInt::Multiply;
82 %newobject ParaMEDMEM::DataArrayInt::Divide;
83 %newobject ParaMEDMEM::DataArrayInt::Pow;
84 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
85 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
86 %newobject ParaMEDMEM::DataArrayInt::Range;
87 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
88 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
89 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
90 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
91 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
92 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
93 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
94 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
95 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
96 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
97 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
98 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
99 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
100 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
101 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
102 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
103 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
104 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
105 %newobject ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation;
106 %newobject ParaMEDMEM::DataArrayInt::__neg__;
107 %newobject ParaMEDMEM::DataArrayInt::__add__;
108 %newobject ParaMEDMEM::DataArrayInt::__radd__;
109 %newobject ParaMEDMEM::DataArrayInt::__sub__;
110 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
111 %newobject ParaMEDMEM::DataArrayInt::__mul__;
112 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
113 %newobject ParaMEDMEM::DataArrayInt::__div__;
114 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
115 %newobject ParaMEDMEM::DataArrayInt::__mod__;
116 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
117 %newobject ParaMEDMEM::DataArrayInt::__pow__;
118 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
119 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
120 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
121 %newobject ParaMEDMEM::DataArrayChar::renumber;
122 %newobject ParaMEDMEM::DataArrayChar::renumberR;
123 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
124 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
125 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
126 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
127 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
128 %newobject ParaMEDMEM::DataArrayChar::Meld;
129 %newobject ParaMEDMEM::DataArrayByte::New;
130 %newobject ParaMEDMEM::DataArrayByte::__iter__;
131 %newobject ParaMEDMEM::DataArrayByte::performCpy;
132 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
133 %newobject ParaMEDMEM::DataArrayChar::substr;
134 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
135 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
136 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
137 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
138 %newobject ParaMEDMEM::DataArrayDouble::New;
139 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
140 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
141 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
142 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
143 %newobject ParaMEDMEM::DataArrayDouble::Meld;
144 %newobject ParaMEDMEM::DataArrayDouble::Dot;
145 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
146 %newobject ParaMEDMEM::DataArrayDouble::Add;
147 %newobject ParaMEDMEM::DataArrayDouble::Substract;
148 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
149 %newobject ParaMEDMEM::DataArrayDouble::Divide;
150 %newobject ParaMEDMEM::DataArrayDouble::Pow;
151 %newobject ParaMEDMEM::DataArrayDouble::substr;
152 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
153 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
154 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
155 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
156 %newobject ParaMEDMEM::DataArrayDouble::negate;
157 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
158 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
159 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
160 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
161 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
162 %newobject ParaMEDMEM::DataArrayDouble::determinant;
163 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
164 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
165 %newobject ParaMEDMEM::DataArrayDouble::inverse;
166 %newobject ParaMEDMEM::DataArrayDouble::trace;
167 %newobject ParaMEDMEM::DataArrayDouble::deviator;
168 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
169 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
170 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
171 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
172 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
173 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
174 %newobject ParaMEDMEM::DataArrayDouble::renumber;
175 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
176 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
177 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
178 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
179 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
180 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
181 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
182 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
183 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
184 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
185 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
186 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
187 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
188 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
189 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
190 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
191 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
192 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
193 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
195 %feature("unref") DataArray "$this->decrRef();"
196 %feature("unref") DataArrayDouble "$this->decrRef();"
197 %feature("unref") DataArrayInt "$this->decrRef();"
198 %feature("unref") DataArrayChar "$this->decrRef();"
199 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
200 %feature("unref") DataArrayByte "$this->decrRef();"
204 class DataArray : public RefCountObject, public TimeLabel
207 void setName(const std::string& name);
208 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
209 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
210 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
211 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
212 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
213 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
214 std::string getName() const;
215 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
216 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
217 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
218 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
219 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
220 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
221 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
222 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
223 int getNumberOfComponents() const;
224 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
225 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
226 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
227 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
228 virtual void desallocate() throw(INTERP_KERNEL::Exception);
229 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
230 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
231 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
232 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
233 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
234 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
235 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
236 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
237 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
238 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
239 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
240 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
241 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
242 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
243 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
244 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
245 void updateTime() const;
248 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
250 const std::vector<std::string>& comps=self->getInfoOnComponents();
251 PyObject *ret=PyList_New((int)comps.size());
252 for(int i=0;i<(int)comps.size();i++)
253 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
257 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
259 std::vector<int> tmp;
260 convertPyToNewIntArr3(li,tmp);
261 self->copyPartOfStringInfoFrom(other,tmp);
264 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
266 std::vector<int> tmp;
267 convertPyToNewIntArr3(li,tmp);
268 self->copyPartOfStringInfoFrom2(tmp,other);
271 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
274 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
275 if (!SWIG_IsOK(res1))
278 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
279 if(size!=self->getNumberOfTuples())
281 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
283 self->renumberInPlace(tmp);
287 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
289 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
290 da2->checkAllocated();
291 int size=self->getNumberOfTuples();
292 if(size!=self->getNumberOfTuples())
294 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
296 self->renumberInPlace(da2->getConstPointer());
300 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
303 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
304 if (!SWIG_IsOK(res1))
307 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
308 if(size!=self->getNumberOfTuples())
310 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
312 self->renumberInPlaceR(tmp);
316 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
318 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
319 da2->checkAllocated();
320 int size=self->getNumberOfTuples();
321 if(size!=self->getNumberOfTuples())
323 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
325 self->renumberInPlaceR(da2->getConstPointer());
329 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
330 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
332 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
333 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
334 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
335 DataArrayInt *tuplesSelecPtr2=0;
338 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
340 throw INTERP_KERNEL::Exception(msg);
342 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
345 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
347 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
348 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
351 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
353 std::vector<std::pair<int,int> > ranges;
354 convertPyToVectorPairInt(li,ranges);
355 return self->selectByTupleRanges(ranges);
358 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
361 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
362 if (!SWIG_IsOK(res1))
365 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
366 return self->selectByTupleId(tmp,tmp+size);
370 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
372 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
373 da2->checkAllocated();
374 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
378 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
381 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
382 if (!SWIG_IsOK(res1))
385 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
386 return self->selectByTupleIdSafe(tmp,tmp+size);
390 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
392 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
393 da2->checkAllocated();
394 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
398 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
400 std::vector<int> tmp;
401 convertPyToNewIntArr3(li,tmp);
402 DataArray *ret=self->keepSelectedComponents(tmp);
403 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
406 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
408 if(!PySlice_Check(slic))
409 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
410 Py_ssize_t strt=2,stp=2,step=2;
411 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
412 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
414 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
415 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
418 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
420 if(!PySlice_Check(slic))
421 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
422 Py_ssize_t strt=2,stp=2,step=2;
423 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
424 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"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 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
437 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
440 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
442 if(!PySlice_Check(slic))
443 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
444 Py_ssize_t strt=2,stp=2,step=2;
445 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
446 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
447 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
450 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
452 std::vector<const DataArray *> tmp;
453 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
454 return DataArray::Aggregate(tmp);
457 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
459 if(!PySlice_Check(slic))
460 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
461 Py_ssize_t strt=2,stp=2,step=2;
462 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
463 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
464 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
467 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
469 if(!PySlice_Check(slic))
470 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
471 Py_ssize_t strt=2,stp=2,step=2;
472 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
473 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
474 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
480 class DataArrayDoubleIterator;
482 class DataArrayDouble : public DataArray
485 static DataArrayDouble *New();
486 double doubleValue() const throw(INTERP_KERNEL::Exception);
487 bool empty() const throw(INTERP_KERNEL::Exception);
488 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
489 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
490 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
491 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
492 double popBackSilent() throw(INTERP_KERNEL::Exception);
493 void pack() const throw(INTERP_KERNEL::Exception);
494 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
495 void fillWithZero() throw(INTERP_KERNEL::Exception);
496 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
497 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
498 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
499 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
500 void reverse() throw(INTERP_KERNEL::Exception);
501 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
502 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
503 std::string repr() const throw(INTERP_KERNEL::Exception);
504 std::string reprZip() const throw(INTERP_KERNEL::Exception);
505 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
506 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
507 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
508 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
509 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
510 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
511 void transpose() throw(INTERP_KERNEL::Exception);
512 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
513 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
514 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
515 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
516 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
517 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
518 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
519 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
520 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
521 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
522 double front() const throw(INTERP_KERNEL::Exception);
523 double back() const throw(INTERP_KERNEL::Exception);
524 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
525 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
526 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
527 double *getPointer() throw(INTERP_KERNEL::Exception);
528 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
529 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
530 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
531 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
532 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
533 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
534 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
535 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
536 double getAverageValue() const throw(INTERP_KERNEL::Exception);
537 double norm2() const throw(INTERP_KERNEL::Exception);
538 double normMax() const throw(INTERP_KERNEL::Exception);
539 double normMin() const throw(INTERP_KERNEL::Exception);
540 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
541 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
542 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
543 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
544 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
545 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
546 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
550 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
556 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
557 void abs() throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
559 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
560 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
561 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
562 void applyPow(double val) throw(INTERP_KERNEL::Exception);
563 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
567 DataArrayDouble *applyFunc(const std::string& func) const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
570 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
571 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
572 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
573 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
574 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
575 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
576 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
577 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
578 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
579 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
580 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
581 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
582 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
583 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
584 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
585 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
586 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
587 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
588 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
589 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
592 DataArrayDouble() throw(INTERP_KERNEL::Exception)
594 return DataArrayDouble::New();
597 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
599 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)";
600 std::string msg(msgBase);
602 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
605 if(PyList_Check(elt0) || PyTuple_Check(elt0))
609 if(PyInt_Check(nbOfTuples))
611 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
613 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
616 if(PyInt_Check(elt2))
617 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
618 int nbOfCompo=PyInt_AS_LONG(elt2);
620 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
621 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
622 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
623 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
627 throw INTERP_KERNEL::Exception(msg.c_str());
630 {//DataArrayDouble.New([1.,3.,4.],3)
631 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
633 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
634 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
639 throw INTERP_KERNEL::Exception(msg.c_str());
642 {// DataArrayDouble.New([1.,3.,4.])
643 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
644 int tmpp1=-1,tmpp2=-1;
645 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
646 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
650 else if(PyInt_Check(elt0))
652 int nbOfTuples1=PyInt_AS_LONG(elt0);
654 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
659 if(PyInt_Check(nbOfTuples))
660 {//DataArrayDouble.New(5,2)
661 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
663 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
664 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
665 ret->alloc(nbOfTuples1,nbOfCompo);
669 throw INTERP_KERNEL::Exception(msg.c_str());
672 throw INTERP_KERNEL::Exception(msg.c_str());
675 {//DataArrayDouble.New(5)
676 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
677 ret->alloc(nbOfTuples1,1);
682 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
683 {//DataArrayDouble.New(numpyArray)
684 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
688 throw INTERP_KERNEL::Exception(msg.c_str());
689 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
692 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
694 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
697 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
700 std::vector<double> bb;
702 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
703 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
704 self->pushBackValsSilent(tmp,tmp+nbTuples);
707 std::string __repr__() const throw(INTERP_KERNEL::Exception)
709 std::ostringstream oss;
710 self->reprQuickOverview(oss);
714 std::string __str__() const throw(INTERP_KERNEL::Exception)
719 double __float__() const throw(INTERP_KERNEL::Exception)
721 return self->doubleValue();
724 int __len__() const throw(INTERP_KERNEL::Exception)
726 if(self->isAllocated())
728 return self->getNumberOfTuples();
732 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
736 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
738 return self->iterator();
741 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
743 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 !";
744 if(PyList_Check(li) || PyTuple_Check(li))
748 if(PyInt_Check(nbOfTuples))
750 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
752 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
755 if(PyInt_Check(nbOfComp))
756 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
757 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
759 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
760 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
761 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
764 throw INTERP_KERNEL::Exception(msg);
767 {//DataArrayDouble.setValues([1.,3.,4.],3)
769 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
770 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
774 throw INTERP_KERNEL::Exception(msg);
777 {// DataArrayDouble.setValues([1.,3.,4.])
778 int tmpp1=-1,tmpp2=-1;
779 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
780 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
784 throw INTERP_KERNEL::Exception(msg);
787 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
789 const double *vals=self->getConstPointer();
790 return convertDblArrToPyList(vals,self->getNbOfElems());
794 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
796 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
800 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
803 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
804 PyObject *ret=PyTuple_New(2);
805 PyObject *ret0Py=ret0?Py_True:Py_False;
807 PyTuple_SetItem(ret,0,ret0Py);
808 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
812 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
814 const double *vals=self->getConstPointer();
815 int nbOfComp=self->getNumberOfComponents();
816 int nbOfTuples=self->getNumberOfTuples();
817 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
820 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
823 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
824 if (!SWIG_IsOK(res1))
827 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
828 if(size!=self->getNumberOfTuples())
830 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
832 return self->renumber(tmp);
836 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
838 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
839 da2->checkAllocated();
840 int size=self->getNumberOfTuples();
841 if(size!=self->getNumberOfTuples())
843 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
845 return self->renumber(da2->getConstPointer());
849 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
852 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
853 if (!SWIG_IsOK(res1))
856 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
857 if(size!=self->getNumberOfTuples())
859 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
861 return self->renumberR(tmp);
865 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
867 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
868 da2->checkAllocated();
869 int size=self->getNumberOfTuples();
870 if(size!=self->getNumberOfTuples())
872 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
874 return self->renumberR(da2->getConstPointer());
878 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
881 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
882 if (!SWIG_IsOK(res1))
885 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
886 if(size!=self->getNumberOfTuples())
888 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
890 return self->renumberAndReduce(tmp,newNbOfTuple);
894 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
896 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
897 da2->checkAllocated();
898 int size=self->getNumberOfTuples();
899 if(size!=self->getNumberOfTuples())
901 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
903 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
907 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
909 int thisTupleId,otherTupleId;
910 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
911 PyObject *ret=PyTuple_New(3);
912 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
913 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
914 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
918 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
921 double r1=self->getMaxValue(tmp);
922 PyObject *ret=PyTuple_New(2);
923 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
924 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
928 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
931 double r1=self->getMaxValue2(tmp);
932 PyObject *ret=PyTuple_New(2);
933 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
934 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
938 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
941 double r1=self->getMinValue(tmp);
942 PyObject *ret=PyTuple_New(2);
943 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
944 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
948 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
951 double r1=self->getMinValue2(tmp);
952 PyObject *ret=PyTuple_New(2);
953 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
954 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
958 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
960 int nbOfCompo=self->getNumberOfComponents();
961 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
962 self->getMinMaxPerComponent(tmp);
963 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
967 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
969 int sz=self->getNumberOfComponents();
970 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
971 self->accumulate(tmp);
972 return convertDblArrToPyList(tmp,sz);
975 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
978 std::vector<int> val2;
979 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
980 return self->accumulatePerChunck(bg,bg+sz);
983 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
985 DataArrayInt *comm, *commIndex;
986 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
987 PyObject *res = PyList_New(2);
988 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
989 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
993 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
997 DataArrayDoubleTuple *aa;
998 std::vector<double> bb;
1000 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1001 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1003 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1004 PyObject *ret=PyTuple_New(2);
1005 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1006 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1010 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1012 std::vector<int> tmp;
1013 convertPyToNewIntArr3(li,tmp);
1014 self->setSelectedComponents(a,tmp);
1017 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1019 int sz=self->getNumberOfComponents();
1020 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1021 self->getTuple(tupleId,tmp);
1022 return convertDblArrToPyList(tmp,sz);
1025 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1027 std::vector<const DataArrayDouble *> tmp;
1028 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1029 return DataArrayDouble::Aggregate(tmp);
1032 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1034 std::vector<const DataArrayDouble *> tmp;
1035 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1036 return DataArrayDouble::Meld(tmp);
1039 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1043 DataArrayDoubleTuple *aa;
1044 std::vector<double> bb;
1046 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1047 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1048 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1049 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1050 DataArrayInt *c=0,*cI=0;
1051 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1052 PyObject *ret=PyTuple_New(2);
1053 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1054 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1058 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1060 DataArrayInt *ret1=0;
1061 bool ret0=self->areIncludedInMe(other,prec,ret1);
1062 PyObject *ret=PyTuple_New(2);
1063 PyObject *ret0Py=ret0?Py_True:Py_False;
1065 PyTuple_SetItem(ret,0,ret0Py);
1066 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1070 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1072 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1073 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1074 self->checkAllocated();
1075 int nbOfTuples=self->getNumberOfTuples();
1076 int nbOfComponents=self->getNumberOfComponents();
1078 std::vector<int> vt1,vc1;
1079 std::pair<int, std::pair<int,int> > pt1,pc1;
1080 DataArrayInt *dt1=0,*dc1=0;
1082 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1083 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1087 if(nbOfComponents==1)
1088 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1089 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1091 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1093 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1095 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1097 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1100 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1101 std::vector<int> v2(1,ic1);
1102 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1106 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1107 std::vector<int> v2(1,ic1);
1108 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1112 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1113 std::vector<int> v2(1,ic1);
1114 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1118 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1123 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1124 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1128 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1133 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1134 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1138 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1139 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1140 std::vector<int> v2(nbOfComp);
1141 for(int i=0;i<nbOfComp;i++)
1142 v2[i]=pc1.first+i*pc1.second.second;
1143 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1147 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1148 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1149 std::vector<int> v2(nbOfComp);
1150 for(int i=0;i<nbOfComp;i++)
1151 v2[i]=pc1.first+i*pc1.second.second;
1152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1156 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1157 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1158 std::vector<int> v2(nbOfComp);
1159 for(int i=0;i<nbOfComp;i++)
1160 v2[i]=pc1.first+i*pc1.second.second;
1161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1165 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1166 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1167 std::vector<int> v2(nbOfComp);
1168 for(int i=0;i<nbOfComp;i++)
1169 v2[i]=pc1.first+i*pc1.second.second;
1170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1173 throw INTERP_KERNEL::Exception(msg);
1177 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1179 self->checkAllocated();
1180 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1181 int nbOfTuples=self->getNumberOfTuples();
1182 int nbOfComponents=self->getNumberOfComponents();
1185 std::vector<double> v1;
1186 DataArrayDouble *d1=0;
1187 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1189 std::vector<int> vt1,vc1;
1190 std::pair<int, std::pair<int,int> > pt1,pc1;
1191 DataArrayInt *dt1=0,*dc1=0;
1192 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1193 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1201 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1204 tmp=DataArrayDouble::New();
1205 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1206 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1209 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1212 throw INTERP_KERNEL::Exception(msg);
1221 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1224 tmp=DataArrayDouble::New();
1225 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1226 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1229 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1232 throw INTERP_KERNEL::Exception(msg);
1241 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1244 tmp=DataArrayDouble::New();
1245 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1246 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1249 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1252 throw INTERP_KERNEL::Exception(msg);
1261 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1264 tmp=DataArrayDouble::New();
1265 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1266 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1269 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1272 throw INTERP_KERNEL::Exception(msg);
1281 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1284 tmp=DataArrayDouble::New();
1285 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1286 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1289 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1292 throw INTERP_KERNEL::Exception(msg);
1301 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1304 tmp=DataArrayDouble::New();
1305 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1306 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1309 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1312 throw INTERP_KERNEL::Exception(msg);
1321 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1324 tmp=DataArrayDouble::New();
1325 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1326 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1329 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1332 throw INTERP_KERNEL::Exception(msg);
1341 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1344 tmp=DataArrayDouble::New();
1345 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1346 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1349 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1352 throw INTERP_KERNEL::Exception(msg);
1361 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1364 tmp=DataArrayDouble::New();
1365 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1366 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1369 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1372 throw INTERP_KERNEL::Exception(msg);
1381 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1384 tmp=DataArrayDouble::New();
1385 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1386 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1389 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1392 throw INTERP_KERNEL::Exception(msg);
1401 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1404 tmp=DataArrayDouble::New();
1405 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1406 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1409 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1412 throw INTERP_KERNEL::Exception(msg);
1421 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1424 tmp=DataArrayDouble::New();
1425 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1426 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1429 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1432 throw INTERP_KERNEL::Exception(msg);
1441 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1444 tmp=DataArrayDouble::New();
1445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1446 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1449 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1452 throw INTERP_KERNEL::Exception(msg);
1461 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1464 tmp=DataArrayDouble::New();
1465 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1466 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1469 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1472 throw INTERP_KERNEL::Exception(msg);
1481 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1484 tmp=DataArrayDouble::New();
1485 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1486 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1489 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1492 throw INTERP_KERNEL::Exception(msg);
1501 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1504 tmp=DataArrayDouble::New();
1505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1506 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1509 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1512 throw INTERP_KERNEL::Exception(msg);
1517 throw INTERP_KERNEL::Exception(msg);
1522 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1524 return self->negate();
1527 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1529 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1532 DataArrayDoubleTuple *aa;
1533 std::vector<double> bb;
1536 #ifndef WITHOUT_AUTOFIELD
1538 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1540 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1543 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1544 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1546 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1549 throw INTERP_KERNEL::Exception(msg);
1553 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1558 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1559 ret->applyLin(1.,val);
1560 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1564 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1568 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1569 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1573 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1574 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1577 throw INTERP_KERNEL::Exception(msg);
1581 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1583 const char msg[]="Unexpected situation in __radd__ !";
1586 DataArrayDoubleTuple *aa;
1587 std::vector<double> bb;
1589 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1594 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1595 ret->applyLin(1.,val);
1600 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1601 return DataArrayDouble::Add(self,aaa);
1605 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1606 return DataArrayDouble::Add(self,aaa);
1609 throw INTERP_KERNEL::Exception(msg);
1613 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1615 const char msg[]="Unexpected situation in __iadd__ !";
1618 DataArrayDoubleTuple *aa;
1619 std::vector<double> bb;
1621 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1626 self->applyLin(1.,val);
1627 Py_XINCREF(trueSelf);
1633 Py_XINCREF(trueSelf);
1638 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1639 self->addEqual(aaa);
1640 Py_XINCREF(trueSelf);
1645 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1646 self->addEqual(aaa);
1647 Py_XINCREF(trueSelf);
1651 throw INTERP_KERNEL::Exception(msg);
1655 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1657 const char msg[]="Unexpected situation in __sub__ !";
1660 DataArrayDoubleTuple *aa;
1661 std::vector<double> bb;
1664 #ifndef WITHOUT_AUTOFIELD
1666 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1668 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1671 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1672 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1674 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1677 throw INTERP_KERNEL::Exception(msg);
1681 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1686 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1687 ret->applyLin(1.,-val);
1688 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1692 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1696 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1697 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1701 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1702 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1705 throw INTERP_KERNEL::Exception(msg);
1709 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1711 const char msg[]="Unexpected situation in __rsub__ !";
1714 DataArrayDoubleTuple *aa;
1715 std::vector<double> bb;
1717 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1722 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1723 ret->applyLin(-1.,val);
1728 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1729 return DataArrayDouble::Substract(aaa,self);
1733 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1734 return DataArrayDouble::Substract(aaa,self);
1737 throw INTERP_KERNEL::Exception(msg);
1741 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1743 const char msg[]="Unexpected situation in __isub__ !";
1746 DataArrayDoubleTuple *aa;
1747 std::vector<double> bb;
1749 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1754 self->applyLin(1,-val);
1755 Py_XINCREF(trueSelf);
1760 self->substractEqual(a);
1761 Py_XINCREF(trueSelf);
1766 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1767 self->substractEqual(aaa);
1768 Py_XINCREF(trueSelf);
1773 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1774 self->substractEqual(aaa);
1775 Py_XINCREF(trueSelf);
1779 throw INTERP_KERNEL::Exception(msg);
1783 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1785 const char msg[]="Unexpected situation in __mul__ !";
1788 DataArrayDoubleTuple *aa;
1789 std::vector<double> bb;
1792 #ifndef WITHOUT_AUTOFIELD
1794 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1796 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1799 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1800 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1802 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1805 throw INTERP_KERNEL::Exception(msg);
1809 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1814 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1815 ret->applyLin(val,0.);
1816 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1820 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1824 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1825 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1829 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1830 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1833 throw INTERP_KERNEL::Exception(msg);
1837 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1839 const char msg[]="Unexpected situation in __rmul__ !";
1842 DataArrayDoubleTuple *aa;
1843 std::vector<double> bb;
1845 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1850 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1851 ret->applyLin(val,0.);
1856 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1857 return DataArrayDouble::Multiply(self,aaa);
1861 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1862 return DataArrayDouble::Multiply(self,aaa);
1865 throw INTERP_KERNEL::Exception(msg);
1869 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1871 const char msg[]="Unexpected situation in __imul__ !";
1874 DataArrayDoubleTuple *aa;
1875 std::vector<double> bb;
1877 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1882 self->applyLin(val,0.);
1883 Py_XINCREF(trueSelf);
1888 self->multiplyEqual(a);
1889 Py_XINCREF(trueSelf);
1894 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1895 self->multiplyEqual(aaa);
1896 Py_XINCREF(trueSelf);
1901 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1902 self->multiplyEqual(aaa);
1903 Py_XINCREF(trueSelf);
1907 throw INTERP_KERNEL::Exception(msg);
1911 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1913 const char msg[]="Unexpected situation in __div__ !";
1916 DataArrayDoubleTuple *aa;
1917 std::vector<double> bb;
1920 #ifndef WITHOUT_AUTOFIELD
1922 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1924 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1927 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1928 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1930 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1933 throw INTERP_KERNEL::Exception(msg);
1937 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1943 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1944 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1945 ret->applyLin(1/val,0.);
1946 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1950 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1954 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1955 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1959 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1960 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1963 throw INTERP_KERNEL::Exception(msg);
1967 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1969 const char msg[]="Unexpected situation in __rdiv__ !";
1972 DataArrayDoubleTuple *aa;
1973 std::vector<double> bb;
1975 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1980 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1986 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1987 return DataArrayDouble::Divide(aaa,self);
1991 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1992 return DataArrayDouble::Divide(aaa,self);
1995 throw INTERP_KERNEL::Exception(msg);
1999 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2001 const char msg[]="Unexpected situation in __idiv__ !";
2004 DataArrayDoubleTuple *aa;
2005 std::vector<double> bb;
2007 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2013 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2014 self->applyLin(1./val,0.);
2015 Py_XINCREF(trueSelf);
2020 self->divideEqual(a);
2021 Py_XINCREF(trueSelf);
2026 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2027 self->divideEqual(aaa);
2028 Py_XINCREF(trueSelf);
2033 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2034 self->divideEqual(aaa);
2035 Py_XINCREF(trueSelf);
2039 throw INTERP_KERNEL::Exception(msg);
2043 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2045 const char msg[]="Unexpected situation in __pow__ !";
2048 DataArrayDoubleTuple *aa;
2049 std::vector<double> bb;
2051 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2056 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2062 return DataArrayDouble::Pow(self,a);
2066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2067 return DataArrayDouble::Pow(self,aaa);
2071 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2072 return DataArrayDouble::Pow(self,aaa);
2075 throw INTERP_KERNEL::Exception(msg);
2079 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2081 const char msg[]="Unexpected situation in __rpow__ !";
2084 DataArrayDoubleTuple *aa;
2085 std::vector<double> bb;
2087 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2092 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2093 ret->applyRPow(val);
2098 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2099 return DataArrayDouble::Pow(aaa,self);
2103 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2104 return DataArrayDouble::Pow(aaa,self);
2107 throw INTERP_KERNEL::Exception(msg);
2111 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2113 const char msg[]="Unexpected situation in __ipow__ !";
2116 DataArrayDoubleTuple *aa;
2117 std::vector<double> bb;
2119 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2124 self->applyPow(val);
2125 Py_XINCREF(trueSelf);
2131 Py_XINCREF(trueSelf);
2136 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2137 self->powEqual(aaa);
2138 Py_XINCREF(trueSelf);
2143 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2144 self->powEqual(aaa);
2145 Py_XINCREF(trueSelf);
2149 throw INTERP_KERNEL::Exception(msg);
2153 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2155 DataArrayInt *c=0,*cI=0;
2157 self->computeTupleIdsNearTuples(other,eps,c,cI);
2158 PyObject *ret=PyTuple_New(2);
2159 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2160 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2164 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2166 DataArrayInt *ret1=0;
2167 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2168 PyObject *ret=PyTuple_New(2);
2169 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2170 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2176 class DataArrayDoubleTuple;
2178 class DataArrayDoubleIterator
2181 DataArrayDoubleIterator(DataArrayDouble *da);
2182 ~DataArrayDoubleIterator();
2187 DataArrayDoubleTuple *ret=self->nextt();
2189 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2192 PyErr_SetString(PyExc_StopIteration,"No more data.");
2199 class DataArrayDoubleTuple
2202 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2203 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2206 std::string __str__() const throw(INTERP_KERNEL::Exception)
2208 return self->repr();
2211 double __float__() const throw(INTERP_KERNEL::Exception)
2213 return self->doubleValue();
2216 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2218 return self->buildDADouble(1,self->getNumberOfCompo());
2221 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2223 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2224 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2225 Py_XINCREF(trueSelf);
2229 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2231 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2232 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2233 Py_XINCREF(trueSelf);
2237 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2239 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2240 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2241 Py_XINCREF(trueSelf);
2245 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2247 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2248 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2249 Py_XINCREF(trueSelf);
2253 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2255 return PyInt_FromLong(self->getNumberOfCompo());
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 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2275 std::ostringstream oss;
2276 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2277 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2281 return PyFloat_FromDouble(pt[singleVal]);
2285 return PyFloat_FromDouble(pt[nbc+singleVal]);
2288 std::ostringstream oss;
2289 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2290 throw INTERP_KERNEL::Exception(oss.str().c_str());
2296 PyObject *t=PyTuple_New(multiVal.size());
2297 for(int j=0;j<(int)multiVal.size();j++)
2299 int cid=multiVal[j];
2302 std::ostringstream oss;
2303 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2304 throw INTERP_KERNEL::Exception(oss.str().c_str());
2306 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2312 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2313 PyObject *t=PyTuple_New(sz);
2314 for(int j=0;j<sz;j++)
2315 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2319 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2323 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2325 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2326 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2329 std::vector<double> multiValV;
2330 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2331 int nbc=self->getNumberOfCompo();
2332 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2334 std::vector<int> multiVal;
2335 std::pair<int, std::pair<int,int> > slic;
2336 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2337 double *pt=self->getPointer();
2338 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2345 std::ostringstream oss;
2346 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2347 throw INTERP_KERNEL::Exception(oss.str().c_str());
2353 pt[singleVal]=singleValV;
2358 if(multiValV.size()!=1)
2360 std::ostringstream oss;
2361 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2362 throw INTERP_KERNEL::Exception(oss.str().c_str());
2364 pt[singleVal]=multiValV[0];
2369 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2373 throw INTERP_KERNEL::Exception(msg);
2382 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2386 std::ostringstream oss;
2387 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2388 throw INTERP_KERNEL::Exception(oss.str().c_str());
2396 if(multiVal.size()!=multiValV.size())
2398 std::ostringstream oss;
2399 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2400 throw INTERP_KERNEL::Exception(oss.str().c_str());
2402 for(int i=0;i<(int)multiVal.size();i++)
2404 int pos=multiVal[i];
2407 std::ostringstream oss;
2408 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2409 throw INTERP_KERNEL::Exception(oss.str().c_str());
2411 pt[multiVal[i]]=multiValV[i];
2417 const double *ptV=daIntTyyppV->getConstPointer();
2418 if(nbc>daIntTyyppV->getNumberOfCompo())
2420 std::ostringstream oss;
2421 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2422 throw INTERP_KERNEL::Exception(oss.str().c_str());
2424 std::copy(ptV,ptV+nbc,pt);
2428 throw INTERP_KERNEL::Exception(msg);
2433 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2438 for(int j=0;j<sz;j++)
2439 pt[slic.first+j*slic.second.second]=singleValV;
2444 if(sz!=(int)multiValV.size())
2446 std::ostringstream oss;
2447 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2448 throw INTERP_KERNEL::Exception(oss.str().c_str());
2450 for(int j=0;j<sz;j++)
2451 pt[slic.first+j*slic.second.second]=multiValV[j];
2456 const double *ptV=daIntTyyppV->getConstPointer();
2457 if(sz>daIntTyyppV->getNumberOfCompo())
2459 std::ostringstream oss;
2460 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2461 throw INTERP_KERNEL::Exception(oss.str().c_str());
2463 for(int j=0;j<sz;j++)
2464 pt[slic.first+j*slic.second.second]=ptV[j];
2468 throw INTERP_KERNEL::Exception(msg);
2472 throw INTERP_KERNEL::Exception(msg);
2478 class DataArrayIntIterator;
2480 class DataArrayInt : public DataArray
2483 static DataArrayInt *New();
2484 int intValue() const throw(INTERP_KERNEL::Exception);
2485 int getHashCode() const throw(INTERP_KERNEL::Exception);
2486 bool empty() const throw(INTERP_KERNEL::Exception);
2487 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2488 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2489 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2490 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2491 int popBackSilent() throw(INTERP_KERNEL::Exception);
2492 void pack() const throw(INTERP_KERNEL::Exception);
2493 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2494 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2495 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2496 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2497 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2498 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2499 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2500 void reverse() throw(INTERP_KERNEL::Exception);
2501 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2502 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2503 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2504 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2505 void fillWithZero() throw(INTERP_KERNEL::Exception);
2506 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2507 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2508 std::string repr() const throw(INTERP_KERNEL::Exception);
2509 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2510 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2511 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2512 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2513 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2514 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2516 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2517 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2518 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2519 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2520 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2521 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2522 void transpose() throw(INTERP_KERNEL::Exception);
2523 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2524 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2525 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2526 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2527 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2528 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2529 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2530 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2531 int front() const throw(INTERP_KERNEL::Exception);
2532 int back() const throw(INTERP_KERNEL::Exception);
2533 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2534 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2535 int *getPointer() throw(INTERP_KERNEL::Exception);
2536 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2537 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2538 const int *begin() const throw(INTERP_KERNEL::Exception);
2539 const int *end() const throw(INTERP_KERNEL::Exception);
2540 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2541 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2542 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2543 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2544 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2545 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2546 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2547 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2548 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2549 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2550 int count(int value) const throw(INTERP_KERNEL::Exception);
2551 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2552 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2553 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2554 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2555 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2556 void abs() throw(INTERP_KERNEL::Exception);
2557 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2558 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2559 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2560 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2561 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2562 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2563 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2564 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2565 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2566 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2567 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2568 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2569 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2570 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2571 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2572 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2573 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2574 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2575 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2576 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2577 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2578 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2583 void computeOffsets() throw(INTERP_KERNEL::Exception);
2584 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2585 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2586 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2587 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2588 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2589 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2590 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2591 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2592 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2593 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2594 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2595 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2596 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2597 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2598 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2599 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2600 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2601 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2603 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2606 DataArrayInt() throw(INTERP_KERNEL::Exception)
2608 return DataArrayInt::New();
2611 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2613 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)";
2614 std::string msg(msgBase);
2616 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2619 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2623 if(PyInt_Check(nbOfTuples))
2625 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2627 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2630 if(PyInt_Check(nbOfComp))
2631 {//DataArrayInt.New([1,3,4,5],2,2)
2632 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2634 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2635 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2636 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2637 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2641 throw INTERP_KERNEL::Exception(msg.c_str());
2644 {//DataArrayInt.New([1,3,4],3)
2645 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2647 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2648 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2653 throw INTERP_KERNEL::Exception(msg.c_str());
2656 {// DataArrayInt.New([1,3,4])
2657 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2658 int tmpp1=-1,tmpp2=-1;
2659 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2660 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2664 else if(PyInt_Check(elt0))
2666 int nbOfTuples1=PyInt_AS_LONG(elt0);
2668 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2673 if(PyInt_Check(nbOfTuples))
2674 {//DataArrayInt.New(5,2)
2675 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2677 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2678 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2679 ret->alloc(nbOfTuples1,nbOfCompo);
2683 throw INTERP_KERNEL::Exception(msg.c_str());
2686 throw INTERP_KERNEL::Exception(msg.c_str());
2689 {//DataArrayInt.New(5)
2690 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2691 ret->alloc(nbOfTuples1,1);
2696 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2697 {//DataArrayInt.New(numpyArray)
2698 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2702 throw INTERP_KERNEL::Exception(msg.c_str());
2703 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2706 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2708 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2711 std::string __str__() const throw(INTERP_KERNEL::Exception)
2713 return self->repr();
2716 int __len__() const throw(INTERP_KERNEL::Exception)
2718 if(self->isAllocated())
2720 return self->getNumberOfTuples();
2724 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2728 int __int__() const throw(INTERP_KERNEL::Exception)
2730 return self->intValue();
2733 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2735 return self->iterator();
2738 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2740 int sz=self->getNumberOfComponents();
2741 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2742 self->accumulate(tmp);
2743 return convertIntArrToPyList(tmp,sz);
2746 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2749 std::vector<int> val2;
2750 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2751 return self->accumulatePerChunck(bg,bg+sz);
2754 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2757 std::vector<int> val2;
2758 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2759 return self->getIdsEqualTuple(bg,bg+sz);
2762 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2764 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2765 PyObject *ret=PyList_New(slcs.size());
2766 for(std::size_t i=0;i<slcs.size();i++)
2767 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2771 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2773 if(!PySlice_Check(slic))
2774 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2775 Py_ssize_t strt=2,stp=2,step=2;
2776 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2777 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2778 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2779 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 !");
2780 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2783 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2785 int newNbOfTuples=-1;
2786 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2787 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2788 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2789 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2790 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2791 PyObject *ret=PyTuple_New(2);
2792 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2793 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2797 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2799 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
2800 int szArr,sw,iTypppArr;
2801 std::vector<int> stdvecTyyppArr;
2802 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2803 int *pt(ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2804 ret->useArray(pt,true,ParaMEDMEM::C_DEALLOC,szArr,1);
2808 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2810 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 !";
2811 if(PyList_Check(li) || PyTuple_Check(li))
2815 if(PyInt_Check(nbOfTuples))
2817 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2819 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2822 if(PyInt_Check(nbOfComp))
2823 {//DataArrayInt.setValues([1,3,4,5],2,2)
2824 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2826 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2827 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2828 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2831 throw INTERP_KERNEL::Exception(msg);
2834 {//DataArrayInt.setValues([1,3,4],3)
2836 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2837 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2841 throw INTERP_KERNEL::Exception(msg);
2844 {// DataArrayInt.setValues([1,3,4])
2845 int tmpp1=-1,tmpp2=-1;
2846 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2847 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2851 throw INTERP_KERNEL::Exception(msg);
2854 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2856 const int *vals=self->getConstPointer();
2857 return convertIntArrToPyList(vals,self->getNbOfElems());
2861 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2863 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2867 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2870 bool ret0=self->isEqualIfNotWhy(other,ret1);
2871 PyObject *ret=PyTuple_New(2);
2872 PyObject *ret0Py=ret0?Py_True:Py_False;
2874 PyTuple_SetItem(ret,0,ret0Py);
2875 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2879 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2881 const int *vals=self->getConstPointer();
2882 int nbOfComp=self->getNumberOfComponents();
2883 int nbOfTuples=self->getNumberOfTuples();
2884 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2887 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2889 std::vector<const DataArrayInt *> groups;
2890 std::vector< std::vector<int> > fidsOfGroups;
2891 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2892 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2893 PyObject *ret = PyList_New(2);
2894 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2895 int sz=fidsOfGroups.size();
2896 PyObject *ret1 = PyList_New(sz);
2897 for(int i=0;i<sz;i++)
2898 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2899 PyList_SetItem(ret,1,ret1);
2903 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2906 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2907 if (!SWIG_IsOK(res1))
2910 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2911 self->transformWithIndArr(tmp,tmp+size);
2915 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2916 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2920 DataArrayInt *getIdsEqualList(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->getIdsEqualList(&singleVal,&singleVal+1);
2933 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2935 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2937 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2941 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2945 std::vector<int> multiVal;
2946 std::pair<int, std::pair<int,int> > slic;
2947 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2948 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2952 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2954 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2956 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2958 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2962 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2964 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2966 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2967 if (!SWIG_IsOK(res1))
2970 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2971 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2975 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2977 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2978 da2->checkAllocated();
2979 int size=self->getNumberOfTuples();
2980 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2982 PyObject *ret = PyList_New(3);
2983 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2984 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2985 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2989 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2992 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2993 if (!SWIG_IsOK(res1))
2996 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2997 return self->transformWithIndArrR(tmp,tmp+size);
3001 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3002 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3006 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3009 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3010 if (!SWIG_IsOK(res1))
3013 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3014 if(size!=self->getNumberOfTuples())
3016 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3018 return self->renumberAndReduce(tmp,newNbOfTuple);
3022 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3024 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3025 da2->checkAllocated();
3026 int size=self->getNumberOfTuples();
3027 if(size!=self->getNumberOfTuples())
3029 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3031 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3035 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3038 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3039 if (!SWIG_IsOK(res1))
3042 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3043 if(size!=self->getNumberOfTuples())
3045 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3047 return self->renumber(tmp);
3051 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3053 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3054 da2->checkAllocated();
3055 int size=self->getNumberOfTuples();
3056 if(size!=self->getNumberOfTuples())
3058 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3060 return self->renumber(da2->getConstPointer());
3064 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3067 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3068 if (!SWIG_IsOK(res1))
3071 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3072 if(size!=self->getNumberOfTuples())
3074 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3076 return self->renumberR(tmp);
3080 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3082 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3083 da2->checkAllocated();
3084 int size=self->getNumberOfTuples();
3085 if(size!=self->getNumberOfTuples())
3087 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3089 return self->renumberR(da2->getConstPointer());
3093 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3095 std::vector<int> tmp;
3096 convertPyToNewIntArr3(li,tmp);
3097 self->setSelectedComponents(a,tmp);
3100 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3102 int sz=self->getNumberOfComponents();
3103 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3104 self->getTuple(tupleId,tmp);
3105 return convertIntArrToPyList(tmp,sz);
3108 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3110 DataArrayInt *arr=0;
3111 DataArrayInt *arrI=0;
3112 self->changeSurjectiveFormat(targetNb,arr,arrI);
3113 PyObject *res = PyList_New(2);
3114 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3115 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3119 static DataArrayInt *Meld(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::Meld(tmp);
3126 static DataArrayInt *Aggregate(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::Aggregate(tmp);
3133 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3135 std::vector<const DataArrayInt *> tmp;
3136 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3137 return DataArrayInt::AggregateIndexes(tmp);
3140 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3142 std::vector<const DataArrayInt *> tmp;
3143 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3144 return DataArrayInt::BuildUnion(tmp);
3147 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3149 std::vector<const DataArrayInt *> tmp;
3150 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3151 return DataArrayInt::BuildIntersection(tmp);
3154 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3157 int r1=self->getMaxValue(tmp);
3158 PyObject *ret=PyTuple_New(2);
3159 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3160 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3164 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3167 int r1=self->getMinValue(tmp);
3168 PyObject *ret=PyTuple_New(2);
3169 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3170 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3174 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3176 int nbOfCompo=self->getNumberOfComponents();
3181 if(PyInt_Check(obj))
3183 int val=(int)PyInt_AS_LONG(obj);
3184 return self->locateValue(val);
3187 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3191 std::vector<int> arr;
3192 convertPyToNewIntArr3(obj,arr);
3193 return self->locateTuple(arr);
3198 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3200 int nbOfCompo=self->getNumberOfComponents();
3207 if(PyInt_Check(obj))
3209 int val=(int)PyInt_AS_LONG(obj);
3210 return self->presenceOfValue(val);
3213 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3217 std::vector<int> arr;
3218 convertPyToNewIntArr3(obj,arr);
3219 return self->presenceOfTuple(arr);
3224 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3226 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3227 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3228 self->checkAllocated();
3229 int nbOfTuples=self->getNumberOfTuples();
3230 int nbOfComponents=self->getNumberOfComponents();
3232 std::vector<int> vt1,vc1;
3233 std::pair<int, std::pair<int,int> > pt1,pc1;
3234 DataArrayInt *dt1=0,*dc1=0;
3236 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3237 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3242 if(nbOfComponents==1)
3243 return PyInt_FromLong(self->getIJSafe(it1,0));
3244 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3247 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3249 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3251 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3253 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3256 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3257 std::vector<int> v2(1,ic1);
3258 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3262 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3263 std::vector<int> v2(1,ic1);
3264 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3268 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3269 std::vector<int> v2(1,ic1);
3270 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3274 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3275 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3279 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3280 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3284 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3285 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3289 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3290 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3294 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3295 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3296 std::vector<int> v2(nbOfComp);
3297 for(int i=0;i<nbOfComp;i++)
3298 v2[i]=pc1.first+i*pc1.second.second;
3299 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3303 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3304 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3305 std::vector<int> v2(nbOfComp);
3306 for(int i=0;i<nbOfComp;i++)
3307 v2[i]=pc1.first+i*pc1.second.second;
3308 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3312 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3313 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3314 std::vector<int> v2(nbOfComp);
3315 for(int i=0;i<nbOfComp;i++)
3316 v2[i]=pc1.first+i*pc1.second.second;
3317 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3321 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3322 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3323 std::vector<int> v2(nbOfComp);
3324 for(int i=0;i<nbOfComp;i++)
3325 v2[i]=pc1.first+i*pc1.second.second;
3326 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3329 throw INTERP_KERNEL::Exception(msg);
3333 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3335 self->checkAllocated();
3336 const char msg[]="Unexpected situation in __setitem__ !";
3337 int nbOfTuples=self->getNumberOfTuples();
3338 int nbOfComponents=self->getNumberOfComponents();
3341 std::vector<int> v1;
3343 DataArrayIntTuple *dd1=0;
3344 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3346 std::vector<int> vt1,vc1;
3347 std::pair<int, std::pair<int,int> > pt1,pc1;
3348 DataArrayInt *dt1=0,*dc1=0;
3349 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3350 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3358 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3361 tmp=DataArrayInt::New();
3362 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3363 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3366 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3369 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3370 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3373 throw INTERP_KERNEL::Exception(msg);
3382 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3385 tmp=DataArrayInt::New();
3386 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3387 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3390 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3393 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3394 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3397 throw INTERP_KERNEL::Exception(msg);
3406 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3409 tmp=DataArrayInt::New();
3410 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3411 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3414 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3417 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3418 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3421 throw INTERP_KERNEL::Exception(msg);
3430 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3433 tmp=DataArrayInt::New();
3434 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3435 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3438 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3441 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3442 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3445 throw INTERP_KERNEL::Exception(msg);
3454 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3457 tmp=DataArrayInt::New();
3458 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3459 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3462 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3465 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3466 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3469 throw INTERP_KERNEL::Exception(msg);
3478 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3481 tmp=DataArrayInt::New();
3482 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3483 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3486 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3489 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3490 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3493 throw INTERP_KERNEL::Exception(msg);
3502 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3505 tmp=DataArrayInt::New();
3506 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3507 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3510 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3513 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3514 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3517 throw INTERP_KERNEL::Exception(msg);
3526 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3529 tmp=DataArrayInt::New();
3530 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3531 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3534 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3537 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3538 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3541 throw INTERP_KERNEL::Exception(msg);
3550 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3553 tmp=DataArrayInt::New();
3554 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3555 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3558 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3561 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3562 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3565 throw INTERP_KERNEL::Exception(msg);
3574 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3577 tmp=DataArrayInt::New();
3578 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3579 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3582 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3585 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3586 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3589 throw INTERP_KERNEL::Exception(msg);
3598 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3601 tmp=DataArrayInt::New();
3602 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3603 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3606 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3609 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3610 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3613 throw INTERP_KERNEL::Exception(msg);
3622 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3625 tmp=DataArrayInt::New();
3626 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3627 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3630 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3633 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3634 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3637 throw INTERP_KERNEL::Exception(msg);
3646 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3649 tmp=DataArrayInt::New();
3650 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3651 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3654 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3657 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3658 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3661 throw INTERP_KERNEL::Exception(msg);
3670 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3673 tmp=DataArrayInt::New();
3674 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3675 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3678 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3681 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3682 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3685 throw INTERP_KERNEL::Exception(msg);
3694 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3697 tmp=DataArrayInt::New();
3698 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3699 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3702 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3705 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3706 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3709 throw INTERP_KERNEL::Exception(msg);
3718 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3721 tmp=DataArrayInt::New();
3722 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3723 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3726 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3729 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3730 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3733 throw INTERP_KERNEL::Exception(msg);
3738 throw INTERP_KERNEL::Exception(msg);
3743 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3745 return self->negate();
3748 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3750 const char msg[]="Unexpected situation in __add__ !";
3753 std::vector<int> aa;
3754 DataArrayIntTuple *aaa;
3756 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3761 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3762 ret->applyLin(1,val);
3767 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3768 return DataArrayInt::Add(self,aaaa);
3772 return DataArrayInt::Add(self,a);
3776 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3777 return DataArrayInt::Add(self,aaaa);
3780 throw INTERP_KERNEL::Exception(msg);
3784 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3786 const char msg[]="Unexpected situation in __radd__ !";
3789 std::vector<int> aa;
3790 DataArrayIntTuple *aaa;
3792 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3797 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3798 ret->applyLin(1,val);
3803 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3804 return DataArrayInt::Add(self,aaaa);
3808 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3809 return DataArrayInt::Add(self,aaaa);
3812 throw INTERP_KERNEL::Exception(msg);
3816 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3818 const char msg[]="Unexpected situation in __iadd__ !";
3821 std::vector<int> aa;
3822 DataArrayIntTuple *aaa;
3824 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3829 self->applyLin(1,val);
3830 Py_XINCREF(trueSelf);
3835 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3837 Py_XINCREF(trueSelf);
3843 Py_XINCREF(trueSelf);
3848 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3849 self->addEqual(aaaa);
3850 Py_XINCREF(trueSelf);
3854 throw INTERP_KERNEL::Exception(msg);
3858 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3860 const char msg[]="Unexpected situation in __sub__ !";
3863 std::vector<int> aa;
3864 DataArrayIntTuple *aaa;
3866 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3871 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3872 ret->applyLin(1,-val);
3877 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3878 return DataArrayInt::Substract(self,aaaa);
3882 return DataArrayInt::Substract(self,a);
3886 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3887 return DataArrayInt::Substract(self,aaaa);
3890 throw INTERP_KERNEL::Exception(msg);
3894 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3896 const char msg[]="Unexpected situation in __rsub__ !";
3899 std::vector<int> aa;
3900 DataArrayIntTuple *aaa;
3902 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3907 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3908 ret->applyLin(-1,val);
3913 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3914 return DataArrayInt::Substract(aaaa,self);
3918 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3919 return DataArrayInt::Substract(aaaa,self);
3922 throw INTERP_KERNEL::Exception(msg);
3926 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3928 const char msg[]="Unexpected situation in __isub__ !";
3931 std::vector<int> aa;
3932 DataArrayIntTuple *aaa;
3934 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3939 self->applyLin(1,-val);
3940 Py_XINCREF(trueSelf);
3945 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3946 self->substractEqual(bb);
3947 Py_XINCREF(trueSelf);
3952 self->substractEqual(a);
3953 Py_XINCREF(trueSelf);
3958 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3959 self->substractEqual(aaaa);
3960 Py_XINCREF(trueSelf);
3964 throw INTERP_KERNEL::Exception(msg);
3968 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3970 const char msg[]="Unexpected situation in __mul__ !";
3973 std::vector<int> aa;
3974 DataArrayIntTuple *aaa;
3976 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3981 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3982 ret->applyLin(val,0);
3987 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3988 return DataArrayInt::Multiply(self,aaaa);
3992 return DataArrayInt::Multiply(self,a);
3996 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3997 return DataArrayInt::Multiply(self,aaaa);
4000 throw INTERP_KERNEL::Exception(msg);
4004 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4006 const char msg[]="Unexpected situation in __rmul__ !";
4009 std::vector<int> aa;
4010 DataArrayIntTuple *aaa;
4012 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4017 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4018 ret->applyLin(val,0);
4023 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4024 return DataArrayInt::Multiply(self,aaaa);
4028 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4029 return DataArrayInt::Multiply(self,aaaa);
4032 throw INTERP_KERNEL::Exception(msg);
4036 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4038 const char msg[]="Unexpected situation in __imul__ !";
4041 std::vector<int> aa;
4042 DataArrayIntTuple *aaa;
4044 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4049 self->applyLin(val,0);
4050 Py_XINCREF(trueSelf);
4055 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4056 self->multiplyEqual(bb);
4057 Py_XINCREF(trueSelf);
4062 self->multiplyEqual(a);
4063 Py_XINCREF(trueSelf);
4068 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4069 self->multiplyEqual(aaaa);
4070 Py_XINCREF(trueSelf);
4074 throw INTERP_KERNEL::Exception(msg);
4078 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4080 const char msg[]="Unexpected situation in __div__ !";
4083 std::vector<int> aa;
4084 DataArrayIntTuple *aaa;
4086 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4091 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4092 ret->applyDivideBy(val);
4097 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4098 return DataArrayInt::Divide(self,aaaa);
4102 return DataArrayInt::Divide(self,a);
4106 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4107 return DataArrayInt::Divide(self,aaaa);
4110 throw INTERP_KERNEL::Exception(msg);
4114 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4116 const char msg[]="Unexpected situation in __rdiv__ !";
4119 std::vector<int> aa;
4120 DataArrayIntTuple *aaa;
4122 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4127 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4133 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4134 return DataArrayInt::Divide(aaaa,self);
4138 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4139 return DataArrayInt::Divide(aaaa,self);
4142 throw INTERP_KERNEL::Exception(msg);
4146 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4148 const char msg[]="Unexpected situation in __idiv__ !";
4151 std::vector<int> aa;
4152 DataArrayIntTuple *aaa;
4154 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4159 self->applyDivideBy(val);
4160 Py_XINCREF(trueSelf);
4165 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4166 self->divideEqual(bb);
4167 Py_XINCREF(trueSelf);
4172 self->divideEqual(a);
4173 Py_XINCREF(trueSelf);
4178 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4179 self->divideEqual(aaaa);
4180 Py_XINCREF(trueSelf);
4184 throw INTERP_KERNEL::Exception(msg);
4188 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4190 const char msg[]="Unexpected situation in __mod__ !";
4193 std::vector<int> aa;
4194 DataArrayIntTuple *aaa;
4196 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4201 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4202 ret->applyModulus(val);
4207 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4208 return DataArrayInt::Modulus(self,aaaa);
4212 return DataArrayInt::Modulus(self,a);
4216 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4217 return DataArrayInt::Modulus(self,aaaa);
4220 throw INTERP_KERNEL::Exception(msg);
4224 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4226 const char msg[]="Unexpected situation in __rmod__ !";
4229 std::vector<int> aa;
4230 DataArrayIntTuple *aaa;
4232 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4237 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4238 ret->applyRModulus(val);
4243 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4244 return DataArrayInt::Modulus(aaaa,self);
4248 return DataArrayInt::Modulus(a,self);
4252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4253 return DataArrayInt::Modulus(aaaa,self);
4256 throw INTERP_KERNEL::Exception(msg);
4260 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4262 const char msg[]="Unexpected situation in __imod__ !";
4265 std::vector<int> aa;
4266 DataArrayIntTuple *aaa;
4268 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4273 self->applyModulus(val);
4274 Py_XINCREF(trueSelf);
4279 self->modulusEqual(a);
4280 Py_XINCREF(trueSelf);
4285 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4286 self->modulusEqual(aaaa);
4287 Py_XINCREF(trueSelf);
4291 throw INTERP_KERNEL::Exception(msg);
4295 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4297 const char msg[]="Unexpected situation in __pow__ !";
4300 std::vector<int> aa;
4301 DataArrayIntTuple *aaa;
4303 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4308 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4314 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4315 return DataArrayInt::Pow(self,aaaa);
4319 return DataArrayInt::Pow(self,a);
4323 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4324 return DataArrayInt::Pow(self,aaaa);
4327 throw INTERP_KERNEL::Exception(msg);
4331 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4333 const char msg[]="Unexpected situation in __rpow__ !";
4336 std::vector<int> aa;
4337 DataArrayIntTuple *aaa;
4339 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4344 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4345 ret->applyRPow(val);
4350 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4351 return DataArrayInt::Pow(aaaa,self);
4355 return DataArrayInt::Pow(a,self);
4359 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4360 return DataArrayInt::Pow(aaaa,self);
4363 throw INTERP_KERNEL::Exception(msg);
4367 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4369 const char msg[]="Unexpected situation in __ipow__ !";
4372 std::vector<int> aa;
4373 DataArrayIntTuple *aaa;
4375 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4380 self->applyPow(val);
4381 Py_XINCREF(trueSelf);
4387 Py_XINCREF(trueSelf);
4392 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4393 self->powEqual(aaaa);
4394 Py_XINCREF(trueSelf);
4398 throw INTERP_KERNEL::Exception(msg);
4402 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4404 std::ostringstream oss;
4405 self->reprQuickOverview(oss);
4409 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4411 int szArr,sw,iTypppArr;
4412 std::vector<int> stdvecTyyppArr;
4413 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4414 self->pushBackValsSilent(tmp,tmp+szArr);
4417 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4419 std::vector<int> ret1;
4420 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4421 std::size_t sz=ret0.size();
4422 PyObject *pyRet=PyTuple_New(2);
4423 PyObject *pyRet0=PyList_New((int)sz);
4424 PyObject *pyRet1=PyList_New((int)sz);
4425 for(std::size_t i=0;i<sz;i++)
4427 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4428 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4430 PyTuple_SetItem(pyRet,0,pyRet0);
4431 PyTuple_SetItem(pyRet,1,pyRet1);
4435 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4437 DataArrayInt *ret0=0,*ret1=0;
4438 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4439 PyObject *pyRet=PyTuple_New(2);
4440 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4441 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4447 class DataArrayIntTuple;
4449 class DataArrayIntIterator
4452 DataArrayIntIterator(DataArrayInt *da);
4453 ~DataArrayIntIterator();
4458 DataArrayIntTuple *ret=self->nextt();
4460 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4463 PyErr_SetString(PyExc_StopIteration,"No more data.");
4470 class DataArrayIntTuple
4473 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4474 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4477 std::string __str__() const throw(INTERP_KERNEL::Exception)
4479 return self->repr();
4482 int __int__() const throw(INTERP_KERNEL::Exception)
4484 return self->intValue();
4487 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4489 return self->buildDAInt(1,self->getNumberOfCompo());
4492 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4494 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4495 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4496 Py_XINCREF(trueSelf);
4500 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4502 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4503 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4504 Py_XINCREF(trueSelf);
4508 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4510 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4511 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4512 Py_XINCREF(trueSelf);
4516 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4518 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4519 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4520 Py_XINCREF(trueSelf);
4524 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4526 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4527 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4528 Py_XINCREF(trueSelf);
4532 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4534 return PyInt_FromLong(self->getNumberOfCompo());
4537 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4539 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4542 std::vector<int> multiVal;
4543 std::pair<int, std::pair<int,int> > slic;
4544 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4545 const int *pt=self->getConstPointer();
4546 int nbc=self->getNumberOfCompo();
4547 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4554 std::ostringstream oss;
4555 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4556 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4560 return PyInt_FromLong(pt[singleVal]);
4564 return PyInt_FromLong(pt[nbc+singleVal]);
4567 std::ostringstream oss;
4568 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4569 throw INTERP_KERNEL::Exception(oss.str().c_str());
4575 PyObject *t=PyTuple_New(multiVal.size());
4576 for(int j=0;j<(int)multiVal.size();j++)
4578 int cid=multiVal[j];
4581 std::ostringstream oss;
4582 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4583 throw INTERP_KERNEL::Exception(oss.str().c_str());
4585 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4591 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4592 PyObject *t=PyTuple_New(sz);
4593 for(int j=0;j<sz;j++)
4594 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4598 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4602 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4604 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4605 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4608 std::vector<int> multiValV;
4609 std::pair<int, std::pair<int,int> > slicV;
4610 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4611 int nbc=self->getNumberOfCompo();
4612 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4614 std::vector<int> multiVal;
4615 std::pair<int, std::pair<int,int> > slic;
4616 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4617 int *pt=self->getPointer();
4618 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4625 std::ostringstream oss;
4626 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4627 throw INTERP_KERNEL::Exception(oss.str().c_str());
4633 pt[singleVal]=singleValV;
4638 if(multiValV.size()!=1)
4640 std::ostringstream oss;
4641 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4642 throw INTERP_KERNEL::Exception(oss.str().c_str());
4644 pt[singleVal]=multiValV[0];
4649 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4653 throw INTERP_KERNEL::Exception(msg);
4662 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4666 std::ostringstream oss;
4667 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4668 throw INTERP_KERNEL::Exception(oss.str().c_str());
4676 if(multiVal.size()!=multiValV.size())
4678 std::ostringstream oss;
4679 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4680 throw INTERP_KERNEL::Exception(oss.str().c_str());
4682 for(int i=0;i<(int)multiVal.size();i++)
4684 int pos=multiVal[i];
4687 std::ostringstream oss;
4688 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4689 throw INTERP_KERNEL::Exception(oss.str().c_str());
4691 pt[multiVal[i]]=multiValV[i];
4697 const int *ptV=daIntTyyppV->getConstPointer();
4698 if(nbc>daIntTyyppV->getNumberOfCompo())
4700 std::ostringstream oss;
4701 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4702 throw INTERP_KERNEL::Exception(oss.str().c_str());
4704 std::copy(ptV,ptV+nbc,pt);
4708 throw INTERP_KERNEL::Exception(msg);
4713 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4718 for(int j=0;j<sz;j++)
4719 pt[slic.first+j*slic.second.second]=singleValV;
4724 if(sz!=(int)multiValV.size())
4726 std::ostringstream oss;
4727 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4728 throw INTERP_KERNEL::Exception(oss.str().c_str());
4730 for(int j=0;j<sz;j++)
4731 pt[slic.first+j*slic.second.second]=multiValV[j];
4736 const int *ptV=daIntTyyppV->getConstPointer();
4737 if(sz>daIntTyyppV->getNumberOfCompo())
4739 std::ostringstream oss;
4740 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4741 throw INTERP_KERNEL::Exception(oss.str().c_str());
4743 for(int j=0;j<sz;j++)
4744 pt[slic.first+j*slic.second.second]=ptV[j];
4748 throw INTERP_KERNEL::Exception(msg);
4752 throw INTERP_KERNEL::Exception(msg);
4758 class DataArrayChar : public DataArray
4761 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4762 int getHashCode() const throw(INTERP_KERNEL::Exception);
4763 bool empty() const throw(INTERP_KERNEL::Exception);
4764 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4765 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4766 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4767 char popBackSilent() throw(INTERP_KERNEL::Exception);
4768 void pack() const throw(INTERP_KERNEL::Exception);
4769 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4770 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4771 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4772 void reverse() throw(INTERP_KERNEL::Exception);
4773 void fillWithZero() throw(INTERP_KERNEL::Exception);
4774 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4775 std::string repr() const throw(INTERP_KERNEL::Exception);
4776 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4777 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4778 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4779 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4780 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4781 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4782 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4783 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4784 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4785 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4786 char front() const throw(INTERP_KERNEL::Exception);
4787 char back() const throw(INTERP_KERNEL::Exception);
4788 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4789 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4790 char *getPointer() throw(INTERP_KERNEL::Exception);
4791 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4792 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4793 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4794 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4795 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4796 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4797 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4798 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4799 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4800 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4801 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4804 int __len__() const throw(INTERP_KERNEL::Exception)
4806 if(self->isAllocated())
4808 return self->getNumberOfTuples();
4812 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4816 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4819 bool ret0=self->isEqualIfNotWhy(other,ret1);
4820 PyObject *ret=PyTuple_New(2);
4821 PyObject *ret0Py=ret0?Py_True:Py_False;
4823 PyTuple_SetItem(ret,0,ret0Py);
4824 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4828 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4831 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4832 if (!SWIG_IsOK(res1))
4835 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4836 if(size!=self->getNumberOfTuples())
4838 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4840 return self->renumber(tmp);
4844 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4846 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4847 da2->checkAllocated();
4848 int size=self->getNumberOfTuples();
4849 if(size!=self->getNumberOfTuples())
4851 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4853 return self->renumber(da2->getConstPointer());
4857 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4860 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4861 if (!SWIG_IsOK(res1))
4864 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4865 if(size!=self->getNumberOfTuples())
4867 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4869 return self->renumberR(tmp);
4873 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4875 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4876 da2->checkAllocated();
4877 int size=self->getNumberOfTuples();
4878 if(size!=self->getNumberOfTuples())
4880 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4882 return self->renumberR(da2->getConstPointer());
4886 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4889 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4890 if (!SWIG_IsOK(res1))
4893 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4894 if(size!=self->getNumberOfTuples())
4896 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4898 return self->renumberAndReduce(tmp,newNbOfTuple);
4902 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4904 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4905 da2->checkAllocated();
4906 int size=self->getNumberOfTuples();
4907 if(size!=self->getNumberOfTuples())
4909 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4911 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4915 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4917 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4918 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4919 return DataArrayChar::Aggregate(tmp);
4922 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4924 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4925 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4926 return DataArrayChar::Meld(tmp);
4931 class DataArrayByteIterator;
4933 class DataArrayByte : public DataArrayChar
4936 static DataArrayByte *New();
4937 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4938 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4939 char byteValue() const throw(INTERP_KERNEL::Exception);
4942 DataArrayByte() throw(INTERP_KERNEL::Exception)
4944 return DataArrayByte::New();
4947 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4949 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) !";
4950 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4954 if(PyInt_Check(nbOfTuples))
4956 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4958 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4961 if(PyInt_Check(nbOfComp))
4962 {//DataArrayByte.New([1,3,4,5],2,2)
4963 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4965 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4966 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4967 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4968 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4972 throw INTERP_KERNEL::Exception(msg);
4975 {//DataArrayByte.New([1,3,4],3)
4976 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4978 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4979 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4984 throw INTERP_KERNEL::Exception(msg);
4987 {// DataArrayByte.New([1,3,4])
4988 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4989 int tmpp1=-1,tmpp2=-1;
4990 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4991 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4995 else if(PyInt_Check(elt0))
4997 int nbOfTuples1=PyInt_AS_LONG(elt0);
4999 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5004 if(PyInt_Check(nbOfTuples))
5005 {//DataArrayByte.New(5,2)
5006 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5008 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5009 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5010 ret->alloc(nbOfTuples1,nbOfCompo);
5014 throw INTERP_KERNEL::Exception(msg);
5017 throw INTERP_KERNEL::Exception(msg);
5020 {//DataArrayByte.New(5)
5021 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5022 ret->alloc(nbOfTuples1,1);
5027 throw INTERP_KERNEL::Exception(msg);
5030 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5032 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5035 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5037 std::ostringstream oss;
5038 self->reprQuickOverview(oss);
5042 int __int__() const throw(INTERP_KERNEL::Exception)
5044 return (int) self->byteValue();
5047 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5049 return self->iterator();
5052 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5054 return (int)self->getIJ(tupleId,compoId);
5057 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5059 return (int)self->getIJSafe(tupleId,compoId);
5062 std::string __str__() const throw(INTERP_KERNEL::Exception)
5064 return self->repr();
5067 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5069 const char *vals=self->getConstPointer();
5070 int nbOfComp=self->getNumberOfComponents();
5071 int nbOfTuples=self->getNumberOfTuples();
5072 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5075 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5078 int ival=-1; std::vector<int> ivval;
5079 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5080 std::vector<char> vals(sz);
5081 std::copy(pt,pt+sz,vals.begin());
5082 return self->presenceOfTuple(vals);
5085 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5088 int ival=-1; std::vector<int> ivval;
5089 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5090 std::vector<char> vals2(sz);
5091 std::copy(pt,pt+sz,vals2.begin());
5092 return self->presenceOfValue(vals2);
5095 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5098 int ival=-1; std::vector<int> ivval;
5099 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5100 std::vector<char> vals2(sz);
5101 std::copy(pt,pt+sz,vals2.begin());
5102 return self->locateValue(vals2);
5105 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5108 int ival=-1; std::vector<int> ivval;
5109 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5110 std::vector<char> vals(sz);
5111 std::copy(pt,pt+sz,vals.begin());
5112 return self->locateTuple(vals);
5115 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5118 int ival=-1; std::vector<int> ivval;
5119 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5120 std::vector<char> vals(sz);
5121 std::copy(pt,pt+sz,vals.begin());
5122 return self->search(vals);
5125 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5127 int sz=self->getNumberOfComponents();
5128 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5129 self->getTuple(tupleId,tmp);
5130 PyObject *ret=PyTuple_New(sz);
5131 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5135 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5138 int r1=(int)self->getMaxValue(tmp);
5139 PyObject *ret=PyTuple_New(2);
5140 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5141 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5145 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5148 int r1=(int)self->getMinValue(tmp);
5149 PyObject *ret=PyTuple_New(2);
5150 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5151 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5155 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5157 int nbOfCompo=self->getNumberOfComponents();
5162 if(PyInt_Check(obj))
5164 int val=(int)PyInt_AS_LONG(obj);
5165 return self->locateValue(val);
5168 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5171 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5175 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5177 int nbOfCompo=self->getNumberOfComponents();
5184 if(PyInt_Check(obj))
5186 int val=(int)PyInt_AS_LONG(obj);
5187 return self->presenceOfValue(val);
5190 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5193 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5199 class DataArrayByteTuple;
5201 class DataArrayByteIterator
5204 DataArrayByteIterator(DataArrayByte *da);
5205 ~DataArrayByteIterator();
5208 class DataArrayByteTuple
5211 std::string repr() const throw(INTERP_KERNEL::Exception);
5212 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5215 std::string __str__() const throw(INTERP_KERNEL::Exception)
5217 return self->repr();
5220 char __int__() const throw(INTERP_KERNEL::Exception)
5222 return self->byteValue();
5225 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5227 return self->buildDAByte(1,self->getNumberOfCompo());
5232 class DataArrayAsciiCharIterator;
5234 class DataArrayAsciiChar : public DataArrayChar
5237 static DataArrayAsciiChar *New();
5238 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5239 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5240 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5243 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5245 return DataArrayAsciiChar::New();
5248 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5250 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) !";
5251 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5255 if(PyInt_Check(nbOfTuples))
5257 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5259 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5262 if(PyInt_Check(nbOfComp))
5263 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5264 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5266 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5267 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5268 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5269 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5273 throw INTERP_KERNEL::Exception(msg);
5276 {//DataArrayAsciiChar.New([1,3,4],3)
5277 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5279 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5280 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5284 else if(PyString_Check(nbOfTuples))
5286 if(PyString_Size(nbOfTuples)!=1)
5287 throw INTERP_KERNEL::Exception(msg);
5288 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5289 std::vector<std::string> tmp;
5290 if(fillStringVector(elt0,tmp))
5291 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5293 throw INTERP_KERNEL::Exception(msg);
5296 throw INTERP_KERNEL::Exception(msg);
5300 std::vector<std::string> tmmp;
5301 if(fillStringVector(elt0,tmmp))
5302 //DataArrayAsciiChar.New(["abc","de","fghi"])
5303 return DataArrayAsciiChar::New(tmmp,' ');
5306 // DataArrayAsciiChar.New([1,3,4])
5307 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5308 int tmpp1=-1,tmpp2=-1;
5309 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5310 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5315 else if(PyInt_Check(elt0))
5317 int nbOfTuples1=PyInt_AS_LONG(elt0);
5319 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5324 if(PyInt_Check(nbOfTuples))
5325 {//DataArrayAsciiChar.New(5,2)
5326 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5328 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5329 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5330 ret->alloc(nbOfTuples1,nbOfCompo);
5334 throw INTERP_KERNEL::Exception(msg);
5337 throw INTERP_KERNEL::Exception(msg);
5340 {//DataArrayAsciiChar.New(5)
5341 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5342 ret->alloc(nbOfTuples1,1);
5347 throw INTERP_KERNEL::Exception(msg);
5350 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5352 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5355 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5357 std::ostringstream oss;
5358 self->reprQuickOverview(oss);
5362 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5364 return self->iterator();
5367 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5369 char tmp[2]; tmp[1]='\0';
5370 tmp[0]=self->getIJ(tupleId,compoId);
5371 return std::string(tmp);
5374 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5376 char tmp[2]; tmp[1]='\0';
5377 tmp[0]=self->getIJSafe(tupleId,compoId);
5378 return std::string(tmp);
5381 std::string __str__() const throw(INTERP_KERNEL::Exception)
5383 return self->repr();
5386 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5388 const char *vals=self->getConstPointer();
5389 int nbOfComp=self->getNumberOfComponents();
5390 int nbOfTuples=self->getNumberOfTuples();
5391 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5394 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5396 if(PyString_Check(tupl))
5398 Py_ssize_t sz=PyString_Size(tupl);
5399 std::vector<char> vals(sz);
5400 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5401 return self->presenceOfTuple(vals);
5404 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5407 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5409 if(PyString_Check(vals))
5411 Py_ssize_t sz=PyString_Size(vals);
5412 std::vector<char> vals2(sz);
5413 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5414 return self->presenceOfValue(vals2);
5417 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5420 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5422 if(PyString_Check(vals))
5424 Py_ssize_t sz=PyString_Size(vals);
5425 std::vector<char> vals2(sz);
5426 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5427 return self->locateValue(vals2);
5430 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5433 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5435 if(PyString_Check(tupl))
5437 Py_ssize_t sz=PyString_Size(tupl);
5438 std::vector<char> vals(sz);
5439 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5440 return self->locateTuple(vals);
5443 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5446 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5448 if(PyString_Check(strOrListOfInt))
5450 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5451 std::vector<char> vals(sz);
5452 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5453 return self->search(vals);
5456 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5459 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5461 int sz=self->getNumberOfComponents();
5462 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5463 self->getTuple(tupleId,tmp);
5464 return PyString_FromString(tmp);
5467 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5470 char tmp2[2]; tmp2[1]='\0';
5471 tmp2[0]=self->getMaxValue(tmp);
5472 PyObject *ret=PyTuple_New(2);
5473 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5474 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5478 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5481 char tmp2[2]; tmp2[1]='\0';
5482 tmp2[0]=self->getMinValue(tmp);
5483 PyObject *ret=PyTuple_New(2);
5484 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5485 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5489 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5491 int nbOfCompo=self->getNumberOfComponents();
5496 if(PyString_Check(obj))
5498 Py_ssize_t sz=PyString_Size(obj);
5499 char *pt=PyString_AsString(obj);
5501 return self->locateValue(pt[0]);
5503 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5506 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5509 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5513 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5515 int nbOfCompo=self->getNumberOfComponents();
5522 if(PyString_Check(obj))
5524 Py_ssize_t sz=PyString_Size(obj);
5525 char *pt=PyString_AsString(obj);
5527 return self->presenceOfValue(pt[0]);
5529 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5532 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5535 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5539 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5542 std::vector<int> stdvecTyyppArr;
5543 std::pair<int, std::pair<int,int> > sTyyppArr;
5544 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5545 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5549 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5551 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5553 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5555 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5557 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5561 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5563 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.";
5565 std::vector<int> stdvecTyyppArr;
5566 std::pair<int, std::pair<int,int> > sTyyppArr;
5567 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5568 int nbOfCompo=self->getNumberOfComponents();
5569 int nbOfTuples=self->getNumberOfTuples();
5570 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5572 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5573 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5582 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5588 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5589 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5592 //value vector<string>
5595 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5596 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5599 //value DataArrayChar
5602 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5606 throw INTERP_KERNEL::Exception(msg);
5610 {//obj list-tuple[int]
5616 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5622 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5623 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5626 //value vector<string>
5629 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5630 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5633 //value DataArrayChar
5636 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5640 throw INTERP_KERNEL::Exception(msg);
5651 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5657 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5658 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5661 //value vector<string>
5664 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5665 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5668 //value DataArrayChar
5671 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5675 throw INTERP_KERNEL::Exception(msg);
5686 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5692 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5693 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5696 //value vector<string>
5699 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5700 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5703 //value DataArrayChar
5706 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5710 throw INTERP_KERNEL::Exception(msg);
5715 throw INTERP_KERNEL::Exception(msg);
5721 class DataArrayAsciiCharTuple;
5723 class DataArrayAsciiCharIterator
5726 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5727 ~DataArrayAsciiCharIterator();
5732 DataArrayAsciiCharTuple *ret=self->nextt();
5734 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5737 PyErr_SetString(PyExc_StopIteration,"No more data.");
5744 class DataArrayAsciiCharTuple
5747 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5748 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5751 std::string __str__() const throw(INTERP_KERNEL::Exception)
5753 return self->repr();
5756 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5758 return self->buildDAAsciiChar(1,self->getNumberOfCompo());