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 *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2255 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2258 std::vector<int> multiVal;
2259 std::pair<int, std::pair<int,int> > slic;
2260 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2261 const double *pt=self->getConstPointer();
2262 int nbc=self->getNumberOfCompo();
2263 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2270 std::ostringstream oss;
2271 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2272 throw INTERP_KERNEL::Exception(oss.str().c_str());
2275 return PyFloat_FromDouble(pt[singleVal]);
2279 return PyFloat_FromDouble(pt[nbc+singleVal]);
2282 std::ostringstream oss;
2283 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2284 throw INTERP_KERNEL::Exception(oss.str().c_str());
2290 PyObject *t=PyTuple_New(multiVal.size());
2291 for(int j=0;j<(int)multiVal.size();j++)
2293 int cid=multiVal[j];
2296 std::ostringstream oss;
2297 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2298 throw INTERP_KERNEL::Exception(oss.str().c_str());
2300 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2306 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2307 PyObject *t=PyTuple_New(sz);
2308 for(int j=0;j<sz;j++)
2309 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2313 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2317 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2319 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2320 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2323 std::vector<double> multiValV;
2324 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2325 int nbc=self->getNumberOfCompo();
2326 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2328 std::vector<int> multiVal;
2329 std::pair<int, std::pair<int,int> > slic;
2330 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2331 double *pt=self->getPointer();
2332 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2339 std::ostringstream oss;
2340 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2341 throw INTERP_KERNEL::Exception(oss.str().c_str());
2347 pt[singleVal]=singleValV;
2352 if(multiValV.size()!=1)
2354 std::ostringstream oss;
2355 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2356 throw INTERP_KERNEL::Exception(oss.str().c_str());
2358 pt[singleVal]=multiValV[0];
2363 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2367 throw INTERP_KERNEL::Exception(msg);
2376 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2380 std::ostringstream oss;
2381 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2382 throw INTERP_KERNEL::Exception(oss.str().c_str());
2390 if(multiVal.size()!=multiValV.size())
2392 std::ostringstream oss;
2393 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2394 throw INTERP_KERNEL::Exception(oss.str().c_str());
2396 for(int i=0;i<(int)multiVal.size();i++)
2398 int pos=multiVal[i];
2401 std::ostringstream oss;
2402 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2403 throw INTERP_KERNEL::Exception(oss.str().c_str());
2405 pt[multiVal[i]]=multiValV[i];
2411 const double *ptV=daIntTyyppV->getConstPointer();
2412 if(nbc>daIntTyyppV->getNumberOfCompo())
2414 std::ostringstream oss;
2415 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2416 throw INTERP_KERNEL::Exception(oss.str().c_str());
2418 std::copy(ptV,ptV+nbc,pt);
2422 throw INTERP_KERNEL::Exception(msg);
2427 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2432 for(int j=0;j<sz;j++)
2433 pt[slic.first+j*slic.second.second]=singleValV;
2438 if(sz!=(int)multiValV.size())
2440 std::ostringstream oss;
2441 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2442 throw INTERP_KERNEL::Exception(oss.str().c_str());
2444 for(int j=0;j<sz;j++)
2445 pt[slic.first+j*slic.second.second]=multiValV[j];
2450 const double *ptV=daIntTyyppV->getConstPointer();
2451 if(sz>daIntTyyppV->getNumberOfCompo())
2453 std::ostringstream oss;
2454 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2455 throw INTERP_KERNEL::Exception(oss.str().c_str());
2457 for(int j=0;j<sz;j++)
2458 pt[slic.first+j*slic.second.second]=ptV[j];
2462 throw INTERP_KERNEL::Exception(msg);
2466 throw INTERP_KERNEL::Exception(msg);
2472 class DataArrayIntIterator;
2474 class DataArrayInt : public DataArray
2477 static DataArrayInt *New();
2478 int intValue() const throw(INTERP_KERNEL::Exception);
2479 int getHashCode() const throw(INTERP_KERNEL::Exception);
2480 bool empty() const throw(INTERP_KERNEL::Exception);
2481 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2482 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2483 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2484 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2485 int popBackSilent() throw(INTERP_KERNEL::Exception);
2486 void pack() const throw(INTERP_KERNEL::Exception);
2487 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2488 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2489 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2490 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2491 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2492 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2493 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2494 void reverse() throw(INTERP_KERNEL::Exception);
2495 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2496 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2497 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2498 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2499 void fillWithZero() throw(INTERP_KERNEL::Exception);
2500 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2501 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2502 std::string repr() const throw(INTERP_KERNEL::Exception);
2503 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2504 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2505 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2506 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2507 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2508 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2509 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2510 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2511 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2512 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2513 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2514 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2516 void transpose() throw(INTERP_KERNEL::Exception);
2517 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2518 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2519 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2520 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2521 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2522 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2523 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2524 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2525 int front() const throw(INTERP_KERNEL::Exception);
2526 int back() const throw(INTERP_KERNEL::Exception);
2527 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2528 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2529 int *getPointer() throw(INTERP_KERNEL::Exception);
2530 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2531 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2532 const int *begin() const throw(INTERP_KERNEL::Exception);
2533 const int *end() const throw(INTERP_KERNEL::Exception);
2534 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2535 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2536 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2537 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2538 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2539 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2540 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2541 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2542 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2543 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2544 int count(int value) const throw(INTERP_KERNEL::Exception);
2545 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2546 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2547 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2548 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2549 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2550 void abs() throw(INTERP_KERNEL::Exception);
2551 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2552 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2553 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2554 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2555 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2556 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2557 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2558 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2559 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2560 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2561 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2562 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2563 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2564 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2565 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2566 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2567 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2568 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2569 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2570 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2572 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2573 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2574 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2575 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2576 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2577 void computeOffsets() throw(INTERP_KERNEL::Exception);
2578 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2583 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2584 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2585 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2586 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2587 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2588 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2589 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2590 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2591 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2592 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2593 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2594 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2595 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2597 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2600 DataArrayInt() throw(INTERP_KERNEL::Exception)
2602 return DataArrayInt::New();
2605 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2607 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)";
2608 std::string msg(msgBase);
2610 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2613 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2617 if(PyInt_Check(nbOfTuples))
2619 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2621 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2624 if(PyInt_Check(nbOfComp))
2625 {//DataArrayInt.New([1,3,4,5],2,2)
2626 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2628 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2629 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2630 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2631 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2635 throw INTERP_KERNEL::Exception(msg.c_str());
2638 {//DataArrayInt.New([1,3,4],3)
2639 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2641 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2642 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2647 throw INTERP_KERNEL::Exception(msg.c_str());
2650 {// DataArrayInt.New([1,3,4])
2651 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2652 int tmpp1=-1,tmpp2=-1;
2653 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2654 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2658 else if(PyInt_Check(elt0))
2660 int nbOfTuples1=PyInt_AS_LONG(elt0);
2662 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2667 if(PyInt_Check(nbOfTuples))
2668 {//DataArrayInt.New(5,2)
2669 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2671 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2672 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2673 ret->alloc(nbOfTuples1,nbOfCompo);
2677 throw INTERP_KERNEL::Exception(msg.c_str());
2680 throw INTERP_KERNEL::Exception(msg.c_str());
2683 {//DataArrayInt.New(5)
2684 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2685 ret->alloc(nbOfTuples1,1);
2690 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2691 {//DataArrayInt.New(numpyArray)
2692 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2696 throw INTERP_KERNEL::Exception(msg.c_str());
2697 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2700 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2702 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2705 std::string __str__() const throw(INTERP_KERNEL::Exception)
2707 return self->repr();
2710 int __len__() const throw(INTERP_KERNEL::Exception)
2712 if(self->isAllocated())
2714 return self->getNumberOfTuples();
2718 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2722 int __int__() const throw(INTERP_KERNEL::Exception)
2724 return self->intValue();
2727 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2729 return self->iterator();
2732 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2734 int sz=self->getNumberOfComponents();
2735 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2736 self->accumulate(tmp);
2737 return convertIntArrToPyList(tmp,sz);
2740 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2743 std::vector<int> val2;
2744 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2745 return self->accumulatePerChunck(bg,bg+sz);
2748 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2751 std::vector<int> val2;
2752 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2753 return self->getIdsEqualTuple(bg,bg+sz);
2756 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2758 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2759 PyObject *ret=PyList_New(slcs.size());
2760 for(std::size_t i=0;i<slcs.size();i++)
2761 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2765 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2767 if(!PySlice_Check(slic))
2768 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2769 Py_ssize_t strt=2,stp=2,step=2;
2770 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2771 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2772 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2773 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 !");
2774 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2777 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2779 int newNbOfTuples=-1;
2780 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2781 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2782 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2783 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2784 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2785 PyObject *ret=PyTuple_New(2);
2786 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2787 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2791 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2793 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
2794 int szArr,sw,iTypppArr;
2795 std::vector<int> stdvecTyyppArr;
2796 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2797 int *pt(ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2798 ret->useArray(pt,true,ParaMEDMEM::C_DEALLOC,szArr,1);
2802 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2804 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 !";
2805 if(PyList_Check(li) || PyTuple_Check(li))
2809 if(PyInt_Check(nbOfTuples))
2811 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2813 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2816 if(PyInt_Check(nbOfComp))
2817 {//DataArrayInt.setValues([1,3,4,5],2,2)
2818 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2820 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2821 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2822 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2825 throw INTERP_KERNEL::Exception(msg);
2828 {//DataArrayInt.setValues([1,3,4],3)
2830 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2831 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2835 throw INTERP_KERNEL::Exception(msg);
2838 {// DataArrayInt.setValues([1,3,4])
2839 int tmpp1=-1,tmpp2=-1;
2840 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2841 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2845 throw INTERP_KERNEL::Exception(msg);
2848 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2850 const int *vals=self->getConstPointer();
2851 return convertIntArrToPyList(vals,self->getNbOfElems());
2855 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2857 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2861 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2864 bool ret0=self->isEqualIfNotWhy(other,ret1);
2865 PyObject *ret=PyTuple_New(2);
2866 PyObject *ret0Py=ret0?Py_True:Py_False;
2868 PyTuple_SetItem(ret,0,ret0Py);
2869 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2873 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2875 const int *vals=self->getConstPointer();
2876 int nbOfComp=self->getNumberOfComponents();
2877 int nbOfTuples=self->getNumberOfTuples();
2878 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2881 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2883 std::vector<const DataArrayInt *> groups;
2884 std::vector< std::vector<int> > fidsOfGroups;
2885 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2886 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2887 PyObject *ret = PyList_New(2);
2888 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2889 int sz=fidsOfGroups.size();
2890 PyObject *ret1 = PyList_New(sz);
2891 for(int i=0;i<sz;i++)
2892 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2893 PyList_SetItem(ret,1,ret1);
2897 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2900 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2901 if (!SWIG_IsOK(res1))
2904 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2905 self->transformWithIndArr(tmp,tmp+size);
2909 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2910 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2914 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2918 std::vector<int> multiVal;
2919 std::pair<int, std::pair<int,int> > slic;
2920 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2921 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2925 return self->getIdsEqualList(&singleVal,&singleVal+1);
2927 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2929 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2931 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2935 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2939 std::vector<int> multiVal;
2940 std::pair<int, std::pair<int,int> > slic;
2941 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2942 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2946 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2948 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2950 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2952 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2956 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2958 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2960 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2961 if (!SWIG_IsOK(res1))
2964 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2965 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2969 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2971 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2972 da2->checkAllocated();
2973 int size=self->getNumberOfTuples();
2974 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2976 PyObject *ret = PyList_New(3);
2977 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2978 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2979 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2983 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2986 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2987 if (!SWIG_IsOK(res1))
2990 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2991 return self->transformWithIndArrR(tmp,tmp+size);
2995 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2996 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3000 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3003 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3004 if (!SWIG_IsOK(res1))
3007 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3008 if(size!=self->getNumberOfTuples())
3010 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3012 return self->renumberAndReduce(tmp,newNbOfTuple);
3016 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3018 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3019 da2->checkAllocated();
3020 int size=self->getNumberOfTuples();
3021 if(size!=self->getNumberOfTuples())
3023 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3025 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3029 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3032 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3033 if (!SWIG_IsOK(res1))
3036 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3037 if(size!=self->getNumberOfTuples())
3039 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3041 return self->renumber(tmp);
3045 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3047 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3048 da2->checkAllocated();
3049 int size=self->getNumberOfTuples();
3050 if(size!=self->getNumberOfTuples())
3052 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3054 return self->renumber(da2->getConstPointer());
3058 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3061 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3062 if (!SWIG_IsOK(res1))
3065 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3066 if(size!=self->getNumberOfTuples())
3068 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3070 return self->renumberR(tmp);
3074 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3076 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3077 da2->checkAllocated();
3078 int size=self->getNumberOfTuples();
3079 if(size!=self->getNumberOfTuples())
3081 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3083 return self->renumberR(da2->getConstPointer());
3087 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3089 std::vector<int> tmp;
3090 convertPyToNewIntArr3(li,tmp);
3091 self->setSelectedComponents(a,tmp);
3094 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3096 int sz=self->getNumberOfComponents();
3097 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3098 self->getTuple(tupleId,tmp);
3099 return convertIntArrToPyList(tmp,sz);
3102 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3104 DataArrayInt *arr=0;
3105 DataArrayInt *arrI=0;
3106 self->changeSurjectiveFormat(targetNb,arr,arrI);
3107 PyObject *res = PyList_New(2);
3108 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3109 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3113 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3115 std::vector<const DataArrayInt *> tmp;
3116 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3117 return DataArrayInt::Meld(tmp);
3120 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3122 std::vector<const DataArrayInt *> tmp;
3123 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3124 return DataArrayInt::Aggregate(tmp);
3127 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3129 std::vector<const DataArrayInt *> tmp;
3130 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3131 return DataArrayInt::AggregateIndexes(tmp);
3134 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3136 std::vector<const DataArrayInt *> tmp;
3137 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3138 return DataArrayInt::BuildUnion(tmp);
3141 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3143 std::vector<const DataArrayInt *> tmp;
3144 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3145 return DataArrayInt::BuildIntersection(tmp);
3148 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3151 int r1=self->getMaxValue(tmp);
3152 PyObject *ret=PyTuple_New(2);
3153 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3154 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3158 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3161 int r1=self->getMinValue(tmp);
3162 PyObject *ret=PyTuple_New(2);
3163 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3164 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3168 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3170 int nbOfCompo=self->getNumberOfComponents();
3175 if(PyInt_Check(obj))
3177 int val=(int)PyInt_AS_LONG(obj);
3178 return self->locateValue(val);
3181 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3185 std::vector<int> arr;
3186 convertPyToNewIntArr3(obj,arr);
3187 return self->locateTuple(arr);
3192 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3194 int nbOfCompo=self->getNumberOfComponents();
3201 if(PyInt_Check(obj))
3203 int val=(int)PyInt_AS_LONG(obj);
3204 return self->presenceOfValue(val);
3207 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3211 std::vector<int> arr;
3212 convertPyToNewIntArr3(obj,arr);
3213 return self->presenceOfTuple(arr);
3218 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3220 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3221 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3222 self->checkAllocated();
3223 int nbOfTuples=self->getNumberOfTuples();
3224 int nbOfComponents=self->getNumberOfComponents();
3226 std::vector<int> vt1,vc1;
3227 std::pair<int, std::pair<int,int> > pt1,pc1;
3228 DataArrayInt *dt1=0,*dc1=0;
3230 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3231 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3236 if(nbOfComponents==1)
3237 return PyInt_FromLong(self->getIJSafe(it1,0));
3238 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3241 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3243 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3245 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3247 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3250 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3251 std::vector<int> v2(1,ic1);
3252 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3256 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
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->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
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(&it1,&it1+1);
3269 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3273 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3274 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3278 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3279 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3283 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3284 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3288 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3289 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3290 std::vector<int> v2(nbOfComp);
3291 for(int i=0;i<nbOfComp;i++)
3292 v2[i]=pc1.first+i*pc1.second.second;
3293 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3297 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3298 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3299 std::vector<int> v2(nbOfComp);
3300 for(int i=0;i<nbOfComp;i++)
3301 v2[i]=pc1.first+i*pc1.second.second;
3302 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3306 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3307 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3308 std::vector<int> v2(nbOfComp);
3309 for(int i=0;i<nbOfComp;i++)
3310 v2[i]=pc1.first+i*pc1.second.second;
3311 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3315 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3316 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3317 std::vector<int> v2(nbOfComp);
3318 for(int i=0;i<nbOfComp;i++)
3319 v2[i]=pc1.first+i*pc1.second.second;
3320 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3323 throw INTERP_KERNEL::Exception(msg);
3327 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3329 self->checkAllocated();
3330 const char msg[]="Unexpected situation in __setitem__ !";
3331 int nbOfTuples=self->getNumberOfTuples();
3332 int nbOfComponents=self->getNumberOfComponents();
3335 std::vector<int> v1;
3337 DataArrayIntTuple *dd1=0;
3338 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3340 std::vector<int> vt1,vc1;
3341 std::pair<int, std::pair<int,int> > pt1,pc1;
3342 DataArrayInt *dt1=0,*dc1=0;
3343 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3344 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3352 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3355 tmp=DataArrayInt::New();
3356 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3357 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3360 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3363 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3364 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3367 throw INTERP_KERNEL::Exception(msg);
3376 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3379 tmp=DataArrayInt::New();
3380 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3381 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3384 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3387 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3388 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3391 throw INTERP_KERNEL::Exception(msg);
3400 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3403 tmp=DataArrayInt::New();
3404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3405 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3408 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3411 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3412 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3415 throw INTERP_KERNEL::Exception(msg);
3424 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3427 tmp=DataArrayInt::New();
3428 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3429 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3432 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3435 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3436 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3439 throw INTERP_KERNEL::Exception(msg);
3448 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3451 tmp=DataArrayInt::New();
3452 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3453 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3456 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3459 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3460 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3463 throw INTERP_KERNEL::Exception(msg);
3472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3475 tmp=DataArrayInt::New();
3476 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3477 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3480 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3483 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3484 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3487 throw INTERP_KERNEL::Exception(msg);
3496 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3499 tmp=DataArrayInt::New();
3500 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3501 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3504 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3507 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3508 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3511 throw INTERP_KERNEL::Exception(msg);
3520 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3523 tmp=DataArrayInt::New();
3524 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3525 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3528 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3531 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3532 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3535 throw INTERP_KERNEL::Exception(msg);
3544 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3547 tmp=DataArrayInt::New();
3548 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3549 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3552 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3555 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3556 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3559 throw INTERP_KERNEL::Exception(msg);
3568 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3571 tmp=DataArrayInt::New();
3572 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3573 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3576 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3579 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3580 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3583 throw INTERP_KERNEL::Exception(msg);
3592 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3595 tmp=DataArrayInt::New();
3596 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3597 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3600 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3603 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3604 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3607 throw INTERP_KERNEL::Exception(msg);
3616 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3619 tmp=DataArrayInt::New();
3620 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3621 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3624 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3627 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3628 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3631 throw INTERP_KERNEL::Exception(msg);
3640 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3643 tmp=DataArrayInt::New();
3644 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3645 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3648 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3651 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3652 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3655 throw INTERP_KERNEL::Exception(msg);
3664 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3667 tmp=DataArrayInt::New();
3668 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3669 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3672 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3675 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3676 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3679 throw INTERP_KERNEL::Exception(msg);
3688 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3691 tmp=DataArrayInt::New();
3692 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3693 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3696 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3699 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3700 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3703 throw INTERP_KERNEL::Exception(msg);
3712 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3715 tmp=DataArrayInt::New();
3716 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3717 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3720 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3723 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3724 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3727 throw INTERP_KERNEL::Exception(msg);
3732 throw INTERP_KERNEL::Exception(msg);
3737 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3739 return self->negate();
3742 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3744 const char msg[]="Unexpected situation in __add__ !";
3747 std::vector<int> aa;
3748 DataArrayIntTuple *aaa;
3750 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3755 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3756 ret->applyLin(1,val);
3761 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3762 return DataArrayInt::Add(self,aaaa);
3766 return DataArrayInt::Add(self,a);
3770 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3771 return DataArrayInt::Add(self,aaaa);
3774 throw INTERP_KERNEL::Exception(msg);
3778 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3780 const char msg[]="Unexpected situation in __radd__ !";
3783 std::vector<int> aa;
3784 DataArrayIntTuple *aaa;
3786 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3791 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3792 ret->applyLin(1,val);
3797 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3798 return DataArrayInt::Add(self,aaaa);
3802 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3803 return DataArrayInt::Add(self,aaaa);
3806 throw INTERP_KERNEL::Exception(msg);
3810 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3812 const char msg[]="Unexpected situation in __iadd__ !";
3815 std::vector<int> aa;
3816 DataArrayIntTuple *aaa;
3818 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3823 self->applyLin(1,val);
3824 Py_XINCREF(trueSelf);
3829 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3831 Py_XINCREF(trueSelf);
3837 Py_XINCREF(trueSelf);
3842 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3843 self->addEqual(aaaa);
3844 Py_XINCREF(trueSelf);
3848 throw INTERP_KERNEL::Exception(msg);
3852 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3854 const char msg[]="Unexpected situation in __sub__ !";
3857 std::vector<int> aa;
3858 DataArrayIntTuple *aaa;
3860 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3865 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3866 ret->applyLin(1,-val);
3871 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3872 return DataArrayInt::Substract(self,aaaa);
3876 return DataArrayInt::Substract(self,a);
3880 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3881 return DataArrayInt::Substract(self,aaaa);
3884 throw INTERP_KERNEL::Exception(msg);
3888 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3890 const char msg[]="Unexpected situation in __rsub__ !";
3893 std::vector<int> aa;
3894 DataArrayIntTuple *aaa;
3896 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3901 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3902 ret->applyLin(-1,val);
3907 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3908 return DataArrayInt::Substract(aaaa,self);
3912 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3913 return DataArrayInt::Substract(aaaa,self);
3916 throw INTERP_KERNEL::Exception(msg);
3920 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3922 const char msg[]="Unexpected situation in __isub__ !";
3925 std::vector<int> aa;
3926 DataArrayIntTuple *aaa;
3928 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3933 self->applyLin(1,-val);
3934 Py_XINCREF(trueSelf);
3939 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3940 self->substractEqual(bb);
3941 Py_XINCREF(trueSelf);
3946 self->substractEqual(a);
3947 Py_XINCREF(trueSelf);
3952 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3953 self->substractEqual(aaaa);
3954 Py_XINCREF(trueSelf);
3958 throw INTERP_KERNEL::Exception(msg);
3962 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3964 const char msg[]="Unexpected situation in __mul__ !";
3967 std::vector<int> aa;
3968 DataArrayIntTuple *aaa;
3970 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3975 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3976 ret->applyLin(val,0);
3981 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3982 return DataArrayInt::Multiply(self,aaaa);
3986 return DataArrayInt::Multiply(self,a);
3990 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3991 return DataArrayInt::Multiply(self,aaaa);
3994 throw INTERP_KERNEL::Exception(msg);
3998 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4000 const char msg[]="Unexpected situation in __rmul__ !";
4003 std::vector<int> aa;
4004 DataArrayIntTuple *aaa;
4006 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4011 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4012 ret->applyLin(val,0);
4017 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4018 return DataArrayInt::Multiply(self,aaaa);
4022 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4023 return DataArrayInt::Multiply(self,aaaa);
4026 throw INTERP_KERNEL::Exception(msg);
4030 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4032 const char msg[]="Unexpected situation in __imul__ !";
4035 std::vector<int> aa;
4036 DataArrayIntTuple *aaa;
4038 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4043 self->applyLin(val,0);
4044 Py_XINCREF(trueSelf);
4049 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4050 self->multiplyEqual(bb);
4051 Py_XINCREF(trueSelf);
4056 self->multiplyEqual(a);
4057 Py_XINCREF(trueSelf);
4062 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4063 self->multiplyEqual(aaaa);
4064 Py_XINCREF(trueSelf);
4068 throw INTERP_KERNEL::Exception(msg);
4072 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4074 const char msg[]="Unexpected situation in __div__ !";
4077 std::vector<int> aa;
4078 DataArrayIntTuple *aaa;
4080 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4085 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4086 ret->applyDivideBy(val);
4091 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4092 return DataArrayInt::Divide(self,aaaa);
4096 return DataArrayInt::Divide(self,a);
4100 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4101 return DataArrayInt::Divide(self,aaaa);
4104 throw INTERP_KERNEL::Exception(msg);
4108 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4110 const char msg[]="Unexpected situation in __rdiv__ !";
4113 std::vector<int> aa;
4114 DataArrayIntTuple *aaa;
4116 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4121 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4127 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4128 return DataArrayInt::Divide(aaaa,self);
4132 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4133 return DataArrayInt::Divide(aaaa,self);
4136 throw INTERP_KERNEL::Exception(msg);
4140 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4142 const char msg[]="Unexpected situation in __idiv__ !";
4145 std::vector<int> aa;
4146 DataArrayIntTuple *aaa;
4148 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4153 self->applyDivideBy(val);
4154 Py_XINCREF(trueSelf);
4159 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4160 self->divideEqual(bb);
4161 Py_XINCREF(trueSelf);
4166 self->divideEqual(a);
4167 Py_XINCREF(trueSelf);
4172 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4173 self->divideEqual(aaaa);
4174 Py_XINCREF(trueSelf);
4178 throw INTERP_KERNEL::Exception(msg);
4182 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4184 const char msg[]="Unexpected situation in __mod__ !";
4187 std::vector<int> aa;
4188 DataArrayIntTuple *aaa;
4190 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4195 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4196 ret->applyModulus(val);
4201 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4202 return DataArrayInt::Modulus(self,aaaa);
4206 return DataArrayInt::Modulus(self,a);
4210 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4211 return DataArrayInt::Modulus(self,aaaa);
4214 throw INTERP_KERNEL::Exception(msg);
4218 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4220 const char msg[]="Unexpected situation in __rmod__ !";
4223 std::vector<int> aa;
4224 DataArrayIntTuple *aaa;
4226 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4231 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4232 ret->applyRModulus(val);
4237 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4238 return DataArrayInt::Modulus(aaaa,self);
4242 return DataArrayInt::Modulus(a,self);
4246 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4247 return DataArrayInt::Modulus(aaaa,self);
4250 throw INTERP_KERNEL::Exception(msg);
4254 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4256 const char msg[]="Unexpected situation in __imod__ !";
4259 std::vector<int> aa;
4260 DataArrayIntTuple *aaa;
4262 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4267 self->applyModulus(val);
4268 Py_XINCREF(trueSelf);
4273 self->modulusEqual(a);
4274 Py_XINCREF(trueSelf);
4279 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4280 self->modulusEqual(aaaa);
4281 Py_XINCREF(trueSelf);
4285 throw INTERP_KERNEL::Exception(msg);
4289 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4291 const char msg[]="Unexpected situation in __pow__ !";
4294 std::vector<int> aa;
4295 DataArrayIntTuple *aaa;
4297 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4302 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4308 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4309 return DataArrayInt::Pow(self,aaaa);
4313 return DataArrayInt::Pow(self,a);
4317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4318 return DataArrayInt::Pow(self,aaaa);
4321 throw INTERP_KERNEL::Exception(msg);
4325 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4327 const char msg[]="Unexpected situation in __rpow__ !";
4330 std::vector<int> aa;
4331 DataArrayIntTuple *aaa;
4333 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4338 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4339 ret->applyRPow(val);
4344 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4345 return DataArrayInt::Pow(aaaa,self);
4349 return DataArrayInt::Pow(a,self);
4353 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4354 return DataArrayInt::Pow(aaaa,self);
4357 throw INTERP_KERNEL::Exception(msg);
4361 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4363 const char msg[]="Unexpected situation in __ipow__ !";
4366 std::vector<int> aa;
4367 DataArrayIntTuple *aaa;
4369 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4374 self->applyPow(val);
4375 Py_XINCREF(trueSelf);
4381 Py_XINCREF(trueSelf);
4386 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4387 self->powEqual(aaaa);
4388 Py_XINCREF(trueSelf);
4392 throw INTERP_KERNEL::Exception(msg);
4396 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4398 std::ostringstream oss;
4399 self->reprQuickOverview(oss);
4403 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4405 int szArr,sw,iTypppArr;
4406 std::vector<int> stdvecTyyppArr;
4407 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4408 self->pushBackValsSilent(tmp,tmp+szArr);
4411 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4413 std::vector<int> ret1;
4414 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4415 std::size_t sz=ret0.size();
4416 PyObject *pyRet=PyTuple_New(2);
4417 PyObject *pyRet0=PyList_New((int)sz);
4418 PyObject *pyRet1=PyList_New((int)sz);
4419 for(std::size_t i=0;i<sz;i++)
4421 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4422 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4424 PyTuple_SetItem(pyRet,0,pyRet0);
4425 PyTuple_SetItem(pyRet,1,pyRet1);
4429 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4431 DataArrayInt *ret0=0,*ret1=0;
4432 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4433 PyObject *pyRet=PyTuple_New(2);
4434 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4435 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4441 class DataArrayIntTuple;
4443 class DataArrayIntIterator
4446 DataArrayIntIterator(DataArrayInt *da);
4447 ~DataArrayIntIterator();
4452 DataArrayIntTuple *ret=self->nextt();
4454 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4457 PyErr_SetString(PyExc_StopIteration,"No more data.");
4464 class DataArrayIntTuple
4467 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4468 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4471 std::string __str__() const throw(INTERP_KERNEL::Exception)
4473 return self->repr();
4476 int __int__() const throw(INTERP_KERNEL::Exception)
4478 return self->intValue();
4481 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4483 return self->buildDAInt(1,self->getNumberOfCompo());
4486 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4488 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4489 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4490 Py_XINCREF(trueSelf);
4494 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4496 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4497 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4498 Py_XINCREF(trueSelf);
4502 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4504 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4505 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4506 Py_XINCREF(trueSelf);
4510 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4512 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4513 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4514 Py_XINCREF(trueSelf);
4518 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4520 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4521 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4522 Py_XINCREF(trueSelf);
4526 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4528 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4531 std::vector<int> multiVal;
4532 std::pair<int, std::pair<int,int> > slic;
4533 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4534 const int *pt=self->getConstPointer();
4535 int nbc=self->getNumberOfCompo();
4536 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4543 std::ostringstream oss;
4544 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4545 throw INTERP_KERNEL::Exception(oss.str().c_str());
4548 return PyInt_FromLong(pt[singleVal]);
4552 return PyInt_FromLong(pt[nbc+singleVal]);
4555 std::ostringstream oss;
4556 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4557 throw INTERP_KERNEL::Exception(oss.str().c_str());
4563 PyObject *t=PyTuple_New(multiVal.size());
4564 for(int j=0;j<(int)multiVal.size();j++)
4566 int cid=multiVal[j];
4569 std::ostringstream oss;
4570 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4571 throw INTERP_KERNEL::Exception(oss.str().c_str());
4573 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4579 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4580 PyObject *t=PyTuple_New(sz);
4581 for(int j=0;j<sz;j++)
4582 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4586 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4590 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4592 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4593 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4596 std::vector<int> multiValV;
4597 std::pair<int, std::pair<int,int> > slicV;
4598 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4599 int nbc=self->getNumberOfCompo();
4600 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4602 std::vector<int> multiVal;
4603 std::pair<int, std::pair<int,int> > slic;
4604 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4605 int *pt=self->getPointer();
4606 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4613 std::ostringstream oss;
4614 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4615 throw INTERP_KERNEL::Exception(oss.str().c_str());
4621 pt[singleVal]=singleValV;
4626 if(multiValV.size()!=1)
4628 std::ostringstream oss;
4629 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4630 throw INTERP_KERNEL::Exception(oss.str().c_str());
4632 pt[singleVal]=multiValV[0];
4637 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4641 throw INTERP_KERNEL::Exception(msg);
4650 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4654 std::ostringstream oss;
4655 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4656 throw INTERP_KERNEL::Exception(oss.str().c_str());
4664 if(multiVal.size()!=multiValV.size())
4666 std::ostringstream oss;
4667 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4668 throw INTERP_KERNEL::Exception(oss.str().c_str());
4670 for(int i=0;i<(int)multiVal.size();i++)
4672 int pos=multiVal[i];
4675 std::ostringstream oss;
4676 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4677 throw INTERP_KERNEL::Exception(oss.str().c_str());
4679 pt[multiVal[i]]=multiValV[i];
4685 const int *ptV=daIntTyyppV->getConstPointer();
4686 if(nbc>daIntTyyppV->getNumberOfCompo())
4688 std::ostringstream oss;
4689 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4690 throw INTERP_KERNEL::Exception(oss.str().c_str());
4692 std::copy(ptV,ptV+nbc,pt);
4696 throw INTERP_KERNEL::Exception(msg);
4701 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4706 for(int j=0;j<sz;j++)
4707 pt[slic.first+j*slic.second.second]=singleValV;
4712 if(sz!=(int)multiValV.size())
4714 std::ostringstream oss;
4715 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4716 throw INTERP_KERNEL::Exception(oss.str().c_str());
4718 for(int j=0;j<sz;j++)
4719 pt[slic.first+j*slic.second.second]=multiValV[j];
4724 const int *ptV=daIntTyyppV->getConstPointer();
4725 if(sz>daIntTyyppV->getNumberOfCompo())
4727 std::ostringstream oss;
4728 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4729 throw INTERP_KERNEL::Exception(oss.str().c_str());
4731 for(int j=0;j<sz;j++)
4732 pt[slic.first+j*slic.second.second]=ptV[j];
4736 throw INTERP_KERNEL::Exception(msg);
4740 throw INTERP_KERNEL::Exception(msg);
4746 class DataArrayChar : public DataArray
4749 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4750 int getHashCode() const throw(INTERP_KERNEL::Exception);
4751 bool empty() const throw(INTERP_KERNEL::Exception);
4752 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4753 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4754 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4755 char popBackSilent() throw(INTERP_KERNEL::Exception);
4756 void pack() const throw(INTERP_KERNEL::Exception);
4757 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4758 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4759 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4760 void reverse() throw(INTERP_KERNEL::Exception);
4761 void fillWithZero() throw(INTERP_KERNEL::Exception);
4762 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4763 std::string repr() const throw(INTERP_KERNEL::Exception);
4764 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4765 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4766 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4767 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4768 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4769 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4770 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4771 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4772 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4773 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4774 char front() const throw(INTERP_KERNEL::Exception);
4775 char back() const throw(INTERP_KERNEL::Exception);
4776 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4777 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4778 char *getPointer() throw(INTERP_KERNEL::Exception);
4779 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4780 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4781 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4782 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4783 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4784 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4785 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4786 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4787 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4788 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4789 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4792 int __len__() const throw(INTERP_KERNEL::Exception)
4794 if(self->isAllocated())
4796 return self->getNumberOfTuples();
4800 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4804 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4807 bool ret0=self->isEqualIfNotWhy(other,ret1);
4808 PyObject *ret=PyTuple_New(2);
4809 PyObject *ret0Py=ret0?Py_True:Py_False;
4811 PyTuple_SetItem(ret,0,ret0Py);
4812 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4816 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4819 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4820 if (!SWIG_IsOK(res1))
4823 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4824 if(size!=self->getNumberOfTuples())
4826 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4828 return self->renumber(tmp);
4832 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4834 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4835 da2->checkAllocated();
4836 int size=self->getNumberOfTuples();
4837 if(size!=self->getNumberOfTuples())
4839 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4841 return self->renumber(da2->getConstPointer());
4845 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4848 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4849 if (!SWIG_IsOK(res1))
4852 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4853 if(size!=self->getNumberOfTuples())
4855 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4857 return self->renumberR(tmp);
4861 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4863 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4864 da2->checkAllocated();
4865 int size=self->getNumberOfTuples();
4866 if(size!=self->getNumberOfTuples())
4868 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4870 return self->renumberR(da2->getConstPointer());
4874 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4877 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4878 if (!SWIG_IsOK(res1))
4881 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4882 if(size!=self->getNumberOfTuples())
4884 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4886 return self->renumberAndReduce(tmp,newNbOfTuple);
4890 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4892 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4893 da2->checkAllocated();
4894 int size=self->getNumberOfTuples();
4895 if(size!=self->getNumberOfTuples())
4897 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4899 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4903 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4905 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4906 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4907 return DataArrayChar::Aggregate(tmp);
4910 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4912 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4913 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4914 return DataArrayChar::Meld(tmp);
4919 class DataArrayByteIterator;
4921 class DataArrayByte : public DataArrayChar
4924 static DataArrayByte *New();
4925 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4926 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4927 char byteValue() const throw(INTERP_KERNEL::Exception);
4930 DataArrayByte() throw(INTERP_KERNEL::Exception)
4932 return DataArrayByte::New();
4935 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4937 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) !";
4938 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4942 if(PyInt_Check(nbOfTuples))
4944 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4946 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4949 if(PyInt_Check(nbOfComp))
4950 {//DataArrayByte.New([1,3,4,5],2,2)
4951 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4953 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4954 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4955 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4956 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4960 throw INTERP_KERNEL::Exception(msg);
4963 {//DataArrayByte.New([1,3,4],3)
4964 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4966 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4967 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4972 throw INTERP_KERNEL::Exception(msg);
4975 {// DataArrayByte.New([1,3,4])
4976 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4977 int tmpp1=-1,tmpp2=-1;
4978 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4979 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4983 else if(PyInt_Check(elt0))
4985 int nbOfTuples1=PyInt_AS_LONG(elt0);
4987 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4992 if(PyInt_Check(nbOfTuples))
4993 {//DataArrayByte.New(5,2)
4994 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4996 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4997 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4998 ret->alloc(nbOfTuples1,nbOfCompo);
5002 throw INTERP_KERNEL::Exception(msg);
5005 throw INTERP_KERNEL::Exception(msg);
5008 {//DataArrayByte.New(5)
5009 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5010 ret->alloc(nbOfTuples1,1);
5015 throw INTERP_KERNEL::Exception(msg);
5018 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5020 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5023 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5025 std::ostringstream oss;
5026 self->reprQuickOverview(oss);
5030 int __int__() const throw(INTERP_KERNEL::Exception)
5032 return (int) self->byteValue();
5035 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5037 return self->iterator();
5040 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5042 return (int)self->getIJ(tupleId,compoId);
5045 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5047 return (int)self->getIJSafe(tupleId,compoId);
5050 std::string __str__() const throw(INTERP_KERNEL::Exception)
5052 return self->repr();
5055 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5057 const char *vals=self->getConstPointer();
5058 int nbOfComp=self->getNumberOfComponents();
5059 int nbOfTuples=self->getNumberOfTuples();
5060 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5063 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5066 int ival=-1; std::vector<int> ivval;
5067 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5068 std::vector<char> vals(sz);
5069 std::copy(pt,pt+sz,vals.begin());
5070 return self->presenceOfTuple(vals);
5073 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5076 int ival=-1; std::vector<int> ivval;
5077 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5078 std::vector<char> vals2(sz);
5079 std::copy(pt,pt+sz,vals2.begin());
5080 return self->presenceOfValue(vals2);
5083 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5086 int ival=-1; std::vector<int> ivval;
5087 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5088 std::vector<char> vals2(sz);
5089 std::copy(pt,pt+sz,vals2.begin());
5090 return self->locateValue(vals2);
5093 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5096 int ival=-1; std::vector<int> ivval;
5097 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5098 std::vector<char> vals(sz);
5099 std::copy(pt,pt+sz,vals.begin());
5100 return self->locateTuple(vals);
5103 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5106 int ival=-1; std::vector<int> ivval;
5107 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5108 std::vector<char> vals(sz);
5109 std::copy(pt,pt+sz,vals.begin());
5110 return self->search(vals);
5113 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5115 int sz=self->getNumberOfComponents();
5116 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5117 self->getTuple(tupleId,tmp);
5118 PyObject *ret=PyTuple_New(sz);
5119 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5123 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5126 int r1=(int)self->getMaxValue(tmp);
5127 PyObject *ret=PyTuple_New(2);
5128 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5129 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5133 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5136 int r1=(int)self->getMinValue(tmp);
5137 PyObject *ret=PyTuple_New(2);
5138 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5139 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5143 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5145 int nbOfCompo=self->getNumberOfComponents();
5150 if(PyInt_Check(obj))
5152 int val=(int)PyInt_AS_LONG(obj);
5153 return self->locateValue(val);
5156 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5159 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5163 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5165 int nbOfCompo=self->getNumberOfComponents();
5172 if(PyInt_Check(obj))
5174 int val=(int)PyInt_AS_LONG(obj);
5175 return self->presenceOfValue(val);
5178 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5181 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5187 class DataArrayByteTuple;
5189 class DataArrayByteIterator
5192 DataArrayByteIterator(DataArrayByte *da);
5193 ~DataArrayByteIterator();
5196 class DataArrayByteTuple
5199 std::string repr() const throw(INTERP_KERNEL::Exception);
5200 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5203 std::string __str__() const throw(INTERP_KERNEL::Exception)
5205 return self->repr();
5208 char __int__() const throw(INTERP_KERNEL::Exception)
5210 return self->byteValue();
5213 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5215 return self->buildDAByte(1,self->getNumberOfCompo());
5220 class DataArrayAsciiCharIterator;
5222 class DataArrayAsciiChar : public DataArrayChar
5225 static DataArrayAsciiChar *New();
5226 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5227 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5228 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5231 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5233 return DataArrayAsciiChar::New();
5236 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5238 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) !";
5239 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5243 if(PyInt_Check(nbOfTuples))
5245 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5247 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5250 if(PyInt_Check(nbOfComp))
5251 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5252 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5254 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5255 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5256 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5257 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5261 throw INTERP_KERNEL::Exception(msg);
5264 {//DataArrayAsciiChar.New([1,3,4],3)
5265 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5267 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5268 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5272 else if(PyString_Check(nbOfTuples))
5274 if(PyString_Size(nbOfTuples)!=1)
5275 throw INTERP_KERNEL::Exception(msg);
5276 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5277 std::vector<std::string> tmp;
5278 if(fillStringVector(elt0,tmp))
5279 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5281 throw INTERP_KERNEL::Exception(msg);
5284 throw INTERP_KERNEL::Exception(msg);
5288 std::vector<std::string> tmmp;
5289 if(fillStringVector(elt0,tmmp))
5290 //DataArrayAsciiChar.New(["abc","de","fghi"])
5291 return DataArrayAsciiChar::New(tmmp,' ');
5294 // DataArrayAsciiChar.New([1,3,4])
5295 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5296 int tmpp1=-1,tmpp2=-1;
5297 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5298 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5303 else if(PyInt_Check(elt0))
5305 int nbOfTuples1=PyInt_AS_LONG(elt0);
5307 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5312 if(PyInt_Check(nbOfTuples))
5313 {//DataArrayAsciiChar.New(5,2)
5314 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5316 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5317 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5318 ret->alloc(nbOfTuples1,nbOfCompo);
5322 throw INTERP_KERNEL::Exception(msg);
5325 throw INTERP_KERNEL::Exception(msg);
5328 {//DataArrayAsciiChar.New(5)
5329 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5330 ret->alloc(nbOfTuples1,1);
5335 throw INTERP_KERNEL::Exception(msg);
5338 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5340 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5343 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5345 std::ostringstream oss;
5346 self->reprQuickOverview(oss);
5350 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5352 return self->iterator();
5355 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5357 char tmp[2]; tmp[1]='\0';
5358 tmp[0]=self->getIJ(tupleId,compoId);
5359 return std::string(tmp);
5362 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5364 char tmp[2]; tmp[1]='\0';
5365 tmp[0]=self->getIJSafe(tupleId,compoId);
5366 return std::string(tmp);
5369 std::string __str__() const throw(INTERP_KERNEL::Exception)
5371 return self->repr();
5374 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5376 const char *vals=self->getConstPointer();
5377 int nbOfComp=self->getNumberOfComponents();
5378 int nbOfTuples=self->getNumberOfTuples();
5379 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5382 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5384 if(PyString_Check(tupl))
5386 Py_ssize_t sz=PyString_Size(tupl);
5387 std::vector<char> vals(sz);
5388 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5389 return self->presenceOfTuple(vals);
5392 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5395 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5397 if(PyString_Check(vals))
5399 Py_ssize_t sz=PyString_Size(vals);
5400 std::vector<char> vals2(sz);
5401 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5402 return self->presenceOfValue(vals2);
5405 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5408 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5410 if(PyString_Check(vals))
5412 Py_ssize_t sz=PyString_Size(vals);
5413 std::vector<char> vals2(sz);
5414 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5415 return self->locateValue(vals2);
5418 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5421 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5423 if(PyString_Check(tupl))
5425 Py_ssize_t sz=PyString_Size(tupl);
5426 std::vector<char> vals(sz);
5427 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5428 return self->locateTuple(vals);
5431 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5434 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5436 if(PyString_Check(strOrListOfInt))
5438 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5439 std::vector<char> vals(sz);
5440 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5441 return self->search(vals);
5444 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5447 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5449 int sz=self->getNumberOfComponents();
5450 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5451 self->getTuple(tupleId,tmp);
5452 return PyString_FromString(tmp);
5455 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5458 char tmp2[2]; tmp2[1]='\0';
5459 tmp2[0]=self->getMaxValue(tmp);
5460 PyObject *ret=PyTuple_New(2);
5461 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5462 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5466 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5469 char tmp2[2]; tmp2[1]='\0';
5470 tmp2[0]=self->getMinValue(tmp);
5471 PyObject *ret=PyTuple_New(2);
5472 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5473 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5477 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5479 int nbOfCompo=self->getNumberOfComponents();
5484 if(PyString_Check(obj))
5486 Py_ssize_t sz=PyString_Size(obj);
5487 char *pt=PyString_AsString(obj);
5489 return self->locateValue(pt[0]);
5491 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5494 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5497 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5501 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5503 int nbOfCompo=self->getNumberOfComponents();
5510 if(PyString_Check(obj))
5512 Py_ssize_t sz=PyString_Size(obj);
5513 char *pt=PyString_AsString(obj);
5515 return self->presenceOfValue(pt[0]);
5517 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5520 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5523 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5527 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5530 std::vector<int> stdvecTyyppArr;
5531 std::pair<int, std::pair<int,int> > sTyyppArr;
5532 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5533 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5537 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5539 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5541 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5543 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5545 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5549 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5551 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.";
5553 std::vector<int> stdvecTyyppArr;
5554 std::pair<int, std::pair<int,int> > sTyyppArr;
5555 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5556 int nbOfCompo=self->getNumberOfComponents();
5557 int nbOfTuples=self->getNumberOfTuples();
5558 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5560 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5561 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5570 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5576 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5577 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5580 //value vector<string>
5583 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5584 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5587 //value DataArrayChar
5590 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5594 throw INTERP_KERNEL::Exception(msg);
5598 {//obj list-tuple[int]
5604 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5610 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5611 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5614 //value vector<string>
5617 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5618 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5621 //value DataArrayChar
5624 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5628 throw INTERP_KERNEL::Exception(msg);
5639 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5645 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5646 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5649 //value vector<string>
5652 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5653 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5656 //value DataArrayChar
5659 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5663 throw INTERP_KERNEL::Exception(msg);
5674 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5680 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5681 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5684 //value vector<string>
5687 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5688 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5691 //value DataArrayChar
5694 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5698 throw INTERP_KERNEL::Exception(msg);
5703 throw INTERP_KERNEL::Exception(msg);
5709 class DataArrayAsciiCharTuple;
5711 class DataArrayAsciiCharIterator
5714 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5715 ~DataArrayAsciiCharIterator();
5720 DataArrayAsciiCharTuple *ret=self->nextt();
5722 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5725 PyErr_SetString(PyExc_StopIteration,"No more data.");
5732 class DataArrayAsciiCharTuple
5735 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5736 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5739 std::string __str__() const throw(INTERP_KERNEL::Exception)
5741 return self->repr();
5744 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5746 return self->buildDAAsciiChar(1,self->getNumberOfCompo());