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::__neg__;
106 %newobject ParaMEDMEM::DataArrayInt::__add__;
107 %newobject ParaMEDMEM::DataArrayInt::__radd__;
108 %newobject ParaMEDMEM::DataArrayInt::__sub__;
109 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
110 %newobject ParaMEDMEM::DataArrayInt::__mul__;
111 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
112 %newobject ParaMEDMEM::DataArrayInt::__div__;
113 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
114 %newobject ParaMEDMEM::DataArrayInt::__mod__;
115 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
116 %newobject ParaMEDMEM::DataArrayInt::__pow__;
117 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
118 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
119 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
120 %newobject ParaMEDMEM::DataArrayChar::renumber;
121 %newobject ParaMEDMEM::DataArrayChar::renumberR;
122 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
123 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
124 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
125 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
126 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
127 %newobject ParaMEDMEM::DataArrayChar::Meld;
128 %newobject ParaMEDMEM::DataArrayByte::New;
129 %newobject ParaMEDMEM::DataArrayByte::__iter__;
130 %newobject ParaMEDMEM::DataArrayByte::performCpy;
131 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
132 %newobject ParaMEDMEM::DataArrayChar::substr;
133 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
134 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
135 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
136 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
137 %newobject ParaMEDMEM::DataArrayDouble::New;
138 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
139 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
140 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
141 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
142 %newobject ParaMEDMEM::DataArrayDouble::Meld;
143 %newobject ParaMEDMEM::DataArrayDouble::Dot;
144 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
145 %newobject ParaMEDMEM::DataArrayDouble::Add;
146 %newobject ParaMEDMEM::DataArrayDouble::Substract;
147 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
148 %newobject ParaMEDMEM::DataArrayDouble::Divide;
149 %newobject ParaMEDMEM::DataArrayDouble::Pow;
150 %newobject ParaMEDMEM::DataArrayDouble::substr;
151 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
152 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
153 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
154 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
155 %newobject ParaMEDMEM::DataArrayDouble::negate;
156 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
157 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
158 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
159 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
160 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
161 %newobject ParaMEDMEM::DataArrayDouble::determinant;
162 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
163 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
164 %newobject ParaMEDMEM::DataArrayDouble::inverse;
165 %newobject ParaMEDMEM::DataArrayDouble::trace;
166 %newobject ParaMEDMEM::DataArrayDouble::deviator;
167 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
168 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
169 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
170 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
171 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
172 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
173 %newobject ParaMEDMEM::DataArrayDouble::renumber;
174 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
175 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
176 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
177 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
178 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
179 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
180 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
181 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
182 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
183 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
184 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
185 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
186 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
187 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
188 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
189 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
190 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
191 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
192 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
194 %feature("unref") DataArray "$this->decrRef();"
195 %feature("unref") DataArrayDouble "$this->decrRef();"
196 %feature("unref") DataArrayInt "$this->decrRef();"
197 %feature("unref") DataArrayChar "$this->decrRef();"
198 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
199 %feature("unref") DataArrayByte "$this->decrRef();"
203 class DataArray : public RefCountObject, public TimeLabel
206 void setName(const std::string& name);
207 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
208 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
209 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
210 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
211 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
212 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
213 std::string getName() const;
214 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
215 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
216 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
217 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
218 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
219 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
220 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
221 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
222 int getNumberOfComponents() const;
223 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
224 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
225 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
226 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
227 virtual void desallocate() throw(INTERP_KERNEL::Exception);
228 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
229 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
230 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
231 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
232 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
233 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
234 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
235 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
236 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
237 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
238 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
239 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
240 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
241 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
242 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
243 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
244 void updateTime() const;
247 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
249 const std::vector<std::string>& comps=self->getInfoOnComponents();
250 PyObject *ret=PyList_New((int)comps.size());
251 for(int i=0;i<(int)comps.size();i++)
252 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
256 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
258 std::vector<int> tmp;
259 convertPyToNewIntArr3(li,tmp);
260 self->copyPartOfStringInfoFrom(other,tmp);
263 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
265 std::vector<int> tmp;
266 convertPyToNewIntArr3(li,tmp);
267 self->copyPartOfStringInfoFrom2(tmp,other);
270 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
273 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
274 if (!SWIG_IsOK(res1))
277 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
278 if(size!=self->getNumberOfTuples())
280 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
282 self->renumberInPlace(tmp);
286 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
288 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
289 da2->checkAllocated();
290 int size=self->getNumberOfTuples();
291 if(size!=self->getNumberOfTuples())
293 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
295 self->renumberInPlace(da2->getConstPointer());
299 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
302 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
303 if (!SWIG_IsOK(res1))
306 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
307 if(size!=self->getNumberOfTuples())
309 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
311 self->renumberInPlaceR(tmp);
315 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
317 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
318 da2->checkAllocated();
319 int size=self->getNumberOfTuples();
320 if(size!=self->getNumberOfTuples())
322 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
324 self->renumberInPlaceR(da2->getConstPointer());
328 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
329 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
331 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
332 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
333 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
334 DataArrayInt *tuplesSelecPtr2=0;
337 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
339 throw INTERP_KERNEL::Exception(msg);
341 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
344 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
346 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
347 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
350 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
352 std::vector<std::pair<int,int> > ranges;
353 convertPyToVectorPairInt(li,ranges);
354 return self->selectByTupleRanges(ranges);
357 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
360 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
361 if (!SWIG_IsOK(res1))
364 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
365 return self->selectByTupleId(tmp,tmp+size);
369 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
371 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
372 da2->checkAllocated();
373 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
377 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
380 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
381 if (!SWIG_IsOK(res1))
384 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
385 return self->selectByTupleIdSafe(tmp,tmp+size);
389 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
391 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
392 da2->checkAllocated();
393 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
397 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
399 std::vector<int> tmp;
400 convertPyToNewIntArr3(li,tmp);
401 DataArray *ret=self->keepSelectedComponents(tmp);
402 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
405 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
407 if(!PySlice_Check(slic))
408 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
409 Py_ssize_t strt=2,stp=2,step=2;
410 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
411 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
412 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
413 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
414 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
416 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
417 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
420 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
422 if(!PySlice_Check(slic))
423 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
424 Py_ssize_t strt=2,stp=2,step=2;
425 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
426 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
427 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
429 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
430 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
433 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
435 if(!PySlice_Check(slic))
436 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
437 Py_ssize_t strt=2,stp=2,step=2;
438 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
439 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
440 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
441 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
442 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
443 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
446 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
448 if(!PySlice_Check(slic))
449 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
450 Py_ssize_t strt=2,stp=2,step=2;
451 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
452 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
453 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
454 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
455 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
456 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
459 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
461 std::vector<const DataArray *> tmp;
462 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
463 return DataArray::Aggregate(tmp);
466 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
468 if(!PySlice_Check(slic))
469 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
470 Py_ssize_t strt=2,stp=2,step=2;
471 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
472 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
473 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
474 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
477 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
479 if(!PySlice_Check(slic))
480 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
481 Py_ssize_t strt=2,stp=2,step=2;
482 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
483 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
484 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
485 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
491 class DataArrayDoubleIterator;
493 class DataArrayDouble : public DataArray
496 static DataArrayDouble *New();
497 double doubleValue() const throw(INTERP_KERNEL::Exception);
498 bool empty() const throw(INTERP_KERNEL::Exception);
499 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
500 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
501 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
502 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
503 double popBackSilent() throw(INTERP_KERNEL::Exception);
504 void pack() const throw(INTERP_KERNEL::Exception);
505 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
506 void fillWithZero() throw(INTERP_KERNEL::Exception);
507 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
508 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
509 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
510 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
511 void reverse() throw(INTERP_KERNEL::Exception);
512 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
513 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
514 std::string repr() const throw(INTERP_KERNEL::Exception);
515 std::string reprZip() const throw(INTERP_KERNEL::Exception);
516 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
517 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
518 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
519 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
520 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
521 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
522 void transpose() throw(INTERP_KERNEL::Exception);
523 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
524 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
525 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
526 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
527 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
528 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
529 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
530 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
531 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
532 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
533 double front() const throw(INTERP_KERNEL::Exception);
534 double back() const throw(INTERP_KERNEL::Exception);
535 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
536 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
537 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
538 double *getPointer() throw(INTERP_KERNEL::Exception);
539 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
540 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
541 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
542 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
543 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
544 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
545 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
546 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
547 double getAverageValue() const throw(INTERP_KERNEL::Exception);
548 double norm2() const throw(INTERP_KERNEL::Exception);
549 double normMax() const throw(INTERP_KERNEL::Exception);
550 double normMin() const throw(INTERP_KERNEL::Exception);
551 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
567 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
568 void abs() throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
570 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
571 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
572 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
573 void applyPow(double val) throw(INTERP_KERNEL::Exception);
574 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
575 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
576 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
577 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
578 DataArrayDouble *applyFunc(const std::string& func) const throw(INTERP_KERNEL::Exception);
579 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
580 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
581 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
582 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
583 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
584 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
585 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
586 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
587 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
588 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
589 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
590 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
591 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
592 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
593 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
594 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
595 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
596 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
597 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
598 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
599 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
600 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
603 DataArrayDouble() throw(INTERP_KERNEL::Exception)
605 return DataArrayDouble::New();
608 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
610 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)";
611 std::string msg(msgBase);
613 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
616 if(PyList_Check(elt0) || PyTuple_Check(elt0))
620 if(PyInt_Check(nbOfTuples))
622 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
624 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
627 if(PyInt_Check(elt2))
628 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
629 int nbOfCompo=PyInt_AS_LONG(elt2);
631 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
632 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
633 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
634 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
638 throw INTERP_KERNEL::Exception(msg.c_str());
641 {//DataArrayDouble.New([1.,3.,4.],3)
642 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
644 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
645 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
650 throw INTERP_KERNEL::Exception(msg.c_str());
653 {// DataArrayDouble.New([1.,3.,4.])
654 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
655 int tmpp1=-1,tmpp2=-1;
656 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
657 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
661 else if(PyInt_Check(elt0))
663 int nbOfTuples1=PyInt_AS_LONG(elt0);
665 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
670 if(PyInt_Check(nbOfTuples))
671 {//DataArrayDouble.New(5,2)
672 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
674 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
675 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
676 ret->alloc(nbOfTuples1,nbOfCompo);
680 throw INTERP_KERNEL::Exception(msg.c_str());
683 throw INTERP_KERNEL::Exception(msg.c_str());
686 {//DataArrayDouble.New(5)
687 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
688 ret->alloc(nbOfTuples1,1);
693 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
694 {//DataArrayDouble.New(numpyArray)
695 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
699 throw INTERP_KERNEL::Exception(msg.c_str());
700 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
703 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
705 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
708 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
711 std::vector<double> bb;
713 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
714 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
715 self->pushBackValsSilent(tmp,tmp+nbTuples);
718 std::string __repr__() const throw(INTERP_KERNEL::Exception)
720 std::ostringstream oss;
721 self->reprQuickOverview(oss);
725 std::string __str__() const throw(INTERP_KERNEL::Exception)
730 double __float__() const throw(INTERP_KERNEL::Exception)
732 return self->doubleValue();
735 int __len__() const throw(INTERP_KERNEL::Exception)
737 if(self->isAllocated())
739 return self->getNumberOfTuples();
743 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
747 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
749 return self->iterator();
752 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
754 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 !";
755 if(PyList_Check(li) || PyTuple_Check(li))
759 if(PyInt_Check(nbOfTuples))
761 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
763 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
766 if(PyInt_Check(nbOfComp))
767 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
768 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
770 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
771 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
772 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
775 throw INTERP_KERNEL::Exception(msg);
778 {//DataArrayDouble.setValues([1.,3.,4.],3)
780 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
781 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
785 throw INTERP_KERNEL::Exception(msg);
788 {// DataArrayDouble.setValues([1.,3.,4.])
789 int tmpp1=-1,tmpp2=-1;
790 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
791 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
795 throw INTERP_KERNEL::Exception(msg);
798 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
800 const double *vals=self->getConstPointer();
801 return convertDblArrToPyList(vals,self->getNbOfElems());
805 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
807 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
811 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
814 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
815 PyObject *ret=PyTuple_New(2);
816 PyObject *ret0Py=ret0?Py_True:Py_False;
818 PyTuple_SetItem(ret,0,ret0Py);
819 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
823 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
825 const double *vals=self->getConstPointer();
826 int nbOfComp=self->getNumberOfComponents();
827 int nbOfTuples=self->getNumberOfTuples();
828 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
831 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
834 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
835 if (!SWIG_IsOK(res1))
838 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
839 if(size!=self->getNumberOfTuples())
841 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
843 return self->renumber(tmp);
847 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
849 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
850 da2->checkAllocated();
851 int size=self->getNumberOfTuples();
852 if(size!=self->getNumberOfTuples())
854 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
856 return self->renumber(da2->getConstPointer());
860 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
863 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
864 if (!SWIG_IsOK(res1))
867 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
868 if(size!=self->getNumberOfTuples())
870 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
872 return self->renumberR(tmp);
876 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
878 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
879 da2->checkAllocated();
880 int size=self->getNumberOfTuples();
881 if(size!=self->getNumberOfTuples())
883 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
885 return self->renumberR(da2->getConstPointer());
889 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
892 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
893 if (!SWIG_IsOK(res1))
896 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
897 if(size!=self->getNumberOfTuples())
899 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
901 return self->renumberAndReduce(tmp,newNbOfTuple);
905 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
907 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
908 da2->checkAllocated();
909 int size=self->getNumberOfTuples();
910 if(size!=self->getNumberOfTuples())
912 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
914 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
918 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
920 int thisTupleId,otherTupleId;
921 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
922 PyObject *ret=PyTuple_New(3);
923 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
924 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
925 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
929 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
932 double r1=self->getMaxValue(tmp);
933 PyObject *ret=PyTuple_New(2);
934 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
935 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
939 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
942 double r1=self->getMaxValue2(tmp);
943 PyObject *ret=PyTuple_New(2);
944 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
945 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
949 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
952 double r1=self->getMinValue(tmp);
953 PyObject *ret=PyTuple_New(2);
954 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
955 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
959 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
962 double r1=self->getMinValue2(tmp);
963 PyObject *ret=PyTuple_New(2);
964 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
965 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
969 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
971 int nbOfCompo=self->getNumberOfComponents();
972 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
973 self->getMinMaxPerComponent(tmp);
974 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
978 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
980 int sz=self->getNumberOfComponents();
981 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
982 self->accumulate(tmp);
983 return convertDblArrToPyList(tmp,sz);
986 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
989 std::vector<int> val2;
990 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
991 return self->accumulatePerChunck(bg,bg+sz);
994 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
996 DataArrayInt *comm, *commIndex;
997 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
998 PyObject *res = PyList_New(2);
999 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1000 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1004 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1008 DataArrayDoubleTuple *aa;
1009 std::vector<double> bb;
1011 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1012 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1014 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1015 PyObject *ret=PyTuple_New(2);
1016 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1017 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1021 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1023 std::vector<int> tmp;
1024 convertPyToNewIntArr3(li,tmp);
1025 self->setSelectedComponents(a,tmp);
1028 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1030 int sz=self->getNumberOfComponents();
1031 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1032 self->getTuple(tupleId,tmp);
1033 return convertDblArrToPyList(tmp,sz);
1036 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1038 std::vector<const DataArrayDouble *> tmp;
1039 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1040 return DataArrayDouble::Aggregate(tmp);
1043 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1045 std::vector<const DataArrayDouble *> tmp;
1046 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1047 return DataArrayDouble::Meld(tmp);
1050 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1054 DataArrayDoubleTuple *aa;
1055 std::vector<double> bb;
1057 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1058 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1059 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1060 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1061 DataArrayInt *c=0,*cI=0;
1062 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1063 PyObject *ret=PyTuple_New(2);
1064 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1065 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1069 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1071 DataArrayInt *ret1=0;
1072 bool ret0=self->areIncludedInMe(other,prec,ret1);
1073 PyObject *ret=PyTuple_New(2);
1074 PyObject *ret0Py=ret0?Py_True:Py_False;
1076 PyTuple_SetItem(ret,0,ret0Py);
1077 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1081 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1083 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1084 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1085 self->checkAllocated();
1086 int nbOfTuples=self->getNumberOfTuples();
1087 int nbOfComponents=self->getNumberOfComponents();
1089 std::vector<int> vt1,vc1;
1090 std::pair<int, std::pair<int,int> > pt1,pc1;
1091 DataArrayInt *dt1=0,*dc1=0;
1093 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1094 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1098 if(nbOfComponents==1)
1099 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1100 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1102 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1104 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1106 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1108 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1111 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1112 std::vector<int> v2(1,ic1);
1113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1117 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1118 std::vector<int> v2(1,ic1);
1119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1123 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1124 std::vector<int> v2(1,ic1);
1125 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1129 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1130 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1134 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1135 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1139 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1140 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1144 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1145 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1149 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1150 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1151 std::vector<int> v2(nbOfComp);
1152 for(int i=0;i<nbOfComp;i++)
1153 v2[i]=pc1.first+i*pc1.second.second;
1154 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1158 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1159 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1160 std::vector<int> v2(nbOfComp);
1161 for(int i=0;i<nbOfComp;i++)
1162 v2[i]=pc1.first+i*pc1.second.second;
1163 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1167 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1168 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1169 std::vector<int> v2(nbOfComp);
1170 for(int i=0;i<nbOfComp;i++)
1171 v2[i]=pc1.first+i*pc1.second.second;
1172 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1176 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1177 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1178 std::vector<int> v2(nbOfComp);
1179 for(int i=0;i<nbOfComp;i++)
1180 v2[i]=pc1.first+i*pc1.second.second;
1181 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1184 throw INTERP_KERNEL::Exception(msg);
1188 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1190 self->checkAllocated();
1191 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1192 int nbOfTuples=self->getNumberOfTuples();
1193 int nbOfComponents=self->getNumberOfComponents();
1196 std::vector<double> v1;
1197 DataArrayDouble *d1=0;
1198 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1200 std::vector<int> vt1,vc1;
1201 std::pair<int, std::pair<int,int> > pt1,pc1;
1202 DataArrayInt *dt1=0,*dc1=0;
1203 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1204 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1212 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1215 tmp=DataArrayDouble::New();
1216 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1217 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1220 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1223 throw INTERP_KERNEL::Exception(msg);
1232 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1235 tmp=DataArrayDouble::New();
1236 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1237 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1240 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1243 throw INTERP_KERNEL::Exception(msg);
1252 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1255 tmp=DataArrayDouble::New();
1256 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1257 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1260 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1263 throw INTERP_KERNEL::Exception(msg);
1272 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1275 tmp=DataArrayDouble::New();
1276 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1277 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1280 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1283 throw INTERP_KERNEL::Exception(msg);
1292 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1295 tmp=DataArrayDouble::New();
1296 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1297 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1300 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1303 throw INTERP_KERNEL::Exception(msg);
1312 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1315 tmp=DataArrayDouble::New();
1316 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1317 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1320 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1323 throw INTERP_KERNEL::Exception(msg);
1332 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1335 tmp=DataArrayDouble::New();
1336 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1337 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1340 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1343 throw INTERP_KERNEL::Exception(msg);
1352 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1355 tmp=DataArrayDouble::New();
1356 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1357 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1360 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1363 throw INTERP_KERNEL::Exception(msg);
1372 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1375 tmp=DataArrayDouble::New();
1376 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1377 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1380 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1383 throw INTERP_KERNEL::Exception(msg);
1392 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1395 tmp=DataArrayDouble::New();
1396 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1397 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1400 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1403 throw INTERP_KERNEL::Exception(msg);
1412 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1415 tmp=DataArrayDouble::New();
1416 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1417 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1420 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1423 throw INTERP_KERNEL::Exception(msg);
1432 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1435 tmp=DataArrayDouble::New();
1436 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1437 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1440 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1443 throw INTERP_KERNEL::Exception(msg);
1452 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1455 tmp=DataArrayDouble::New();
1456 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1457 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1460 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1463 throw INTERP_KERNEL::Exception(msg);
1472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1475 tmp=DataArrayDouble::New();
1476 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1477 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1480 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1483 throw INTERP_KERNEL::Exception(msg);
1492 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1495 tmp=DataArrayDouble::New();
1496 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1497 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1500 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1503 throw INTERP_KERNEL::Exception(msg);
1512 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1515 tmp=DataArrayDouble::New();
1516 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1517 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1520 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1523 throw INTERP_KERNEL::Exception(msg);
1528 throw INTERP_KERNEL::Exception(msg);
1533 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1535 return self->negate();
1538 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1540 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1543 DataArrayDoubleTuple *aa;
1544 std::vector<double> bb;
1547 #ifndef WITHOUT_AUTOFIELD
1549 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1551 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1554 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1555 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1557 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1560 throw INTERP_KERNEL::Exception(msg);
1564 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1569 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1570 ret->applyLin(1.,val);
1571 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1575 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1579 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1580 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1584 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1585 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1588 throw INTERP_KERNEL::Exception(msg);
1592 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1594 const char msg[]="Unexpected situation in __radd__ !";
1597 DataArrayDoubleTuple *aa;
1598 std::vector<double> bb;
1600 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1605 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1606 ret->applyLin(1.,val);
1611 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1612 return DataArrayDouble::Add(self,aaa);
1616 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1617 return DataArrayDouble::Add(self,aaa);
1620 throw INTERP_KERNEL::Exception(msg);
1624 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1626 const char msg[]="Unexpected situation in __iadd__ !";
1629 DataArrayDoubleTuple *aa;
1630 std::vector<double> bb;
1632 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1637 self->applyLin(1.,val);
1638 Py_XINCREF(trueSelf);
1644 Py_XINCREF(trueSelf);
1649 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1650 self->addEqual(aaa);
1651 Py_XINCREF(trueSelf);
1656 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1657 self->addEqual(aaa);
1658 Py_XINCREF(trueSelf);
1662 throw INTERP_KERNEL::Exception(msg);
1666 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1668 const char msg[]="Unexpected situation in __sub__ !";
1671 DataArrayDoubleTuple *aa;
1672 std::vector<double> bb;
1675 #ifndef WITHOUT_AUTOFIELD
1677 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1679 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1682 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1683 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1685 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1688 throw INTERP_KERNEL::Exception(msg);
1692 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1697 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1698 ret->applyLin(1.,-val);
1699 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1703 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1707 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1708 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1712 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1713 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1716 throw INTERP_KERNEL::Exception(msg);
1720 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1722 const char msg[]="Unexpected situation in __rsub__ !";
1725 DataArrayDoubleTuple *aa;
1726 std::vector<double> bb;
1728 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1733 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1734 ret->applyLin(-1.,val);
1739 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1740 return DataArrayDouble::Substract(aaa,self);
1744 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1745 return DataArrayDouble::Substract(aaa,self);
1748 throw INTERP_KERNEL::Exception(msg);
1752 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1754 const char msg[]="Unexpected situation in __isub__ !";
1757 DataArrayDoubleTuple *aa;
1758 std::vector<double> bb;
1760 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1765 self->applyLin(1,-val);
1766 Py_XINCREF(trueSelf);
1771 self->substractEqual(a);
1772 Py_XINCREF(trueSelf);
1777 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1778 self->substractEqual(aaa);
1779 Py_XINCREF(trueSelf);
1784 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1785 self->substractEqual(aaa);
1786 Py_XINCREF(trueSelf);
1790 throw INTERP_KERNEL::Exception(msg);
1794 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1796 const char msg[]="Unexpected situation in __mul__ !";
1799 DataArrayDoubleTuple *aa;
1800 std::vector<double> bb;
1803 #ifndef WITHOUT_AUTOFIELD
1805 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1807 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1810 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1811 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1813 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1816 throw INTERP_KERNEL::Exception(msg);
1820 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1825 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1826 ret->applyLin(val,0.);
1827 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1831 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1835 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1836 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1840 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1841 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1844 throw INTERP_KERNEL::Exception(msg);
1848 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1850 const char msg[]="Unexpected situation in __rmul__ !";
1853 DataArrayDoubleTuple *aa;
1854 std::vector<double> bb;
1856 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1861 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1862 ret->applyLin(val,0.);
1867 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1868 return DataArrayDouble::Multiply(self,aaa);
1872 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1873 return DataArrayDouble::Multiply(self,aaa);
1876 throw INTERP_KERNEL::Exception(msg);
1880 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1882 const char msg[]="Unexpected situation in __imul__ !";
1885 DataArrayDoubleTuple *aa;
1886 std::vector<double> bb;
1888 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1893 self->applyLin(val,0.);
1894 Py_XINCREF(trueSelf);
1899 self->multiplyEqual(a);
1900 Py_XINCREF(trueSelf);
1905 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1906 self->multiplyEqual(aaa);
1907 Py_XINCREF(trueSelf);
1912 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1913 self->multiplyEqual(aaa);
1914 Py_XINCREF(trueSelf);
1918 throw INTERP_KERNEL::Exception(msg);
1922 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1924 const char msg[]="Unexpected situation in __div__ !";
1927 DataArrayDoubleTuple *aa;
1928 std::vector<double> bb;
1931 #ifndef WITHOUT_AUTOFIELD
1933 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1935 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1938 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1939 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1941 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1944 throw INTERP_KERNEL::Exception(msg);
1948 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1954 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1955 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1956 ret->applyLin(1/val,0.);
1957 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1961 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1965 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1966 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1970 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1971 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1974 throw INTERP_KERNEL::Exception(msg);
1978 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1980 const char msg[]="Unexpected situation in __rdiv__ !";
1983 DataArrayDoubleTuple *aa;
1984 std::vector<double> bb;
1986 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1991 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1997 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1998 return DataArrayDouble::Divide(aaa,self);
2002 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2003 return DataArrayDouble::Divide(aaa,self);
2006 throw INTERP_KERNEL::Exception(msg);
2010 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2012 const char msg[]="Unexpected situation in __idiv__ !";
2015 DataArrayDoubleTuple *aa;
2016 std::vector<double> bb;
2018 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2024 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2025 self->applyLin(1./val,0.);
2026 Py_XINCREF(trueSelf);
2031 self->divideEqual(a);
2032 Py_XINCREF(trueSelf);
2037 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2038 self->divideEqual(aaa);
2039 Py_XINCREF(trueSelf);
2044 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2045 self->divideEqual(aaa);
2046 Py_XINCREF(trueSelf);
2050 throw INTERP_KERNEL::Exception(msg);
2054 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2056 const char msg[]="Unexpected situation in __pow__ !";
2059 DataArrayDoubleTuple *aa;
2060 std::vector<double> bb;
2062 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2067 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2073 return DataArrayDouble::Pow(self,a);
2077 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2078 return DataArrayDouble::Pow(self,aaa);
2082 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2083 return DataArrayDouble::Pow(self,aaa);
2086 throw INTERP_KERNEL::Exception(msg);
2090 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2092 const char msg[]="Unexpected situation in __rpow__ !";
2095 DataArrayDoubleTuple *aa;
2096 std::vector<double> bb;
2098 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2103 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2104 ret->applyRPow(val);
2109 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2110 return DataArrayDouble::Pow(aaa,self);
2114 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2115 return DataArrayDouble::Pow(aaa,self);
2118 throw INTERP_KERNEL::Exception(msg);
2122 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2124 const char msg[]="Unexpected situation in __ipow__ !";
2127 DataArrayDoubleTuple *aa;
2128 std::vector<double> bb;
2130 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2135 self->applyPow(val);
2136 Py_XINCREF(trueSelf);
2142 Py_XINCREF(trueSelf);
2147 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2148 self->powEqual(aaa);
2149 Py_XINCREF(trueSelf);
2154 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2155 self->powEqual(aaa);
2156 Py_XINCREF(trueSelf);
2160 throw INTERP_KERNEL::Exception(msg);
2164 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2166 DataArrayInt *c=0,*cI=0;
2168 self->computeTupleIdsNearTuples(other,eps,c,cI);
2169 PyObject *ret=PyTuple_New(2);
2170 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2171 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2175 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2177 DataArrayInt *ret1=0;
2178 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2179 PyObject *ret=PyTuple_New(2);
2180 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2181 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2187 class DataArrayDoubleTuple;
2189 class DataArrayDoubleIterator
2192 DataArrayDoubleIterator(DataArrayDouble *da);
2193 ~DataArrayDoubleIterator();
2198 DataArrayDoubleTuple *ret=self->nextt();
2200 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2203 PyErr_SetString(PyExc_StopIteration,"No more data.");
2210 class DataArrayDoubleTuple
2213 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2214 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2217 std::string __str__() const throw(INTERP_KERNEL::Exception)
2219 return self->repr();
2222 double __float__() const throw(INTERP_KERNEL::Exception)
2224 return self->doubleValue();
2227 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2229 return self->buildDADouble(1,self->getNumberOfCompo());
2232 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2234 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2235 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2236 Py_XINCREF(trueSelf);
2240 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2242 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2243 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2244 Py_XINCREF(trueSelf);
2248 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2250 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2251 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2252 Py_XINCREF(trueSelf);
2256 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2258 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2259 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2260 Py_XINCREF(trueSelf);
2264 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2266 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2269 std::vector<int> multiVal;
2270 std::pair<int, std::pair<int,int> > slic;
2271 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2272 const double *pt=self->getConstPointer();
2273 int nbc=self->getNumberOfCompo();
2274 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2281 std::ostringstream oss;
2282 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2283 throw INTERP_KERNEL::Exception(oss.str().c_str());
2286 return PyFloat_FromDouble(pt[singleVal]);
2290 return PyFloat_FromDouble(pt[nbc+singleVal]);
2293 std::ostringstream oss;
2294 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2295 throw INTERP_KERNEL::Exception(oss.str().c_str());
2301 PyObject *t=PyTuple_New(multiVal.size());
2302 for(int j=0;j<(int)multiVal.size();j++)
2304 int cid=multiVal[j];
2307 std::ostringstream oss;
2308 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2309 throw INTERP_KERNEL::Exception(oss.str().c_str());
2311 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2317 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2318 PyObject *t=PyTuple_New(sz);
2319 for(int j=0;j<sz;j++)
2320 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2324 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2328 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2330 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2331 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2334 std::vector<double> multiValV;
2335 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2336 int nbc=self->getNumberOfCompo();
2337 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2339 std::vector<int> multiVal;
2340 std::pair<int, std::pair<int,int> > slic;
2341 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2342 double *pt=self->getPointer();
2343 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2350 std::ostringstream oss;
2351 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2352 throw INTERP_KERNEL::Exception(oss.str().c_str());
2358 pt[singleVal]=singleValV;
2363 if(multiValV.size()!=1)
2365 std::ostringstream oss;
2366 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2367 throw INTERP_KERNEL::Exception(oss.str().c_str());
2369 pt[singleVal]=multiValV[0];
2374 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2378 throw INTERP_KERNEL::Exception(msg);
2387 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2391 std::ostringstream oss;
2392 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2393 throw INTERP_KERNEL::Exception(oss.str().c_str());
2401 if(multiVal.size()!=multiValV.size())
2403 std::ostringstream oss;
2404 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2405 throw INTERP_KERNEL::Exception(oss.str().c_str());
2407 for(int i=0;i<(int)multiVal.size();i++)
2409 int pos=multiVal[i];
2412 std::ostringstream oss;
2413 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2414 throw INTERP_KERNEL::Exception(oss.str().c_str());
2416 pt[multiVal[i]]=multiValV[i];
2422 const double *ptV=daIntTyyppV->getConstPointer();
2423 if(nbc>daIntTyyppV->getNumberOfCompo())
2425 std::ostringstream oss;
2426 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2427 throw INTERP_KERNEL::Exception(oss.str().c_str());
2429 std::copy(ptV,ptV+nbc,pt);
2433 throw INTERP_KERNEL::Exception(msg);
2438 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2443 for(int j=0;j<sz;j++)
2444 pt[slic.first+j*slic.second.second]=singleValV;
2449 if(sz!=(int)multiValV.size())
2451 std::ostringstream oss;
2452 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2453 throw INTERP_KERNEL::Exception(oss.str().c_str());
2455 for(int j=0;j<sz;j++)
2456 pt[slic.first+j*slic.second.second]=multiValV[j];
2461 const double *ptV=daIntTyyppV->getConstPointer();
2462 if(sz>daIntTyyppV->getNumberOfCompo())
2464 std::ostringstream oss;
2465 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2466 throw INTERP_KERNEL::Exception(oss.str().c_str());
2468 for(int j=0;j<sz;j++)
2469 pt[slic.first+j*slic.second.second]=ptV[j];
2473 throw INTERP_KERNEL::Exception(msg);
2477 throw INTERP_KERNEL::Exception(msg);
2483 class DataArrayIntIterator;
2485 class DataArrayInt : public DataArray
2488 static DataArrayInt *New();
2489 int intValue() const throw(INTERP_KERNEL::Exception);
2490 int getHashCode() const throw(INTERP_KERNEL::Exception);
2491 bool empty() const throw(INTERP_KERNEL::Exception);
2492 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2493 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2494 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2495 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2496 int popBackSilent() throw(INTERP_KERNEL::Exception);
2497 void pack() const throw(INTERP_KERNEL::Exception);
2498 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2499 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2500 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2501 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2502 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2503 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2504 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2505 void reverse() throw(INTERP_KERNEL::Exception);
2506 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2507 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2508 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2509 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2510 void fillWithZero() throw(INTERP_KERNEL::Exception);
2511 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2512 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2513 std::string repr() const throw(INTERP_KERNEL::Exception);
2514 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2516 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2517 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2518 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2519 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2520 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2521 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2522 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2523 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2524 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2525 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2526 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2527 void transpose() throw(INTERP_KERNEL::Exception);
2528 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2529 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2530 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2531 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2532 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2533 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2534 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2535 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2536 int front() const throw(INTERP_KERNEL::Exception);
2537 int back() const throw(INTERP_KERNEL::Exception);
2538 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2539 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2540 int *getPointer() throw(INTERP_KERNEL::Exception);
2541 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2542 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2543 const int *begin() const throw(INTERP_KERNEL::Exception);
2544 const int *end() const throw(INTERP_KERNEL::Exception);
2545 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2546 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2547 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2548 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2549 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2550 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2551 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2552 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2553 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2554 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2555 int count(int value) const throw(INTERP_KERNEL::Exception);
2556 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2557 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2558 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2559 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2560 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2561 void abs() throw(INTERP_KERNEL::Exception);
2562 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2563 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2564 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2565 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2566 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2567 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2568 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2569 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2570 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2571 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2572 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2573 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2574 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2575 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2576 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2577 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2578 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2579 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2580 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2583 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2584 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2585 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2586 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2587 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2588 void computeOffsets() throw(INTERP_KERNEL::Exception);
2589 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2591 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2592 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2593 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2594 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2595 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2596 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2597 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2598 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2599 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2600 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2601 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2602 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2603 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2604 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2605 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2606 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2608 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2611 DataArrayInt() throw(INTERP_KERNEL::Exception)
2613 return DataArrayInt::New();
2616 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2618 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)";
2619 std::string msg(msgBase);
2621 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2624 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2628 if(PyInt_Check(nbOfTuples))
2630 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2632 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2635 if(PyInt_Check(nbOfComp))
2636 {//DataArrayInt.New([1,3,4,5],2,2)
2637 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2639 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2640 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2641 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2642 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2646 throw INTERP_KERNEL::Exception(msg.c_str());
2649 {//DataArrayInt.New([1,3,4],3)
2650 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2652 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2653 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2658 throw INTERP_KERNEL::Exception(msg.c_str());
2661 {// DataArrayInt.New([1,3,4])
2662 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2663 int tmpp1=-1,tmpp2=-1;
2664 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2665 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2669 else if(PyInt_Check(elt0))
2671 int nbOfTuples1=PyInt_AS_LONG(elt0);
2673 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2678 if(PyInt_Check(nbOfTuples))
2679 {//DataArrayInt.New(5,2)
2680 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2682 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2683 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2684 ret->alloc(nbOfTuples1,nbOfCompo);
2688 throw INTERP_KERNEL::Exception(msg.c_str());
2691 throw INTERP_KERNEL::Exception(msg.c_str());
2694 {//DataArrayInt.New(5)
2695 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2696 ret->alloc(nbOfTuples1,1);
2701 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2702 {//DataArrayInt.New(numpyArray)
2703 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2707 throw INTERP_KERNEL::Exception(msg.c_str());
2708 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2711 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2713 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2716 std::string __str__() const throw(INTERP_KERNEL::Exception)
2718 return self->repr();
2721 int __len__() const throw(INTERP_KERNEL::Exception)
2723 if(self->isAllocated())
2725 return self->getNumberOfTuples();
2729 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2733 int __int__() const throw(INTERP_KERNEL::Exception)
2735 return self->intValue();
2738 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2740 return self->iterator();
2743 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2745 int sz=self->getNumberOfComponents();
2746 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2747 self->accumulate(tmp);
2748 return convertIntArrToPyList(tmp,sz);
2751 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2754 std::vector<int> val2;
2755 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2756 return self->accumulatePerChunck(bg,bg+sz);
2759 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2762 std::vector<int> val2;
2763 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2764 return self->getIdsEqualTuple(bg,bg+sz);
2767 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2769 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2770 PyObject *ret=PyList_New(slcs.size());
2771 for(std::size_t i=0;i<slcs.size();i++)
2772 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2776 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2778 if(!PySlice_Check(slic))
2779 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2780 Py_ssize_t strt=2,stp=2,step=2;
2781 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2782 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2783 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2784 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2785 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 !");
2786 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2789 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2791 int newNbOfTuples=-1;
2792 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2793 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2794 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2795 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2796 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2797 PyObject *ret=PyTuple_New(2);
2798 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2799 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2803 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2805 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 !";
2806 if(PyList_Check(li) || PyTuple_Check(li))
2810 if(PyInt_Check(nbOfTuples))
2812 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2814 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2817 if(PyInt_Check(nbOfComp))
2818 {//DataArrayInt.setValues([1,3,4,5],2,2)
2819 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2821 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2822 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2823 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2826 throw INTERP_KERNEL::Exception(msg);
2829 {//DataArrayInt.setValues([1,3,4],3)
2831 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2832 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2836 throw INTERP_KERNEL::Exception(msg);
2839 {// DataArrayInt.setValues([1,3,4])
2840 int tmpp1=-1,tmpp2=-1;
2841 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2842 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2846 throw INTERP_KERNEL::Exception(msg);
2849 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2851 const int *vals=self->getConstPointer();
2852 return convertIntArrToPyList(vals,self->getNbOfElems());
2856 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2858 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2862 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2865 bool ret0=self->isEqualIfNotWhy(other,ret1);
2866 PyObject *ret=PyTuple_New(2);
2867 PyObject *ret0Py=ret0?Py_True:Py_False;
2869 PyTuple_SetItem(ret,0,ret0Py);
2870 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2874 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2876 const int *vals=self->getConstPointer();
2877 int nbOfComp=self->getNumberOfComponents();
2878 int nbOfTuples=self->getNumberOfTuples();
2879 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2882 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2884 std::vector<const DataArrayInt *> groups;
2885 std::vector< std::vector<int> > fidsOfGroups;
2886 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2887 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2888 PyObject *ret = PyList_New(2);
2889 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2890 int sz=fidsOfGroups.size();
2891 PyObject *ret1 = PyList_New(sz);
2892 for(int i=0;i<sz;i++)
2893 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2894 PyList_SetItem(ret,1,ret1);
2898 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2901 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2902 if (!SWIG_IsOK(res1))
2905 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2906 self->transformWithIndArr(tmp,tmp+size);
2910 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2911 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2915 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2919 std::vector<int> multiVal;
2920 std::pair<int, std::pair<int,int> > slic;
2921 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2922 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2926 return self->getIdsEqualList(&singleVal,&singleVal+1);
2928 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2930 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2932 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2936 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2940 std::vector<int> multiVal;
2941 std::pair<int, std::pair<int,int> > slic;
2942 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2943 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2947 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2949 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2951 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2953 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2957 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2959 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2961 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2962 if (!SWIG_IsOK(res1))
2965 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2966 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2970 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2972 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2973 da2->checkAllocated();
2974 int size=self->getNumberOfTuples();
2975 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2977 PyObject *ret = PyList_New(3);
2978 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2979 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2980 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2984 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2987 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2988 if (!SWIG_IsOK(res1))
2991 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2992 return self->transformWithIndArrR(tmp,tmp+size);
2996 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2997 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3001 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3004 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3005 if (!SWIG_IsOK(res1))
3008 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3009 if(size!=self->getNumberOfTuples())
3011 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3013 return self->renumberAndReduce(tmp,newNbOfTuple);
3017 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3019 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3020 da2->checkAllocated();
3021 int size=self->getNumberOfTuples();
3022 if(size!=self->getNumberOfTuples())
3024 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3026 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3030 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3033 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3034 if (!SWIG_IsOK(res1))
3037 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3038 if(size!=self->getNumberOfTuples())
3040 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3042 return self->renumber(tmp);
3046 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3048 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3049 da2->checkAllocated();
3050 int size=self->getNumberOfTuples();
3051 if(size!=self->getNumberOfTuples())
3053 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3055 return self->renumber(da2->getConstPointer());
3059 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3062 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3063 if (!SWIG_IsOK(res1))
3066 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3067 if(size!=self->getNumberOfTuples())
3069 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3071 return self->renumberR(tmp);
3075 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3077 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3078 da2->checkAllocated();
3079 int size=self->getNumberOfTuples();
3080 if(size!=self->getNumberOfTuples())
3082 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3084 return self->renumberR(da2->getConstPointer());
3088 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3090 std::vector<int> tmp;
3091 convertPyToNewIntArr3(li,tmp);
3092 self->setSelectedComponents(a,tmp);
3095 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3097 int sz=self->getNumberOfComponents();
3098 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3099 self->getTuple(tupleId,tmp);
3100 return convertIntArrToPyList(tmp,sz);
3103 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3105 DataArrayInt *arr=0;
3106 DataArrayInt *arrI=0;
3107 self->changeSurjectiveFormat(targetNb,arr,arrI);
3108 PyObject *res = PyList_New(2);
3109 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3110 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3114 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3116 std::vector<const DataArrayInt *> tmp;
3117 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3118 return DataArrayInt::Meld(tmp);
3121 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3123 std::vector<const DataArrayInt *> tmp;
3124 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3125 return DataArrayInt::Aggregate(tmp);
3128 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3130 std::vector<const DataArrayInt *> tmp;
3131 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3132 return DataArrayInt::AggregateIndexes(tmp);
3135 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3137 std::vector<const DataArrayInt *> tmp;
3138 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3139 return DataArrayInt::BuildUnion(tmp);
3142 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3144 std::vector<const DataArrayInt *> tmp;
3145 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3146 return DataArrayInt::BuildIntersection(tmp);
3149 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3152 int r1=self->getMaxValue(tmp);
3153 PyObject *ret=PyTuple_New(2);
3154 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3155 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3159 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3162 int r1=self->getMinValue(tmp);
3163 PyObject *ret=PyTuple_New(2);
3164 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3165 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3169 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3171 int nbOfCompo=self->getNumberOfComponents();
3176 if(PyInt_Check(obj))
3178 int val=(int)PyInt_AS_LONG(obj);
3179 return self->locateValue(val);
3182 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3186 std::vector<int> arr;
3187 convertPyToNewIntArr3(obj,arr);
3188 return self->locateTuple(arr);
3193 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3195 int nbOfCompo=self->getNumberOfComponents();
3202 if(PyInt_Check(obj))
3204 int val=(int)PyInt_AS_LONG(obj);
3205 return self->presenceOfValue(val);
3208 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3212 std::vector<int> arr;
3213 convertPyToNewIntArr3(obj,arr);
3214 return self->presenceOfTuple(arr);
3219 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3221 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3222 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3223 self->checkAllocated();
3224 int nbOfTuples=self->getNumberOfTuples();
3225 int nbOfComponents=self->getNumberOfComponents();
3227 std::vector<int> vt1,vc1;
3228 std::pair<int, std::pair<int,int> > pt1,pc1;
3229 DataArrayInt *dt1=0,*dc1=0;
3231 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3232 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3237 if(nbOfComponents==1)
3238 return PyInt_FromLong(self->getIJSafe(it1,0));
3239 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3242 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3244 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3246 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3248 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3251 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3252 std::vector<int> v2(1,ic1);
3253 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3257 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3258 std::vector<int> v2(1,ic1);
3259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3263 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3264 std::vector<int> v2(1,ic1);
3265 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3269 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3270 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3274 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3275 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3279 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3280 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3284 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3285 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3289 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3290 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3291 std::vector<int> v2(nbOfComp);
3292 for(int i=0;i<nbOfComp;i++)
3293 v2[i]=pc1.first+i*pc1.second.second;
3294 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3298 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3299 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3300 std::vector<int> v2(nbOfComp);
3301 for(int i=0;i<nbOfComp;i++)
3302 v2[i]=pc1.first+i*pc1.second.second;
3303 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3307 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3308 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3309 std::vector<int> v2(nbOfComp);
3310 for(int i=0;i<nbOfComp;i++)
3311 v2[i]=pc1.first+i*pc1.second.second;
3312 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3316 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3317 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3318 std::vector<int> v2(nbOfComp);
3319 for(int i=0;i<nbOfComp;i++)
3320 v2[i]=pc1.first+i*pc1.second.second;
3321 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3324 throw INTERP_KERNEL::Exception(msg);
3328 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3330 self->checkAllocated();
3331 const char msg[]="Unexpected situation in __setitem__ !";
3332 int nbOfTuples=self->getNumberOfTuples();
3333 int nbOfComponents=self->getNumberOfComponents();
3336 std::vector<int> v1;
3338 DataArrayIntTuple *dd1=0;
3339 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3341 std::vector<int> vt1,vc1;
3342 std::pair<int, std::pair<int,int> > pt1,pc1;
3343 DataArrayInt *dt1=0,*dc1=0;
3344 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3345 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3353 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3356 tmp=DataArrayInt::New();
3357 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3358 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3361 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3364 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3365 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3368 throw INTERP_KERNEL::Exception(msg);
3377 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3380 tmp=DataArrayInt::New();
3381 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3382 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3385 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3388 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3389 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3392 throw INTERP_KERNEL::Exception(msg);
3401 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3404 tmp=DataArrayInt::New();
3405 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3406 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3409 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3412 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3413 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3416 throw INTERP_KERNEL::Exception(msg);
3425 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3428 tmp=DataArrayInt::New();
3429 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3430 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3433 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3436 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3437 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3440 throw INTERP_KERNEL::Exception(msg);
3449 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3452 tmp=DataArrayInt::New();
3453 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3454 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3457 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3460 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3461 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3464 throw INTERP_KERNEL::Exception(msg);
3473 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3476 tmp=DataArrayInt::New();
3477 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3478 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3481 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3484 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3485 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3488 throw INTERP_KERNEL::Exception(msg);
3497 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3500 tmp=DataArrayInt::New();
3501 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3502 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3505 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3508 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3509 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3512 throw INTERP_KERNEL::Exception(msg);
3521 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3524 tmp=DataArrayInt::New();
3525 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3526 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3529 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3532 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3533 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3536 throw INTERP_KERNEL::Exception(msg);
3545 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3548 tmp=DataArrayInt::New();
3549 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3550 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3553 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3556 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3557 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3560 throw INTERP_KERNEL::Exception(msg);
3569 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3572 tmp=DataArrayInt::New();
3573 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3574 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3577 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3580 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3581 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3584 throw INTERP_KERNEL::Exception(msg);
3593 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3596 tmp=DataArrayInt::New();
3597 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3598 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3601 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3604 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3605 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3608 throw INTERP_KERNEL::Exception(msg);
3617 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3620 tmp=DataArrayInt::New();
3621 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3622 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3625 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3628 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3629 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3632 throw INTERP_KERNEL::Exception(msg);
3641 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3644 tmp=DataArrayInt::New();
3645 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3646 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3649 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3652 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3653 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3656 throw INTERP_KERNEL::Exception(msg);
3665 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3668 tmp=DataArrayInt::New();
3669 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3670 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3673 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3676 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3677 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3680 throw INTERP_KERNEL::Exception(msg);
3689 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3692 tmp=DataArrayInt::New();
3693 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3694 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3697 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3700 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3701 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3704 throw INTERP_KERNEL::Exception(msg);
3713 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3716 tmp=DataArrayInt::New();
3717 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3718 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3721 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3724 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3725 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3728 throw INTERP_KERNEL::Exception(msg);
3733 throw INTERP_KERNEL::Exception(msg);
3738 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3740 return self->negate();
3743 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3745 const char msg[]="Unexpected situation in __add__ !";
3748 std::vector<int> aa;
3749 DataArrayIntTuple *aaa;
3751 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3756 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3757 ret->applyLin(1,val);
3762 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3763 return DataArrayInt::Add(self,aaaa);
3767 return DataArrayInt::Add(self,a);
3771 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3772 return DataArrayInt::Add(self,aaaa);
3775 throw INTERP_KERNEL::Exception(msg);
3779 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3781 const char msg[]="Unexpected situation in __radd__ !";
3784 std::vector<int> aa;
3785 DataArrayIntTuple *aaa;
3787 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3792 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3793 ret->applyLin(1,val);
3798 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3799 return DataArrayInt::Add(self,aaaa);
3803 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3804 return DataArrayInt::Add(self,aaaa);
3807 throw INTERP_KERNEL::Exception(msg);
3811 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3813 const char msg[]="Unexpected situation in __iadd__ !";
3816 std::vector<int> aa;
3817 DataArrayIntTuple *aaa;
3819 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3824 self->applyLin(1,val);
3825 Py_XINCREF(trueSelf);
3830 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3832 Py_XINCREF(trueSelf);
3838 Py_XINCREF(trueSelf);
3843 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3844 self->addEqual(aaaa);
3845 Py_XINCREF(trueSelf);
3849 throw INTERP_KERNEL::Exception(msg);
3853 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3855 const char msg[]="Unexpected situation in __sub__ !";
3858 std::vector<int> aa;
3859 DataArrayIntTuple *aaa;
3861 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3866 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3867 ret->applyLin(1,-val);
3872 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3873 return DataArrayInt::Substract(self,aaaa);
3877 return DataArrayInt::Substract(self,a);
3881 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3882 return DataArrayInt::Substract(self,aaaa);
3885 throw INTERP_KERNEL::Exception(msg);
3889 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3891 const char msg[]="Unexpected situation in __rsub__ !";
3894 std::vector<int> aa;
3895 DataArrayIntTuple *aaa;
3897 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3902 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3903 ret->applyLin(-1,val);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3909 return DataArrayInt::Substract(aaaa,self);
3913 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3914 return DataArrayInt::Substract(aaaa,self);
3917 throw INTERP_KERNEL::Exception(msg);
3921 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3923 const char msg[]="Unexpected situation in __isub__ !";
3926 std::vector<int> aa;
3927 DataArrayIntTuple *aaa;
3929 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3934 self->applyLin(1,-val);
3935 Py_XINCREF(trueSelf);
3940 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3941 self->substractEqual(bb);
3942 Py_XINCREF(trueSelf);
3947 self->substractEqual(a);
3948 Py_XINCREF(trueSelf);
3953 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3954 self->substractEqual(aaaa);
3955 Py_XINCREF(trueSelf);
3959 throw INTERP_KERNEL::Exception(msg);
3963 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3965 const char msg[]="Unexpected situation in __mul__ !";
3968 std::vector<int> aa;
3969 DataArrayIntTuple *aaa;
3971 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3976 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3977 ret->applyLin(val,0);
3982 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3983 return DataArrayInt::Multiply(self,aaaa);
3987 return DataArrayInt::Multiply(self,a);
3991 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3992 return DataArrayInt::Multiply(self,aaaa);
3995 throw INTERP_KERNEL::Exception(msg);
3999 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4001 const char msg[]="Unexpected situation in __rmul__ !";
4004 std::vector<int> aa;
4005 DataArrayIntTuple *aaa;
4007 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4012 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4013 ret->applyLin(val,0);
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4019 return DataArrayInt::Multiply(self,aaaa);
4023 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4024 return DataArrayInt::Multiply(self,aaaa);
4027 throw INTERP_KERNEL::Exception(msg);
4031 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4033 const char msg[]="Unexpected situation in __imul__ !";
4036 std::vector<int> aa;
4037 DataArrayIntTuple *aaa;
4039 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4044 self->applyLin(val,0);
4045 Py_XINCREF(trueSelf);
4050 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4051 self->multiplyEqual(bb);
4052 Py_XINCREF(trueSelf);
4057 self->multiplyEqual(a);
4058 Py_XINCREF(trueSelf);
4063 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4064 self->multiplyEqual(aaaa);
4065 Py_XINCREF(trueSelf);
4069 throw INTERP_KERNEL::Exception(msg);
4073 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4075 const char msg[]="Unexpected situation in __div__ !";
4078 std::vector<int> aa;
4079 DataArrayIntTuple *aaa;
4081 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4086 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4087 ret->applyDivideBy(val);
4092 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4093 return DataArrayInt::Divide(self,aaaa);
4097 return DataArrayInt::Divide(self,a);
4101 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4102 return DataArrayInt::Divide(self,aaaa);
4105 throw INTERP_KERNEL::Exception(msg);
4109 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4111 const char msg[]="Unexpected situation in __rdiv__ !";
4114 std::vector<int> aa;
4115 DataArrayIntTuple *aaa;
4117 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4122 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4128 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4129 return DataArrayInt::Divide(aaaa,self);
4133 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4134 return DataArrayInt::Divide(aaaa,self);
4137 throw INTERP_KERNEL::Exception(msg);
4141 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4143 const char msg[]="Unexpected situation in __idiv__ !";
4146 std::vector<int> aa;
4147 DataArrayIntTuple *aaa;
4149 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4154 self->applyDivideBy(val);
4155 Py_XINCREF(trueSelf);
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4161 self->divideEqual(bb);
4162 Py_XINCREF(trueSelf);
4167 self->divideEqual(a);
4168 Py_XINCREF(trueSelf);
4173 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4174 self->divideEqual(aaaa);
4175 Py_XINCREF(trueSelf);
4179 throw INTERP_KERNEL::Exception(msg);
4183 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4185 const char msg[]="Unexpected situation in __mod__ !";
4188 std::vector<int> aa;
4189 DataArrayIntTuple *aaa;
4191 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4196 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4197 ret->applyModulus(val);
4202 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4203 return DataArrayInt::Modulus(self,aaaa);
4207 return DataArrayInt::Modulus(self,a);
4211 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4212 return DataArrayInt::Modulus(self,aaaa);
4215 throw INTERP_KERNEL::Exception(msg);
4219 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4221 const char msg[]="Unexpected situation in __rmod__ !";
4224 std::vector<int> aa;
4225 DataArrayIntTuple *aaa;
4227 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4232 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4233 ret->applyRModulus(val);
4238 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4239 return DataArrayInt::Modulus(aaaa,self);
4243 return DataArrayInt::Modulus(a,self);
4247 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4248 return DataArrayInt::Modulus(aaaa,self);
4251 throw INTERP_KERNEL::Exception(msg);
4255 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4257 const char msg[]="Unexpected situation in __imod__ !";
4260 std::vector<int> aa;
4261 DataArrayIntTuple *aaa;
4263 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4268 self->applyModulus(val);
4269 Py_XINCREF(trueSelf);
4274 self->modulusEqual(a);
4275 Py_XINCREF(trueSelf);
4280 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4281 self->modulusEqual(aaaa);
4282 Py_XINCREF(trueSelf);
4286 throw INTERP_KERNEL::Exception(msg);
4290 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4292 const char msg[]="Unexpected situation in __pow__ !";
4295 std::vector<int> aa;
4296 DataArrayIntTuple *aaa;
4298 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4303 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4309 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4310 return DataArrayInt::Pow(self,aaaa);
4314 return DataArrayInt::Pow(self,a);
4318 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4319 return DataArrayInt::Pow(self,aaaa);
4322 throw INTERP_KERNEL::Exception(msg);
4326 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4328 const char msg[]="Unexpected situation in __rpow__ !";
4331 std::vector<int> aa;
4332 DataArrayIntTuple *aaa;
4334 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4339 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4340 ret->applyRPow(val);
4345 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4346 return DataArrayInt::Pow(aaaa,self);
4350 return DataArrayInt::Pow(a,self);
4354 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4355 return DataArrayInt::Pow(aaaa,self);
4358 throw INTERP_KERNEL::Exception(msg);
4362 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4364 const char msg[]="Unexpected situation in __ipow__ !";
4367 std::vector<int> aa;
4368 DataArrayIntTuple *aaa;
4370 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4375 self->applyPow(val);
4376 Py_XINCREF(trueSelf);
4382 Py_XINCREF(trueSelf);
4387 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4388 self->powEqual(aaaa);
4389 Py_XINCREF(trueSelf);
4393 throw INTERP_KERNEL::Exception(msg);
4397 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4399 std::ostringstream oss;
4400 self->reprQuickOverview(oss);
4404 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4406 int szArr,sw,iTypppArr;
4407 std::vector<int> stdvecTyyppArr;
4408 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4409 self->pushBackValsSilent(tmp,tmp+szArr);
4412 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4414 std::vector<int> ret1;
4415 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4416 std::size_t sz=ret0.size();
4417 PyObject *pyRet=PyTuple_New(2);
4418 PyObject *pyRet0=PyList_New((int)sz);
4419 PyObject *pyRet1=PyList_New((int)sz);
4420 for(std::size_t i=0;i<sz;i++)
4422 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4423 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4425 PyTuple_SetItem(pyRet,0,pyRet0);
4426 PyTuple_SetItem(pyRet,1,pyRet1);
4430 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4432 DataArrayInt *ret0=0,*ret1=0;
4433 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4434 PyObject *pyRet=PyTuple_New(2);
4435 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4436 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4442 class DataArrayIntTuple;
4444 class DataArrayIntIterator
4447 DataArrayIntIterator(DataArrayInt *da);
4448 ~DataArrayIntIterator();
4453 DataArrayIntTuple *ret=self->nextt();
4455 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4458 PyErr_SetString(PyExc_StopIteration,"No more data.");
4465 class DataArrayIntTuple
4468 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4469 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4472 std::string __str__() const throw(INTERP_KERNEL::Exception)
4474 return self->repr();
4477 int __int__() const throw(INTERP_KERNEL::Exception)
4479 return self->intValue();
4482 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4484 return self->buildDAInt(1,self->getNumberOfCompo());
4487 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4489 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4490 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4491 Py_XINCREF(trueSelf);
4495 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4497 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4498 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4499 Py_XINCREF(trueSelf);
4503 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4505 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4506 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4507 Py_XINCREF(trueSelf);
4511 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4513 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4514 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4515 Py_XINCREF(trueSelf);
4519 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4521 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4522 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4523 Py_XINCREF(trueSelf);
4527 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4529 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4532 std::vector<int> multiVal;
4533 std::pair<int, std::pair<int,int> > slic;
4534 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4535 const int *pt=self->getConstPointer();
4536 int nbc=self->getNumberOfCompo();
4537 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4544 std::ostringstream oss;
4545 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4546 throw INTERP_KERNEL::Exception(oss.str().c_str());
4549 return PyInt_FromLong(pt[singleVal]);
4553 return PyInt_FromLong(pt[nbc+singleVal]);
4556 std::ostringstream oss;
4557 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4558 throw INTERP_KERNEL::Exception(oss.str().c_str());
4564 PyObject *t=PyTuple_New(multiVal.size());
4565 for(int j=0;j<(int)multiVal.size();j++)
4567 int cid=multiVal[j];
4570 std::ostringstream oss;
4571 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4572 throw INTERP_KERNEL::Exception(oss.str().c_str());
4574 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4580 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4581 PyObject *t=PyTuple_New(sz);
4582 for(int j=0;j<sz;j++)
4583 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4587 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4591 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4593 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4594 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4597 std::vector<int> multiValV;
4598 std::pair<int, std::pair<int,int> > slicV;
4599 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4600 int nbc=self->getNumberOfCompo();
4601 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4603 std::vector<int> multiVal;
4604 std::pair<int, std::pair<int,int> > slic;
4605 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4606 int *pt=self->getPointer();
4607 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4614 std::ostringstream oss;
4615 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4616 throw INTERP_KERNEL::Exception(oss.str().c_str());
4622 pt[singleVal]=singleValV;
4627 if(multiValV.size()!=1)
4629 std::ostringstream oss;
4630 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4631 throw INTERP_KERNEL::Exception(oss.str().c_str());
4633 pt[singleVal]=multiValV[0];
4638 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4642 throw INTERP_KERNEL::Exception(msg);
4651 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4655 std::ostringstream oss;
4656 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4657 throw INTERP_KERNEL::Exception(oss.str().c_str());
4665 if(multiVal.size()!=multiValV.size())
4667 std::ostringstream oss;
4668 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4669 throw INTERP_KERNEL::Exception(oss.str().c_str());
4671 for(int i=0;i<(int)multiVal.size();i++)
4673 int pos=multiVal[i];
4676 std::ostringstream oss;
4677 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4678 throw INTERP_KERNEL::Exception(oss.str().c_str());
4680 pt[multiVal[i]]=multiValV[i];
4686 const int *ptV=daIntTyyppV->getConstPointer();
4687 if(nbc>daIntTyyppV->getNumberOfCompo())
4689 std::ostringstream oss;
4690 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4691 throw INTERP_KERNEL::Exception(oss.str().c_str());
4693 std::copy(ptV,ptV+nbc,pt);
4697 throw INTERP_KERNEL::Exception(msg);
4702 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4707 for(int j=0;j<sz;j++)
4708 pt[slic.first+j*slic.second.second]=singleValV;
4713 if(sz!=(int)multiValV.size())
4715 std::ostringstream oss;
4716 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4717 throw INTERP_KERNEL::Exception(oss.str().c_str());
4719 for(int j=0;j<sz;j++)
4720 pt[slic.first+j*slic.second.second]=multiValV[j];
4725 const int *ptV=daIntTyyppV->getConstPointer();
4726 if(sz>daIntTyyppV->getNumberOfCompo())
4728 std::ostringstream oss;
4729 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4730 throw INTERP_KERNEL::Exception(oss.str().c_str());
4732 for(int j=0;j<sz;j++)
4733 pt[slic.first+j*slic.second.second]=ptV[j];
4737 throw INTERP_KERNEL::Exception(msg);
4741 throw INTERP_KERNEL::Exception(msg);
4747 class DataArrayChar : public DataArray
4750 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4751 int getHashCode() const throw(INTERP_KERNEL::Exception);
4752 bool empty() const throw(INTERP_KERNEL::Exception);
4753 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4754 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4755 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4756 char popBackSilent() throw(INTERP_KERNEL::Exception);
4757 void pack() const throw(INTERP_KERNEL::Exception);
4758 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4759 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4760 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4761 void reverse() throw(INTERP_KERNEL::Exception);
4762 void fillWithZero() throw(INTERP_KERNEL::Exception);
4763 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4764 std::string repr() const throw(INTERP_KERNEL::Exception);
4765 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4766 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4767 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4768 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4769 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4770 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4771 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4772 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4773 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4774 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4775 char front() const throw(INTERP_KERNEL::Exception);
4776 char back() const throw(INTERP_KERNEL::Exception);
4777 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4778 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4779 char *getPointer() throw(INTERP_KERNEL::Exception);
4780 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4781 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4782 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4783 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4784 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4785 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4786 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4787 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4788 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4789 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4790 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4793 int __len__() const throw(INTERP_KERNEL::Exception)
4795 if(self->isAllocated())
4797 return self->getNumberOfTuples();
4801 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4805 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4808 bool ret0=self->isEqualIfNotWhy(other,ret1);
4809 PyObject *ret=PyTuple_New(2);
4810 PyObject *ret0Py=ret0?Py_True:Py_False;
4812 PyTuple_SetItem(ret,0,ret0Py);
4813 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4817 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4820 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4821 if (!SWIG_IsOK(res1))
4824 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4825 if(size!=self->getNumberOfTuples())
4827 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4829 return self->renumber(tmp);
4833 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4835 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4836 da2->checkAllocated();
4837 int size=self->getNumberOfTuples();
4838 if(size!=self->getNumberOfTuples())
4840 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4842 return self->renumber(da2->getConstPointer());
4846 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4849 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4850 if (!SWIG_IsOK(res1))
4853 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4854 if(size!=self->getNumberOfTuples())
4856 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4858 return self->renumberR(tmp);
4862 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4864 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4865 da2->checkAllocated();
4866 int size=self->getNumberOfTuples();
4867 if(size!=self->getNumberOfTuples())
4869 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4871 return self->renumberR(da2->getConstPointer());
4875 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4878 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4879 if (!SWIG_IsOK(res1))
4882 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4883 if(size!=self->getNumberOfTuples())
4885 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4887 return self->renumberAndReduce(tmp,newNbOfTuple);
4891 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4893 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4894 da2->checkAllocated();
4895 int size=self->getNumberOfTuples();
4896 if(size!=self->getNumberOfTuples())
4898 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4900 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4904 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4906 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4907 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4908 return DataArrayChar::Aggregate(tmp);
4911 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4913 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4914 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4915 return DataArrayChar::Meld(tmp);
4920 class DataArrayByteIterator;
4922 class DataArrayByte : public DataArrayChar
4925 static DataArrayByte *New();
4926 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4927 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4928 char byteValue() const throw(INTERP_KERNEL::Exception);
4931 DataArrayByte() throw(INTERP_KERNEL::Exception)
4933 return DataArrayByte::New();
4936 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4938 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) !";
4939 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4943 if(PyInt_Check(nbOfTuples))
4945 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4947 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4950 if(PyInt_Check(nbOfComp))
4951 {//DataArrayByte.New([1,3,4,5],2,2)
4952 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4954 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4955 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4956 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4957 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4961 throw INTERP_KERNEL::Exception(msg);
4964 {//DataArrayByte.New([1,3,4],3)
4965 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4967 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4968 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4973 throw INTERP_KERNEL::Exception(msg);
4976 {// DataArrayByte.New([1,3,4])
4977 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4978 int tmpp1=-1,tmpp2=-1;
4979 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4980 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4984 else if(PyInt_Check(elt0))
4986 int nbOfTuples1=PyInt_AS_LONG(elt0);
4988 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4993 if(PyInt_Check(nbOfTuples))
4994 {//DataArrayByte.New(5,2)
4995 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4997 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4998 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4999 ret->alloc(nbOfTuples1,nbOfCompo);
5003 throw INTERP_KERNEL::Exception(msg);
5006 throw INTERP_KERNEL::Exception(msg);
5009 {//DataArrayByte.New(5)
5010 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5011 ret->alloc(nbOfTuples1,1);
5016 throw INTERP_KERNEL::Exception(msg);
5019 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5021 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5024 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5026 std::ostringstream oss;
5027 self->reprQuickOverview(oss);
5031 int __int__() const throw(INTERP_KERNEL::Exception)
5033 return (int) self->byteValue();
5036 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5038 return self->iterator();
5041 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5043 return (int)self->getIJ(tupleId,compoId);
5046 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5048 return (int)self->getIJSafe(tupleId,compoId);
5051 std::string __str__() const throw(INTERP_KERNEL::Exception)
5053 return self->repr();
5056 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5058 const char *vals=self->getConstPointer();
5059 int nbOfComp=self->getNumberOfComponents();
5060 int nbOfTuples=self->getNumberOfTuples();
5061 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5064 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5067 int ival=-1; std::vector<int> ivval;
5068 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5069 std::vector<char> vals(sz);
5070 std::copy(pt,pt+sz,vals.begin());
5071 return self->presenceOfTuple(vals);
5074 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5077 int ival=-1; std::vector<int> ivval;
5078 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5079 std::vector<char> vals2(sz);
5080 std::copy(pt,pt+sz,vals2.begin());
5081 return self->presenceOfValue(vals2);
5084 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5087 int ival=-1; std::vector<int> ivval;
5088 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5089 std::vector<char> vals2(sz);
5090 std::copy(pt,pt+sz,vals2.begin());
5091 return self->locateValue(vals2);
5094 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5097 int ival=-1; std::vector<int> ivval;
5098 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5099 std::vector<char> vals(sz);
5100 std::copy(pt,pt+sz,vals.begin());
5101 return self->locateTuple(vals);
5104 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5107 int ival=-1; std::vector<int> ivval;
5108 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5109 std::vector<char> vals(sz);
5110 std::copy(pt,pt+sz,vals.begin());
5111 return self->search(vals);
5114 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5116 int sz=self->getNumberOfComponents();
5117 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5118 self->getTuple(tupleId,tmp);
5119 PyObject *ret=PyTuple_New(sz);
5120 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5124 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5127 int r1=(int)self->getMaxValue(tmp);
5128 PyObject *ret=PyTuple_New(2);
5129 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5130 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5134 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5137 int r1=(int)self->getMinValue(tmp);
5138 PyObject *ret=PyTuple_New(2);
5139 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5140 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5144 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5146 int nbOfCompo=self->getNumberOfComponents();
5151 if(PyInt_Check(obj))
5153 int val=(int)PyInt_AS_LONG(obj);
5154 return self->locateValue(val);
5157 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5160 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5164 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5166 int nbOfCompo=self->getNumberOfComponents();
5173 if(PyInt_Check(obj))
5175 int val=(int)PyInt_AS_LONG(obj);
5176 return self->presenceOfValue(val);
5179 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5182 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5188 class DataArrayByteTuple;
5190 class DataArrayByteIterator
5193 DataArrayByteIterator(DataArrayByte *da);
5194 ~DataArrayByteIterator();
5197 class DataArrayByteTuple
5200 std::string repr() const throw(INTERP_KERNEL::Exception);
5201 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5204 std::string __str__() const throw(INTERP_KERNEL::Exception)
5206 return self->repr();
5209 char __int__() const throw(INTERP_KERNEL::Exception)
5211 return self->byteValue();
5214 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5216 return self->buildDAByte(1,self->getNumberOfCompo());
5221 class DataArrayAsciiCharIterator;
5223 class DataArrayAsciiChar : public DataArrayChar
5226 static DataArrayAsciiChar *New();
5227 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5228 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5229 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5232 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5234 return DataArrayAsciiChar::New();
5237 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5239 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) !";
5240 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5244 if(PyInt_Check(nbOfTuples))
5246 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5248 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5251 if(PyInt_Check(nbOfComp))
5252 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5253 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5255 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5256 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5257 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5258 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5262 throw INTERP_KERNEL::Exception(msg);
5265 {//DataArrayAsciiChar.New([1,3,4],3)
5266 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5268 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5269 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5273 else if(PyString_Check(nbOfTuples))
5275 if(PyString_Size(nbOfTuples)!=1)
5276 throw INTERP_KERNEL::Exception(msg);
5277 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5278 std::vector<std::string> tmp;
5279 if(fillStringVector(elt0,tmp))
5280 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5282 throw INTERP_KERNEL::Exception(msg);
5285 throw INTERP_KERNEL::Exception(msg);
5289 std::vector<std::string> tmmp;
5290 if(fillStringVector(elt0,tmmp))
5291 //DataArrayAsciiChar.New(["abc","de","fghi"])
5292 return DataArrayAsciiChar::New(tmmp,' ');
5295 // DataArrayAsciiChar.New([1,3,4])
5296 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5297 int tmpp1=-1,tmpp2=-1;
5298 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5299 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5304 else if(PyInt_Check(elt0))
5306 int nbOfTuples1=PyInt_AS_LONG(elt0);
5308 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5313 if(PyInt_Check(nbOfTuples))
5314 {//DataArrayAsciiChar.New(5,2)
5315 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5317 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5318 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5319 ret->alloc(nbOfTuples1,nbOfCompo);
5323 throw INTERP_KERNEL::Exception(msg);
5326 throw INTERP_KERNEL::Exception(msg);
5329 {//DataArrayAsciiChar.New(5)
5330 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5331 ret->alloc(nbOfTuples1,1);
5336 throw INTERP_KERNEL::Exception(msg);
5339 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5341 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5344 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5346 std::ostringstream oss;
5347 self->reprQuickOverview(oss);
5351 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5353 return self->iterator();
5356 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5358 char tmp[2]; tmp[1]='\0';
5359 tmp[0]=self->getIJ(tupleId,compoId);
5360 return std::string(tmp);
5363 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5365 char tmp[2]; tmp[1]='\0';
5366 tmp[0]=self->getIJSafe(tupleId,compoId);
5367 return std::string(tmp);
5370 std::string __str__() const throw(INTERP_KERNEL::Exception)
5372 return self->repr();
5375 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5377 const char *vals=self->getConstPointer();
5378 int nbOfComp=self->getNumberOfComponents();
5379 int nbOfTuples=self->getNumberOfTuples();
5380 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5383 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5385 if(PyString_Check(tupl))
5387 Py_ssize_t sz=PyString_Size(tupl);
5388 std::vector<char> vals(sz);
5389 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5390 return self->presenceOfTuple(vals);
5393 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5396 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5398 if(PyString_Check(vals))
5400 Py_ssize_t sz=PyString_Size(vals);
5401 std::vector<char> vals2(sz);
5402 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5403 return self->presenceOfValue(vals2);
5406 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5409 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5411 if(PyString_Check(vals))
5413 Py_ssize_t sz=PyString_Size(vals);
5414 std::vector<char> vals2(sz);
5415 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5416 return self->locateValue(vals2);
5419 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5422 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5424 if(PyString_Check(tupl))
5426 Py_ssize_t sz=PyString_Size(tupl);
5427 std::vector<char> vals(sz);
5428 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5429 return self->locateTuple(vals);
5432 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5435 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5437 if(PyString_Check(strOrListOfInt))
5439 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5440 std::vector<char> vals(sz);
5441 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5442 return self->search(vals);
5445 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5448 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5450 int sz=self->getNumberOfComponents();
5451 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5452 self->getTuple(tupleId,tmp);
5453 return PyString_FromString(tmp);
5456 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5459 char tmp2[2]; tmp2[1]='\0';
5460 tmp2[0]=self->getMaxValue(tmp);
5461 PyObject *ret=PyTuple_New(2);
5462 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5463 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5467 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5470 char tmp2[2]; tmp2[1]='\0';
5471 tmp2[0]=self->getMinValue(tmp);
5472 PyObject *ret=PyTuple_New(2);
5473 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5474 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5478 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5480 int nbOfCompo=self->getNumberOfComponents();
5485 if(PyString_Check(obj))
5487 Py_ssize_t sz=PyString_Size(obj);
5488 char *pt=PyString_AsString(obj);
5490 return self->locateValue(pt[0]);
5492 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5495 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5498 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5502 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5504 int nbOfCompo=self->getNumberOfComponents();
5511 if(PyString_Check(obj))
5513 Py_ssize_t sz=PyString_Size(obj);
5514 char *pt=PyString_AsString(obj);
5516 return self->presenceOfValue(pt[0]);
5518 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5521 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5524 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5528 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5531 std::vector<int> stdvecTyyppArr;
5532 std::pair<int, std::pair<int,int> > sTyyppArr;
5533 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5534 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5538 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5540 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5542 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5544 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5546 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5550 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5552 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.";
5554 std::vector<int> stdvecTyyppArr;
5555 std::pair<int, std::pair<int,int> > sTyyppArr;
5556 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5557 int nbOfCompo=self->getNumberOfComponents();
5558 int nbOfTuples=self->getNumberOfTuples();
5559 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5561 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5562 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5571 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5577 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5578 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5581 //value vector<string>
5584 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5585 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5588 //value DataArrayChar
5591 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5595 throw INTERP_KERNEL::Exception(msg);
5599 {//obj list-tuple[int]
5605 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5611 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5612 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5615 //value vector<string>
5618 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5619 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5622 //value DataArrayChar
5625 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5629 throw INTERP_KERNEL::Exception(msg);
5640 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5646 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5647 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5650 //value vector<string>
5653 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5654 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5657 //value DataArrayChar
5660 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5664 throw INTERP_KERNEL::Exception(msg);
5675 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5681 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5682 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5685 //value vector<string>
5688 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5689 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5692 //value DataArrayChar
5695 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5699 throw INTERP_KERNEL::Exception(msg);
5704 throw INTERP_KERNEL::Exception(msg);
5710 class DataArrayAsciiCharTuple;
5712 class DataArrayAsciiCharIterator
5715 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5716 ~DataArrayAsciiCharIterator();
5721 DataArrayAsciiCharTuple *ret=self->nextt();
5723 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5726 PyErr_SetString(PyExc_StopIteration,"No more data.");
5733 class DataArrayAsciiCharTuple
5736 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5737 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5740 std::string __str__() const throw(INTERP_KERNEL::Exception)
5742 return self->repr();
5745 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5747 return self->buildDAAsciiChar(1,self->getNumberOfCompo());