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 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
413 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
414 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
417 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
419 if(!PySlice_Check(slic))
420 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
421 Py_ssize_t strt=2,stp=2,step=2;
422 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
423 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
425 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
426 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
429 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
431 if(!PySlice_Check(slic))
432 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
433 Py_ssize_t strt=2,stp=2,step=2;
434 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
435 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
436 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
439 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
441 if(!PySlice_Check(slic))
442 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
443 Py_ssize_t strt=2,stp=2,step=2;
444 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
445 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
446 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
449 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
451 std::vector<const DataArray *> tmp;
452 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
453 return DataArray::Aggregate(tmp);
456 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
458 if(!PySlice_Check(slic))
459 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
460 Py_ssize_t strt=2,stp=2,step=2;
461 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
462 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
463 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
466 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
468 if(!PySlice_Check(slic))
469 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (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 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
473 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
479 class DataArrayDoubleIterator;
481 class DataArrayDouble : public DataArray
484 static DataArrayDouble *New();
485 double doubleValue() const throw(INTERP_KERNEL::Exception);
486 bool empty() const throw(INTERP_KERNEL::Exception);
487 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
488 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
489 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
490 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
491 double popBackSilent() throw(INTERP_KERNEL::Exception);
492 void pack() const throw(INTERP_KERNEL::Exception);
493 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
494 void fillWithZero() throw(INTERP_KERNEL::Exception);
495 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
496 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
497 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
498 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
499 void reverse() throw(INTERP_KERNEL::Exception);
500 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
501 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
502 std::string repr() const throw(INTERP_KERNEL::Exception);
503 std::string reprZip() const throw(INTERP_KERNEL::Exception);
504 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
505 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
506 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
507 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
508 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
509 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
510 void transpose() throw(INTERP_KERNEL::Exception);
511 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
512 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
513 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
514 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
515 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
516 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
517 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
518 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
519 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
520 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
521 double front() const throw(INTERP_KERNEL::Exception);
522 double back() const throw(INTERP_KERNEL::Exception);
523 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
524 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
525 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
526 double *getPointer() throw(INTERP_KERNEL::Exception);
527 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
528 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
529 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
530 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
531 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
532 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
533 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
534 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
535 double getAverageValue() const throw(INTERP_KERNEL::Exception);
536 double norm2() const throw(INTERP_KERNEL::Exception);
537 double normMax() const throw(INTERP_KERNEL::Exception);
538 double normMin() const throw(INTERP_KERNEL::Exception);
539 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
540 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
541 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
542 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
543 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
544 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
545 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
546 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
550 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
555 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
556 void abs() throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
558 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
559 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
560 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
561 void applyPow(double val) throw(INTERP_KERNEL::Exception);
562 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *applyFunc(const std::string& func) const throw(INTERP_KERNEL::Exception);
567 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
569 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
570 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
571 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
572 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
573 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
574 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
575 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
576 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
577 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
578 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
579 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
580 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
581 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
582 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
583 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
584 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
585 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
586 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
587 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
588 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
591 DataArrayDouble() throw(INTERP_KERNEL::Exception)
593 return DataArrayDouble::New();
596 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
598 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)";
599 std::string msg(msgBase);
601 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
604 if(PyList_Check(elt0) || PyTuple_Check(elt0))
608 if(PyInt_Check(nbOfTuples))
610 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
612 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
615 if(PyInt_Check(elt2))
616 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
617 int nbOfCompo=PyInt_AS_LONG(elt2);
619 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
620 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
621 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
622 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
626 throw INTERP_KERNEL::Exception(msg.c_str());
629 {//DataArrayDouble.New([1.,3.,4.],3)
630 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
632 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
633 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
638 throw INTERP_KERNEL::Exception(msg.c_str());
641 {// DataArrayDouble.New([1.,3.,4.])
642 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
643 int tmpp1=-1,tmpp2=-1;
644 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
645 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
649 else if(PyInt_Check(elt0))
651 int nbOfTuples1=PyInt_AS_LONG(elt0);
653 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
658 if(PyInt_Check(nbOfTuples))
659 {//DataArrayDouble.New(5,2)
660 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
662 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
663 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
664 ret->alloc(nbOfTuples1,nbOfCompo);
668 throw INTERP_KERNEL::Exception(msg.c_str());
671 throw INTERP_KERNEL::Exception(msg.c_str());
674 {//DataArrayDouble.New(5)
675 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
676 ret->alloc(nbOfTuples1,1);
681 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
682 {//DataArrayDouble.New(numpyArray)
683 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
687 throw INTERP_KERNEL::Exception(msg.c_str());
688 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
691 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
693 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
696 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
699 std::vector<double> bb;
701 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
702 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
703 self->pushBackValsSilent(tmp,tmp+nbTuples);
706 std::string __repr__() const throw(INTERP_KERNEL::Exception)
708 std::ostringstream oss;
709 self->reprQuickOverview(oss);
713 std::string __str__() const throw(INTERP_KERNEL::Exception)
718 double __float__() const throw(INTERP_KERNEL::Exception)
720 return self->doubleValue();
723 int __len__() const throw(INTERP_KERNEL::Exception)
725 if(self->isAllocated())
727 return self->getNumberOfTuples();
731 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
735 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
737 return self->iterator();
740 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
742 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 !";
743 if(PyList_Check(li) || PyTuple_Check(li))
747 if(PyInt_Check(nbOfTuples))
749 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
751 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
754 if(PyInt_Check(nbOfComp))
755 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
756 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
758 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
759 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
760 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
763 throw INTERP_KERNEL::Exception(msg);
766 {//DataArrayDouble.setValues([1.,3.,4.],3)
768 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
769 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
773 throw INTERP_KERNEL::Exception(msg);
776 {// DataArrayDouble.setValues([1.,3.,4.])
777 int tmpp1=-1,tmpp2=-1;
778 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
779 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
783 throw INTERP_KERNEL::Exception(msg);
786 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
788 const double *vals=self->getConstPointer();
789 return convertDblArrToPyList(vals,self->getNbOfElems());
793 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
795 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
799 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
802 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
803 PyObject *ret=PyTuple_New(2);
804 PyObject *ret0Py=ret0?Py_True:Py_False;
806 PyTuple_SetItem(ret,0,ret0Py);
807 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
811 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
813 const double *vals=self->getConstPointer();
814 int nbOfComp=self->getNumberOfComponents();
815 int nbOfTuples=self->getNumberOfTuples();
816 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
819 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
822 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
823 if (!SWIG_IsOK(res1))
826 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
827 if(size!=self->getNumberOfTuples())
829 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
831 return self->renumber(tmp);
835 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
837 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
838 da2->checkAllocated();
839 int size=self->getNumberOfTuples();
840 if(size!=self->getNumberOfTuples())
842 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
844 return self->renumber(da2->getConstPointer());
848 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
851 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
852 if (!SWIG_IsOK(res1))
855 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
856 if(size!=self->getNumberOfTuples())
858 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
860 return self->renumberR(tmp);
864 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
866 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
867 da2->checkAllocated();
868 int size=self->getNumberOfTuples();
869 if(size!=self->getNumberOfTuples())
871 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
873 return self->renumberR(da2->getConstPointer());
877 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
880 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
881 if (!SWIG_IsOK(res1))
884 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
885 if(size!=self->getNumberOfTuples())
887 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
889 return self->renumberAndReduce(tmp,newNbOfTuple);
893 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
895 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
896 da2->checkAllocated();
897 int size=self->getNumberOfTuples();
898 if(size!=self->getNumberOfTuples())
900 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
902 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
906 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
908 int thisTupleId,otherTupleId;
909 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
910 PyObject *ret=PyTuple_New(3);
911 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
912 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
913 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
917 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
920 double r1=self->getMaxValue(tmp);
921 PyObject *ret=PyTuple_New(2);
922 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
923 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
927 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
930 double r1=self->getMaxValue2(tmp);
931 PyObject *ret=PyTuple_New(2);
932 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
933 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
937 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
940 double r1=self->getMinValue(tmp);
941 PyObject *ret=PyTuple_New(2);
942 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
943 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
947 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
950 double r1=self->getMinValue2(tmp);
951 PyObject *ret=PyTuple_New(2);
952 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
953 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
957 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
959 int nbOfCompo=self->getNumberOfComponents();
960 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
961 self->getMinMaxPerComponent(tmp);
962 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
966 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
968 int sz=self->getNumberOfComponents();
969 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
970 self->accumulate(tmp);
971 return convertDblArrToPyList(tmp,sz);
974 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
977 std::vector<int> val2;
978 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
979 return self->accumulatePerChunck(bg,bg+sz);
982 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
984 DataArrayInt *comm, *commIndex;
985 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
986 PyObject *res = PyList_New(2);
987 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
988 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
992 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
996 DataArrayDoubleTuple *aa;
997 std::vector<double> bb;
999 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1000 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1002 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1003 PyObject *ret=PyTuple_New(2);
1004 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1005 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1009 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1011 std::vector<int> tmp;
1012 convertPyToNewIntArr3(li,tmp);
1013 self->setSelectedComponents(a,tmp);
1016 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1018 int sz=self->getNumberOfComponents();
1019 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1020 self->getTuple(tupleId,tmp);
1021 return convertDblArrToPyList(tmp,sz);
1024 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1026 std::vector<const DataArrayDouble *> tmp;
1027 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1028 return DataArrayDouble::Aggregate(tmp);
1031 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1033 std::vector<const DataArrayDouble *> tmp;
1034 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1035 return DataArrayDouble::Meld(tmp);
1038 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1042 DataArrayDoubleTuple *aa;
1043 std::vector<double> bb;
1045 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1046 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1047 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1048 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1049 DataArrayInt *c=0,*cI=0;
1050 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1051 PyObject *ret=PyTuple_New(2);
1052 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1053 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1057 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1059 DataArrayInt *ret1=0;
1060 bool ret0=self->areIncludedInMe(other,prec,ret1);
1061 PyObject *ret=PyTuple_New(2);
1062 PyObject *ret0Py=ret0?Py_True:Py_False;
1064 PyTuple_SetItem(ret,0,ret0Py);
1065 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1069 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1071 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1072 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1073 self->checkAllocated();
1074 int nbOfTuples=self->getNumberOfTuples();
1075 int nbOfComponents=self->getNumberOfComponents();
1077 std::vector<int> vt1,vc1;
1078 std::pair<int, std::pair<int,int> > pt1,pc1;
1079 DataArrayInt *dt1=0,*dc1=0;
1081 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1082 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1086 if(nbOfComponents==1)
1087 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1088 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1090 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1092 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1094 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1096 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1099 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1100 std::vector<int> v2(1,ic1);
1101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1105 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1106 std::vector<int> v2(1,ic1);
1107 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1111 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1112 std::vector<int> v2(1,ic1);
1113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1117 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1122 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1123 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1127 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1132 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1133 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1137 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1138 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1139 std::vector<int> v2(nbOfComp);
1140 for(int i=0;i<nbOfComp;i++)
1141 v2[i]=pc1.first+i*pc1.second.second;
1142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1146 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1147 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1148 std::vector<int> v2(nbOfComp);
1149 for(int i=0;i<nbOfComp;i++)
1150 v2[i]=pc1.first+i*pc1.second.second;
1151 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1155 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1156 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1157 std::vector<int> v2(nbOfComp);
1158 for(int i=0;i<nbOfComp;i++)
1159 v2[i]=pc1.first+i*pc1.second.second;
1160 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1164 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1165 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1166 std::vector<int> v2(nbOfComp);
1167 for(int i=0;i<nbOfComp;i++)
1168 v2[i]=pc1.first+i*pc1.second.second;
1169 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1172 throw INTERP_KERNEL::Exception(msg);
1176 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1178 self->checkAllocated();
1179 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1180 int nbOfTuples=self->getNumberOfTuples();
1181 int nbOfComponents=self->getNumberOfComponents();
1184 std::vector<double> v1;
1185 DataArrayDouble *d1=0;
1186 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1188 std::vector<int> vt1,vc1;
1189 std::pair<int, std::pair<int,int> > pt1,pc1;
1190 DataArrayInt *dt1=0,*dc1=0;
1191 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1192 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1200 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1203 tmp=DataArrayDouble::New();
1204 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1205 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1208 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1211 throw INTERP_KERNEL::Exception(msg);
1220 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1223 tmp=DataArrayDouble::New();
1224 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1225 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1228 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1231 throw INTERP_KERNEL::Exception(msg);
1240 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1243 tmp=DataArrayDouble::New();
1244 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1245 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1248 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1251 throw INTERP_KERNEL::Exception(msg);
1260 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1263 tmp=DataArrayDouble::New();
1264 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1265 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1268 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1271 throw INTERP_KERNEL::Exception(msg);
1280 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1283 tmp=DataArrayDouble::New();
1284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1285 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1288 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1291 throw INTERP_KERNEL::Exception(msg);
1300 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1303 tmp=DataArrayDouble::New();
1304 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1305 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1308 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1311 throw INTERP_KERNEL::Exception(msg);
1320 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1323 tmp=DataArrayDouble::New();
1324 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1325 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1328 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1331 throw INTERP_KERNEL::Exception(msg);
1340 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1343 tmp=DataArrayDouble::New();
1344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1345 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1348 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1351 throw INTERP_KERNEL::Exception(msg);
1360 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1363 tmp=DataArrayDouble::New();
1364 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1365 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1368 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1371 throw INTERP_KERNEL::Exception(msg);
1380 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1383 tmp=DataArrayDouble::New();
1384 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1385 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1388 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1391 throw INTERP_KERNEL::Exception(msg);
1400 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1403 tmp=DataArrayDouble::New();
1404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1405 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1408 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1411 throw INTERP_KERNEL::Exception(msg);
1420 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1423 tmp=DataArrayDouble::New();
1424 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1425 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1428 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1431 throw INTERP_KERNEL::Exception(msg);
1440 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1443 tmp=DataArrayDouble::New();
1444 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1445 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1448 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1451 throw INTERP_KERNEL::Exception(msg);
1460 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1463 tmp=DataArrayDouble::New();
1464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1465 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1468 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1471 throw INTERP_KERNEL::Exception(msg);
1480 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1483 tmp=DataArrayDouble::New();
1484 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1485 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1488 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1491 throw INTERP_KERNEL::Exception(msg);
1500 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1503 tmp=DataArrayDouble::New();
1504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1505 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1508 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1511 throw INTERP_KERNEL::Exception(msg);
1516 throw INTERP_KERNEL::Exception(msg);
1521 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1523 return self->negate();
1526 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1528 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1531 DataArrayDoubleTuple *aa;
1532 std::vector<double> bb;
1535 #ifndef WITHOUT_AUTOFIELD
1537 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1539 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1542 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1543 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1545 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1548 throw INTERP_KERNEL::Exception(msg);
1552 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1557 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1558 ret->applyLin(1.,val);
1559 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1563 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1567 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1568 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1572 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1573 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1576 throw INTERP_KERNEL::Exception(msg);
1580 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1582 const char msg[]="Unexpected situation in __radd__ !";
1585 DataArrayDoubleTuple *aa;
1586 std::vector<double> bb;
1588 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1593 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1594 ret->applyLin(1.,val);
1599 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1600 return DataArrayDouble::Add(self,aaa);
1604 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1605 return DataArrayDouble::Add(self,aaa);
1608 throw INTERP_KERNEL::Exception(msg);
1612 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1614 const char msg[]="Unexpected situation in __iadd__ !";
1617 DataArrayDoubleTuple *aa;
1618 std::vector<double> bb;
1620 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1625 self->applyLin(1.,val);
1626 Py_XINCREF(trueSelf);
1632 Py_XINCREF(trueSelf);
1637 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1638 self->addEqual(aaa);
1639 Py_XINCREF(trueSelf);
1644 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1645 self->addEqual(aaa);
1646 Py_XINCREF(trueSelf);
1650 throw INTERP_KERNEL::Exception(msg);
1654 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1656 const char msg[]="Unexpected situation in __sub__ !";
1659 DataArrayDoubleTuple *aa;
1660 std::vector<double> bb;
1663 #ifndef WITHOUT_AUTOFIELD
1665 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1667 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1670 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1671 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1673 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1676 throw INTERP_KERNEL::Exception(msg);
1680 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1686 ret->applyLin(1.,-val);
1687 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1691 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1695 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1696 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1700 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1701 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1704 throw INTERP_KERNEL::Exception(msg);
1708 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1710 const char msg[]="Unexpected situation in __rsub__ !";
1713 DataArrayDoubleTuple *aa;
1714 std::vector<double> bb;
1716 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1721 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1722 ret->applyLin(-1.,val);
1727 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1728 return DataArrayDouble::Substract(aaa,self);
1732 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1733 return DataArrayDouble::Substract(aaa,self);
1736 throw INTERP_KERNEL::Exception(msg);
1740 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1742 const char msg[]="Unexpected situation in __isub__ !";
1745 DataArrayDoubleTuple *aa;
1746 std::vector<double> bb;
1748 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1753 self->applyLin(1,-val);
1754 Py_XINCREF(trueSelf);
1759 self->substractEqual(a);
1760 Py_XINCREF(trueSelf);
1765 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1766 self->substractEqual(aaa);
1767 Py_XINCREF(trueSelf);
1772 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1773 self->substractEqual(aaa);
1774 Py_XINCREF(trueSelf);
1778 throw INTERP_KERNEL::Exception(msg);
1782 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1784 const char msg[]="Unexpected situation in __mul__ !";
1787 DataArrayDoubleTuple *aa;
1788 std::vector<double> bb;
1791 #ifndef WITHOUT_AUTOFIELD
1793 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1795 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1798 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1799 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1801 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1804 throw INTERP_KERNEL::Exception(msg);
1808 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1814 ret->applyLin(val,0.);
1815 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1819 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1824 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1828 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1829 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1832 throw INTERP_KERNEL::Exception(msg);
1836 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1838 const char msg[]="Unexpected situation in __rmul__ !";
1841 DataArrayDoubleTuple *aa;
1842 std::vector<double> bb;
1844 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1849 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1850 ret->applyLin(val,0.);
1855 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1856 return DataArrayDouble::Multiply(self,aaa);
1860 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1861 return DataArrayDouble::Multiply(self,aaa);
1864 throw INTERP_KERNEL::Exception(msg);
1868 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1870 const char msg[]="Unexpected situation in __imul__ !";
1873 DataArrayDoubleTuple *aa;
1874 std::vector<double> bb;
1876 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1881 self->applyLin(val,0.);
1882 Py_XINCREF(trueSelf);
1887 self->multiplyEqual(a);
1888 Py_XINCREF(trueSelf);
1893 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1894 self->multiplyEqual(aaa);
1895 Py_XINCREF(trueSelf);
1900 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1901 self->multiplyEqual(aaa);
1902 Py_XINCREF(trueSelf);
1906 throw INTERP_KERNEL::Exception(msg);
1910 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1912 const char msg[]="Unexpected situation in __div__ !";
1915 DataArrayDoubleTuple *aa;
1916 std::vector<double> bb;
1919 #ifndef WITHOUT_AUTOFIELD
1921 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1923 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1926 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1927 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1929 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1932 throw INTERP_KERNEL::Exception(msg);
1936 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1942 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1943 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1944 ret->applyLin(1/val,0.);
1945 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1949 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1953 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1954 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1958 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1959 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1962 throw INTERP_KERNEL::Exception(msg);
1966 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1968 const char msg[]="Unexpected situation in __rdiv__ !";
1971 DataArrayDoubleTuple *aa;
1972 std::vector<double> bb;
1974 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1979 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1985 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1986 return DataArrayDouble::Divide(aaa,self);
1990 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1991 return DataArrayDouble::Divide(aaa,self);
1994 throw INTERP_KERNEL::Exception(msg);
1998 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2000 const char msg[]="Unexpected situation in __idiv__ !";
2003 DataArrayDoubleTuple *aa;
2004 std::vector<double> bb;
2006 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2012 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2013 self->applyLin(1./val,0.);
2014 Py_XINCREF(trueSelf);
2019 self->divideEqual(a);
2020 Py_XINCREF(trueSelf);
2025 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2026 self->divideEqual(aaa);
2027 Py_XINCREF(trueSelf);
2032 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2033 self->divideEqual(aaa);
2034 Py_XINCREF(trueSelf);
2038 throw INTERP_KERNEL::Exception(msg);
2042 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2044 const char msg[]="Unexpected situation in __pow__ !";
2047 DataArrayDoubleTuple *aa;
2048 std::vector<double> bb;
2050 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2055 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2061 return DataArrayDouble::Pow(self,a);
2065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2066 return DataArrayDouble::Pow(self,aaa);
2070 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2071 return DataArrayDouble::Pow(self,aaa);
2074 throw INTERP_KERNEL::Exception(msg);
2078 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2080 const char msg[]="Unexpected situation in __rpow__ !";
2083 DataArrayDoubleTuple *aa;
2084 std::vector<double> bb;
2086 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2091 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2092 ret->applyRPow(val);
2097 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2098 return DataArrayDouble::Pow(aaa,self);
2102 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2103 return DataArrayDouble::Pow(aaa,self);
2106 throw INTERP_KERNEL::Exception(msg);
2110 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2112 const char msg[]="Unexpected situation in __ipow__ !";
2115 DataArrayDoubleTuple *aa;
2116 std::vector<double> bb;
2118 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2123 self->applyPow(val);
2124 Py_XINCREF(trueSelf);
2130 Py_XINCREF(trueSelf);
2135 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2136 self->powEqual(aaa);
2137 Py_XINCREF(trueSelf);
2142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2143 self->powEqual(aaa);
2144 Py_XINCREF(trueSelf);
2148 throw INTERP_KERNEL::Exception(msg);
2152 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2154 DataArrayInt *c=0,*cI=0;
2156 self->computeTupleIdsNearTuples(other,eps,c,cI);
2157 PyObject *ret=PyTuple_New(2);
2158 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2163 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2165 DataArrayInt *ret1=0;
2166 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2167 PyObject *ret=PyTuple_New(2);
2168 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2169 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2175 class DataArrayDoubleTuple;
2177 class DataArrayDoubleIterator
2180 DataArrayDoubleIterator(DataArrayDouble *da);
2181 ~DataArrayDoubleIterator();
2186 DataArrayDoubleTuple *ret=self->nextt();
2188 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2191 PyErr_SetString(PyExc_StopIteration,"No more data.");
2198 class DataArrayDoubleTuple
2201 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2202 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2205 std::string __str__() const throw(INTERP_KERNEL::Exception)
2207 return self->repr();
2210 double __float__() const throw(INTERP_KERNEL::Exception)
2212 return self->doubleValue();
2215 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2217 return self->buildDADouble(1,self->getNumberOfCompo());
2220 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2222 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2223 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2224 Py_XINCREF(trueSelf);
2228 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2230 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2231 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2232 Py_XINCREF(trueSelf);
2236 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2238 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2239 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2240 Py_XINCREF(trueSelf);
2244 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2246 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2247 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2248 Py_XINCREF(trueSelf);
2252 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2254 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2257 std::vector<int> multiVal;
2258 std::pair<int, std::pair<int,int> > slic;
2259 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2260 const double *pt=self->getConstPointer();
2261 int nbc=self->getNumberOfCompo();
2262 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2269 std::ostringstream oss;
2270 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2271 throw INTERP_KERNEL::Exception(oss.str().c_str());
2274 return PyFloat_FromDouble(pt[singleVal]);
2278 return PyFloat_FromDouble(pt[nbc+singleVal]);
2281 std::ostringstream oss;
2282 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2283 throw INTERP_KERNEL::Exception(oss.str().c_str());
2289 PyObject *t=PyTuple_New(multiVal.size());
2290 for(int j=0;j<(int)multiVal.size();j++)
2292 int cid=multiVal[j];
2295 std::ostringstream oss;
2296 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2297 throw INTERP_KERNEL::Exception(oss.str().c_str());
2299 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2305 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2306 PyObject *t=PyTuple_New(sz);
2307 for(int j=0;j<sz;j++)
2308 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2312 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2316 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2318 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2319 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2322 std::vector<double> multiValV;
2323 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2324 int nbc=self->getNumberOfCompo();
2325 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2327 std::vector<int> multiVal;
2328 std::pair<int, std::pair<int,int> > slic;
2329 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2330 double *pt=self->getPointer();
2331 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2338 std::ostringstream oss;
2339 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2340 throw INTERP_KERNEL::Exception(oss.str().c_str());
2346 pt[singleVal]=singleValV;
2351 if(multiValV.size()!=1)
2353 std::ostringstream oss;
2354 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2355 throw INTERP_KERNEL::Exception(oss.str().c_str());
2357 pt[singleVal]=multiValV[0];
2362 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2366 throw INTERP_KERNEL::Exception(msg);
2375 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2379 std::ostringstream oss;
2380 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2381 throw INTERP_KERNEL::Exception(oss.str().c_str());
2389 if(multiVal.size()!=multiValV.size())
2391 std::ostringstream oss;
2392 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2393 throw INTERP_KERNEL::Exception(oss.str().c_str());
2395 for(int i=0;i<(int)multiVal.size();i++)
2397 int pos=multiVal[i];
2400 std::ostringstream oss;
2401 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2402 throw INTERP_KERNEL::Exception(oss.str().c_str());
2404 pt[multiVal[i]]=multiValV[i];
2410 const double *ptV=daIntTyyppV->getConstPointer();
2411 if(nbc>daIntTyyppV->getNumberOfCompo())
2413 std::ostringstream oss;
2414 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2415 throw INTERP_KERNEL::Exception(oss.str().c_str());
2417 std::copy(ptV,ptV+nbc,pt);
2421 throw INTERP_KERNEL::Exception(msg);
2426 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2431 for(int j=0;j<sz;j++)
2432 pt[slic.first+j*slic.second.second]=singleValV;
2437 if(sz!=(int)multiValV.size())
2439 std::ostringstream oss;
2440 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2441 throw INTERP_KERNEL::Exception(oss.str().c_str());
2443 for(int j=0;j<sz;j++)
2444 pt[slic.first+j*slic.second.second]=multiValV[j];
2449 const double *ptV=daIntTyyppV->getConstPointer();
2450 if(sz>daIntTyyppV->getNumberOfCompo())
2452 std::ostringstream oss;
2453 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2454 throw INTERP_KERNEL::Exception(oss.str().c_str());
2456 for(int j=0;j<sz;j++)
2457 pt[slic.first+j*slic.second.second]=ptV[j];
2461 throw INTERP_KERNEL::Exception(msg);
2465 throw INTERP_KERNEL::Exception(msg);
2471 class DataArrayIntIterator;
2473 class DataArrayInt : public DataArray
2476 static DataArrayInt *New();
2477 int intValue() const throw(INTERP_KERNEL::Exception);
2478 int getHashCode() const throw(INTERP_KERNEL::Exception);
2479 bool empty() const throw(INTERP_KERNEL::Exception);
2480 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2481 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2482 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2483 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2484 int popBackSilent() throw(INTERP_KERNEL::Exception);
2485 void pack() const throw(INTERP_KERNEL::Exception);
2486 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2487 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2488 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2489 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2490 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2491 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2492 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2493 void reverse() throw(INTERP_KERNEL::Exception);
2494 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2495 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2496 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2497 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2498 void fillWithZero() throw(INTERP_KERNEL::Exception);
2499 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2500 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2501 std::string repr() const throw(INTERP_KERNEL::Exception);
2502 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2503 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2504 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2505 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2506 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2507 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2508 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2509 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2510 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2511 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2512 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2513 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2514 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2515 void transpose() throw(INTERP_KERNEL::Exception);
2516 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2517 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2518 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2519 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2520 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2521 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2522 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2523 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2524 int front() const throw(INTERP_KERNEL::Exception);
2525 int back() const throw(INTERP_KERNEL::Exception);
2526 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2527 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2528 int *getPointer() throw(INTERP_KERNEL::Exception);
2529 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2530 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2531 const int *begin() const throw(INTERP_KERNEL::Exception);
2532 const int *end() const throw(INTERP_KERNEL::Exception);
2533 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2534 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2535 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2536 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2537 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2538 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2539 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2540 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2541 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2542 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2543 int count(int value) const throw(INTERP_KERNEL::Exception);
2544 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2545 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2546 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2547 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2548 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2549 void abs() throw(INTERP_KERNEL::Exception);
2550 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2551 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2552 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2553 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2554 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2555 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2556 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2557 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2558 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2559 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2560 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2561 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2562 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2563 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2564 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2565 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2566 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2567 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2568 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2569 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2570 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2572 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2573 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2574 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2575 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2576 void computeOffsets() throw(INTERP_KERNEL::Exception);
2577 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2578 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2583 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2584 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2585 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2586 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2587 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2588 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2589 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2590 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2591 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2592 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2593 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2594 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2596 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2599 DataArrayInt() throw(INTERP_KERNEL::Exception)
2601 return DataArrayInt::New();
2604 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2606 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)";
2607 std::string msg(msgBase);
2609 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2612 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2616 if(PyInt_Check(nbOfTuples))
2618 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2620 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2623 if(PyInt_Check(nbOfComp))
2624 {//DataArrayInt.New([1,3,4,5],2,2)
2625 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2627 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2628 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2629 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2630 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2634 throw INTERP_KERNEL::Exception(msg.c_str());
2637 {//DataArrayInt.New([1,3,4],3)
2638 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2640 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2641 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2646 throw INTERP_KERNEL::Exception(msg.c_str());
2649 {// DataArrayInt.New([1,3,4])
2650 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2651 int tmpp1=-1,tmpp2=-1;
2652 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2653 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2657 else if(PyInt_Check(elt0))
2659 int nbOfTuples1=PyInt_AS_LONG(elt0);
2661 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2666 if(PyInt_Check(nbOfTuples))
2667 {//DataArrayInt.New(5,2)
2668 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2670 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2671 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2672 ret->alloc(nbOfTuples1,nbOfCompo);
2676 throw INTERP_KERNEL::Exception(msg.c_str());
2679 throw INTERP_KERNEL::Exception(msg.c_str());
2682 {//DataArrayInt.New(5)
2683 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2684 ret->alloc(nbOfTuples1,1);
2689 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2690 {//DataArrayInt.New(numpyArray)
2691 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2695 throw INTERP_KERNEL::Exception(msg.c_str());
2696 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2699 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2701 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2704 std::string __str__() const throw(INTERP_KERNEL::Exception)
2706 return self->repr();
2709 int __len__() const throw(INTERP_KERNEL::Exception)
2711 if(self->isAllocated())
2713 return self->getNumberOfTuples();
2717 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2721 int __int__() const throw(INTERP_KERNEL::Exception)
2723 return self->intValue();
2726 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2728 return self->iterator();
2731 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2733 int sz=self->getNumberOfComponents();
2734 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2735 self->accumulate(tmp);
2736 return convertIntArrToPyList(tmp,sz);
2739 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2742 std::vector<int> val2;
2743 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2744 return self->accumulatePerChunck(bg,bg+sz);
2747 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2750 std::vector<int> val2;
2751 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2752 return self->getIdsEqualTuple(bg,bg+sz);
2755 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2757 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2758 PyObject *ret=PyList_New(slcs.size());
2759 for(std::size_t i=0;i<slcs.size();i++)
2760 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2764 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2766 if(!PySlice_Check(slic))
2767 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2768 Py_ssize_t strt=2,stp=2,step=2;
2769 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2770 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2771 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2772 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 !");
2773 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2776 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2778 int newNbOfTuples=-1;
2779 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2780 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2781 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2782 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2783 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2784 PyObject *ret=PyTuple_New(2);
2785 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2786 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2790 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2792 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 !";
2793 if(PyList_Check(li) || PyTuple_Check(li))
2797 if(PyInt_Check(nbOfTuples))
2799 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2801 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2804 if(PyInt_Check(nbOfComp))
2805 {//DataArrayInt.setValues([1,3,4,5],2,2)
2806 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2808 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2809 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2810 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2813 throw INTERP_KERNEL::Exception(msg);
2816 {//DataArrayInt.setValues([1,3,4],3)
2818 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2819 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2823 throw INTERP_KERNEL::Exception(msg);
2826 {// DataArrayInt.setValues([1,3,4])
2827 int tmpp1=-1,tmpp2=-1;
2828 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2829 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2833 throw INTERP_KERNEL::Exception(msg);
2836 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2838 const int *vals=self->getConstPointer();
2839 return convertIntArrToPyList(vals,self->getNbOfElems());
2843 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2845 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2849 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2852 bool ret0=self->isEqualIfNotWhy(other,ret1);
2853 PyObject *ret=PyTuple_New(2);
2854 PyObject *ret0Py=ret0?Py_True:Py_False;
2856 PyTuple_SetItem(ret,0,ret0Py);
2857 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2861 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2863 const int *vals=self->getConstPointer();
2864 int nbOfComp=self->getNumberOfComponents();
2865 int nbOfTuples=self->getNumberOfTuples();
2866 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2869 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2871 std::vector<const DataArrayInt *> groups;
2872 std::vector< std::vector<int> > fidsOfGroups;
2873 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2874 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2875 PyObject *ret = PyList_New(2);
2876 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2877 int sz=fidsOfGroups.size();
2878 PyObject *ret1 = PyList_New(sz);
2879 for(int i=0;i<sz;i++)
2880 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2881 PyList_SetItem(ret,1,ret1);
2885 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2888 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2889 if (!SWIG_IsOK(res1))
2892 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2893 self->transformWithIndArr(tmp,tmp+size);
2897 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2898 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2902 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2906 std::vector<int> multiVal;
2907 std::pair<int, std::pair<int,int> > slic;
2908 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2909 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2913 return self->getIdsEqualList(&singleVal,&singleVal+1);
2915 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2917 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2919 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2923 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2927 std::vector<int> multiVal;
2928 std::pair<int, std::pair<int,int> > slic;
2929 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2930 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2934 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2936 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2938 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2940 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2944 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2946 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2948 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2949 if (!SWIG_IsOK(res1))
2952 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2953 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2957 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2959 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2960 da2->checkAllocated();
2961 int size=self->getNumberOfTuples();
2962 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2964 PyObject *ret = PyList_New(3);
2965 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2966 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2967 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2971 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2974 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2975 if (!SWIG_IsOK(res1))
2978 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2979 return self->transformWithIndArrR(tmp,tmp+size);
2983 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2984 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2988 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2991 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2992 if (!SWIG_IsOK(res1))
2995 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2996 if(size!=self->getNumberOfTuples())
2998 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3000 return self->renumberAndReduce(tmp,newNbOfTuple);
3004 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3006 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3007 da2->checkAllocated();
3008 int size=self->getNumberOfTuples();
3009 if(size!=self->getNumberOfTuples())
3011 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3013 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3017 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3020 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3021 if (!SWIG_IsOK(res1))
3024 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3025 if(size!=self->getNumberOfTuples())
3027 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3029 return self->renumber(tmp);
3033 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3035 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3036 da2->checkAllocated();
3037 int size=self->getNumberOfTuples();
3038 if(size!=self->getNumberOfTuples())
3040 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3042 return self->renumber(da2->getConstPointer());
3046 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3049 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3050 if (!SWIG_IsOK(res1))
3053 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3054 if(size!=self->getNumberOfTuples())
3056 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3058 return self->renumberR(tmp);
3062 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3064 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3065 da2->checkAllocated();
3066 int size=self->getNumberOfTuples();
3067 if(size!=self->getNumberOfTuples())
3069 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3071 return self->renumberR(da2->getConstPointer());
3075 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3077 std::vector<int> tmp;
3078 convertPyToNewIntArr3(li,tmp);
3079 self->setSelectedComponents(a,tmp);
3082 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3084 int sz=self->getNumberOfComponents();
3085 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3086 self->getTuple(tupleId,tmp);
3087 return convertIntArrToPyList(tmp,sz);
3090 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3092 DataArrayInt *arr=0;
3093 DataArrayInt *arrI=0;
3094 self->changeSurjectiveFormat(targetNb,arr,arrI);
3095 PyObject *res = PyList_New(2);
3096 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3097 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3101 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3103 std::vector<const DataArrayInt *> tmp;
3104 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3105 return DataArrayInt::Meld(tmp);
3108 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3110 std::vector<const DataArrayInt *> tmp;
3111 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3112 return DataArrayInt::Aggregate(tmp);
3115 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3117 std::vector<const DataArrayInt *> tmp;
3118 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3119 return DataArrayInt::AggregateIndexes(tmp);
3122 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3124 std::vector<const DataArrayInt *> tmp;
3125 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3126 return DataArrayInt::BuildUnion(tmp);
3129 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3131 std::vector<const DataArrayInt *> tmp;
3132 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3133 return DataArrayInt::BuildIntersection(tmp);
3136 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3139 int r1=self->getMaxValue(tmp);
3140 PyObject *ret=PyTuple_New(2);
3141 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3142 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3146 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3149 int r1=self->getMinValue(tmp);
3150 PyObject *ret=PyTuple_New(2);
3151 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3152 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3156 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3158 int nbOfCompo=self->getNumberOfComponents();
3163 if(PyInt_Check(obj))
3165 int val=(int)PyInt_AS_LONG(obj);
3166 return self->locateValue(val);
3169 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3173 std::vector<int> arr;
3174 convertPyToNewIntArr3(obj,arr);
3175 return self->locateTuple(arr);
3180 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3182 int nbOfCompo=self->getNumberOfComponents();
3189 if(PyInt_Check(obj))
3191 int val=(int)PyInt_AS_LONG(obj);
3192 return self->presenceOfValue(val);
3195 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3199 std::vector<int> arr;
3200 convertPyToNewIntArr3(obj,arr);
3201 return self->presenceOfTuple(arr);
3206 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3208 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3209 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3210 self->checkAllocated();
3211 int nbOfTuples=self->getNumberOfTuples();
3212 int nbOfComponents=self->getNumberOfComponents();
3214 std::vector<int> vt1,vc1;
3215 std::pair<int, std::pair<int,int> > pt1,pc1;
3216 DataArrayInt *dt1=0,*dc1=0;
3218 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3219 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3224 if(nbOfComponents==1)
3225 return PyInt_FromLong(self->getIJSafe(it1,0));
3226 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3229 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3231 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3233 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3235 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3238 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3239 std::vector<int> v2(1,ic1);
3240 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3244 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3245 std::vector<int> v2(1,ic1);
3246 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3250 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3251 std::vector<int> v2(1,ic1);
3252 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3256 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3257 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3261 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3262 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3266 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3267 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3271 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3272 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3276 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3277 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3278 std::vector<int> v2(nbOfComp);
3279 for(int i=0;i<nbOfComp;i++)
3280 v2[i]=pc1.first+i*pc1.second.second;
3281 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3285 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3286 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3287 std::vector<int> v2(nbOfComp);
3288 for(int i=0;i<nbOfComp;i++)
3289 v2[i]=pc1.first+i*pc1.second.second;
3290 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3294 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3295 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3296 std::vector<int> v2(nbOfComp);
3297 for(int i=0;i<nbOfComp;i++)
3298 v2[i]=pc1.first+i*pc1.second.second;
3299 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3303 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3304 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3305 std::vector<int> v2(nbOfComp);
3306 for(int i=0;i<nbOfComp;i++)
3307 v2[i]=pc1.first+i*pc1.second.second;
3308 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3311 throw INTERP_KERNEL::Exception(msg);
3315 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3317 self->checkAllocated();
3318 const char msg[]="Unexpected situation in __setitem__ !";
3319 int nbOfTuples=self->getNumberOfTuples();
3320 int nbOfComponents=self->getNumberOfComponents();
3323 std::vector<int> v1;
3325 DataArrayIntTuple *dd1=0;
3326 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3328 std::vector<int> vt1,vc1;
3329 std::pair<int, std::pair<int,int> > pt1,pc1;
3330 DataArrayInt *dt1=0,*dc1=0;
3331 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3332 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3340 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3343 tmp=DataArrayInt::New();
3344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3345 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3348 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3351 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3352 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3355 throw INTERP_KERNEL::Exception(msg);
3364 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3367 tmp=DataArrayInt::New();
3368 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3369 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3372 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3375 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3376 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3379 throw INTERP_KERNEL::Exception(msg);
3388 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3391 tmp=DataArrayInt::New();
3392 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3393 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3396 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3399 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3400 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3403 throw INTERP_KERNEL::Exception(msg);
3412 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3415 tmp=DataArrayInt::New();
3416 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3417 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3420 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3423 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3424 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3427 throw INTERP_KERNEL::Exception(msg);
3436 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3439 tmp=DataArrayInt::New();
3440 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3441 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3444 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3447 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3448 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3451 throw INTERP_KERNEL::Exception(msg);
3460 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3463 tmp=DataArrayInt::New();
3464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3465 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3468 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3471 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3472 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3475 throw INTERP_KERNEL::Exception(msg);
3484 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3487 tmp=DataArrayInt::New();
3488 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3489 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3492 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3495 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3496 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3499 throw INTERP_KERNEL::Exception(msg);
3508 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3511 tmp=DataArrayInt::New();
3512 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3513 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3516 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3519 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3520 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3523 throw INTERP_KERNEL::Exception(msg);
3532 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3535 tmp=DataArrayInt::New();
3536 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3537 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3540 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3543 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3544 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3547 throw INTERP_KERNEL::Exception(msg);
3556 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3559 tmp=DataArrayInt::New();
3560 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3561 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3564 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3567 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3568 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3571 throw INTERP_KERNEL::Exception(msg);
3580 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3583 tmp=DataArrayInt::New();
3584 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3585 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3588 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3591 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3592 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3595 throw INTERP_KERNEL::Exception(msg);
3604 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3607 tmp=DataArrayInt::New();
3608 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3609 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3612 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3615 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3616 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3619 throw INTERP_KERNEL::Exception(msg);
3628 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3631 tmp=DataArrayInt::New();
3632 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3633 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3636 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3639 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3640 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3643 throw INTERP_KERNEL::Exception(msg);
3652 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3655 tmp=DataArrayInt::New();
3656 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3657 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3660 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3663 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3664 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3667 throw INTERP_KERNEL::Exception(msg);
3676 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3679 tmp=DataArrayInt::New();
3680 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3681 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3684 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3687 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3688 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3691 throw INTERP_KERNEL::Exception(msg);
3700 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3703 tmp=DataArrayInt::New();
3704 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3705 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3708 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3711 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3712 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3715 throw INTERP_KERNEL::Exception(msg);
3720 throw INTERP_KERNEL::Exception(msg);
3725 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3727 return self->negate();
3730 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3732 const char msg[]="Unexpected situation in __add__ !";
3735 std::vector<int> aa;
3736 DataArrayIntTuple *aaa;
3738 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3743 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3744 ret->applyLin(1,val);
3749 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3750 return DataArrayInt::Add(self,aaaa);
3754 return DataArrayInt::Add(self,a);
3758 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3759 return DataArrayInt::Add(self,aaaa);
3762 throw INTERP_KERNEL::Exception(msg);
3766 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3768 const char msg[]="Unexpected situation in __radd__ !";
3771 std::vector<int> aa;
3772 DataArrayIntTuple *aaa;
3774 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3779 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3780 ret->applyLin(1,val);
3785 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3786 return DataArrayInt::Add(self,aaaa);
3790 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3791 return DataArrayInt::Add(self,aaaa);
3794 throw INTERP_KERNEL::Exception(msg);
3798 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3800 const char msg[]="Unexpected situation in __iadd__ !";
3803 std::vector<int> aa;
3804 DataArrayIntTuple *aaa;
3806 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3811 self->applyLin(1,val);
3812 Py_XINCREF(trueSelf);
3817 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3819 Py_XINCREF(trueSelf);
3825 Py_XINCREF(trueSelf);
3830 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3831 self->addEqual(aaaa);
3832 Py_XINCREF(trueSelf);
3836 throw INTERP_KERNEL::Exception(msg);
3840 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3842 const char msg[]="Unexpected situation in __sub__ !";
3845 std::vector<int> aa;
3846 DataArrayIntTuple *aaa;
3848 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3853 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3854 ret->applyLin(1,-val);
3859 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3860 return DataArrayInt::Substract(self,aaaa);
3864 return DataArrayInt::Substract(self,a);
3868 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3869 return DataArrayInt::Substract(self,aaaa);
3872 throw INTERP_KERNEL::Exception(msg);
3876 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3878 const char msg[]="Unexpected situation in __rsub__ !";
3881 std::vector<int> aa;
3882 DataArrayIntTuple *aaa;
3884 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3889 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3890 ret->applyLin(-1,val);
3895 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3896 return DataArrayInt::Substract(aaaa,self);
3900 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3901 return DataArrayInt::Substract(aaaa,self);
3904 throw INTERP_KERNEL::Exception(msg);
3908 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3910 const char msg[]="Unexpected situation in __isub__ !";
3913 std::vector<int> aa;
3914 DataArrayIntTuple *aaa;
3916 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3921 self->applyLin(1,-val);
3922 Py_XINCREF(trueSelf);
3927 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3928 self->substractEqual(bb);
3929 Py_XINCREF(trueSelf);
3934 self->substractEqual(a);
3935 Py_XINCREF(trueSelf);
3940 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3941 self->substractEqual(aaaa);
3942 Py_XINCREF(trueSelf);
3946 throw INTERP_KERNEL::Exception(msg);
3950 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3952 const char msg[]="Unexpected situation in __mul__ !";
3955 std::vector<int> aa;
3956 DataArrayIntTuple *aaa;
3958 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3963 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3964 ret->applyLin(val,0);
3969 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3970 return DataArrayInt::Multiply(self,aaaa);
3974 return DataArrayInt::Multiply(self,a);
3978 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3979 return DataArrayInt::Multiply(self,aaaa);
3982 throw INTERP_KERNEL::Exception(msg);
3986 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3988 const char msg[]="Unexpected situation in __rmul__ !";
3991 std::vector<int> aa;
3992 DataArrayIntTuple *aaa;
3994 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3999 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4000 ret->applyLin(val,0);
4005 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4006 return DataArrayInt::Multiply(self,aaaa);
4010 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4011 return DataArrayInt::Multiply(self,aaaa);
4014 throw INTERP_KERNEL::Exception(msg);
4018 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4020 const char msg[]="Unexpected situation in __imul__ !";
4023 std::vector<int> aa;
4024 DataArrayIntTuple *aaa;
4026 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4031 self->applyLin(val,0);
4032 Py_XINCREF(trueSelf);
4037 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4038 self->multiplyEqual(bb);
4039 Py_XINCREF(trueSelf);
4044 self->multiplyEqual(a);
4045 Py_XINCREF(trueSelf);
4050 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4051 self->multiplyEqual(aaaa);
4052 Py_XINCREF(trueSelf);
4056 throw INTERP_KERNEL::Exception(msg);
4060 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4062 const char msg[]="Unexpected situation in __div__ !";
4065 std::vector<int> aa;
4066 DataArrayIntTuple *aaa;
4068 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4073 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4074 ret->applyDivideBy(val);
4079 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4080 return DataArrayInt::Divide(self,aaaa);
4084 return DataArrayInt::Divide(self,a);
4088 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4089 return DataArrayInt::Divide(self,aaaa);
4092 throw INTERP_KERNEL::Exception(msg);
4096 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4098 const char msg[]="Unexpected situation in __rdiv__ !";
4101 std::vector<int> aa;
4102 DataArrayIntTuple *aaa;
4104 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4109 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4115 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4116 return DataArrayInt::Divide(aaaa,self);
4120 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4121 return DataArrayInt::Divide(aaaa,self);
4124 throw INTERP_KERNEL::Exception(msg);
4128 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4130 const char msg[]="Unexpected situation in __idiv__ !";
4133 std::vector<int> aa;
4134 DataArrayIntTuple *aaa;
4136 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4141 self->applyDivideBy(val);
4142 Py_XINCREF(trueSelf);
4147 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4148 self->divideEqual(bb);
4149 Py_XINCREF(trueSelf);
4154 self->divideEqual(a);
4155 Py_XINCREF(trueSelf);
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4161 self->divideEqual(aaaa);
4162 Py_XINCREF(trueSelf);
4166 throw INTERP_KERNEL::Exception(msg);
4170 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4172 const char msg[]="Unexpected situation in __mod__ !";
4175 std::vector<int> aa;
4176 DataArrayIntTuple *aaa;
4178 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4183 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4184 ret->applyModulus(val);
4189 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4190 return DataArrayInt::Modulus(self,aaaa);
4194 return DataArrayInt::Modulus(self,a);
4198 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4199 return DataArrayInt::Modulus(self,aaaa);
4202 throw INTERP_KERNEL::Exception(msg);
4206 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4208 const char msg[]="Unexpected situation in __rmod__ !";
4211 std::vector<int> aa;
4212 DataArrayIntTuple *aaa;
4214 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4219 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4220 ret->applyRModulus(val);
4225 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4226 return DataArrayInt::Modulus(aaaa,self);
4230 return DataArrayInt::Modulus(a,self);
4234 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4235 return DataArrayInt::Modulus(aaaa,self);
4238 throw INTERP_KERNEL::Exception(msg);
4242 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4244 const char msg[]="Unexpected situation in __imod__ !";
4247 std::vector<int> aa;
4248 DataArrayIntTuple *aaa;
4250 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4255 self->applyModulus(val);
4256 Py_XINCREF(trueSelf);
4261 self->modulusEqual(a);
4262 Py_XINCREF(trueSelf);
4267 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4268 self->modulusEqual(aaaa);
4269 Py_XINCREF(trueSelf);
4273 throw INTERP_KERNEL::Exception(msg);
4277 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4279 const char msg[]="Unexpected situation in __pow__ !";
4282 std::vector<int> aa;
4283 DataArrayIntTuple *aaa;
4285 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4290 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4296 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4297 return DataArrayInt::Pow(self,aaaa);
4301 return DataArrayInt::Pow(self,a);
4305 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4306 return DataArrayInt::Pow(self,aaaa);
4309 throw INTERP_KERNEL::Exception(msg);
4313 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4315 const char msg[]="Unexpected situation in __rpow__ !";
4318 std::vector<int> aa;
4319 DataArrayIntTuple *aaa;
4321 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4326 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4327 ret->applyRPow(val);
4332 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4333 return DataArrayInt::Pow(aaaa,self);
4337 return DataArrayInt::Pow(a,self);
4341 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4342 return DataArrayInt::Pow(aaaa,self);
4345 throw INTERP_KERNEL::Exception(msg);
4349 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4351 const char msg[]="Unexpected situation in __ipow__ !";
4354 std::vector<int> aa;
4355 DataArrayIntTuple *aaa;
4357 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4362 self->applyPow(val);
4363 Py_XINCREF(trueSelf);
4369 Py_XINCREF(trueSelf);
4374 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4375 self->powEqual(aaaa);
4376 Py_XINCREF(trueSelf);
4380 throw INTERP_KERNEL::Exception(msg);
4384 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4386 std::ostringstream oss;
4387 self->reprQuickOverview(oss);
4391 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4393 int szArr,sw,iTypppArr;
4394 std::vector<int> stdvecTyyppArr;
4395 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4396 self->pushBackValsSilent(tmp,tmp+szArr);
4399 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4401 std::vector<int> ret1;
4402 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4403 std::size_t sz=ret0.size();
4404 PyObject *pyRet=PyTuple_New(2);
4405 PyObject *pyRet0=PyList_New((int)sz);
4406 PyObject *pyRet1=PyList_New((int)sz);
4407 for(std::size_t i=0;i<sz;i++)
4409 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4410 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4412 PyTuple_SetItem(pyRet,0,pyRet0);
4413 PyTuple_SetItem(pyRet,1,pyRet1);
4417 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4419 DataArrayInt *ret0=0,*ret1=0;
4420 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4421 PyObject *pyRet=PyTuple_New(2);
4422 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4423 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4429 class DataArrayIntTuple;
4431 class DataArrayIntIterator
4434 DataArrayIntIterator(DataArrayInt *da);
4435 ~DataArrayIntIterator();
4440 DataArrayIntTuple *ret=self->nextt();
4442 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4445 PyErr_SetString(PyExc_StopIteration,"No more data.");
4452 class DataArrayIntTuple
4455 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4456 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4459 std::string __str__() const throw(INTERP_KERNEL::Exception)
4461 return self->repr();
4464 int __int__() const throw(INTERP_KERNEL::Exception)
4466 return self->intValue();
4469 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4471 return self->buildDAInt(1,self->getNumberOfCompo());
4474 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4476 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4477 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4478 Py_XINCREF(trueSelf);
4482 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4484 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4485 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4486 Py_XINCREF(trueSelf);
4490 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4492 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4493 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4494 Py_XINCREF(trueSelf);
4498 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4500 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4501 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4502 Py_XINCREF(trueSelf);
4506 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4508 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4509 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4510 Py_XINCREF(trueSelf);
4514 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4516 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4519 std::vector<int> multiVal;
4520 std::pair<int, std::pair<int,int> > slic;
4521 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4522 const int *pt=self->getConstPointer();
4523 int nbc=self->getNumberOfCompo();
4524 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4531 std::ostringstream oss;
4532 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4533 throw INTERP_KERNEL::Exception(oss.str().c_str());
4536 return PyInt_FromLong(pt[singleVal]);
4540 return PyInt_FromLong(pt[nbc+singleVal]);
4543 std::ostringstream oss;
4544 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4545 throw INTERP_KERNEL::Exception(oss.str().c_str());
4551 PyObject *t=PyTuple_New(multiVal.size());
4552 for(int j=0;j<(int)multiVal.size();j++)
4554 int cid=multiVal[j];
4557 std::ostringstream oss;
4558 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4559 throw INTERP_KERNEL::Exception(oss.str().c_str());
4561 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4567 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4568 PyObject *t=PyTuple_New(sz);
4569 for(int j=0;j<sz;j++)
4570 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4574 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4578 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4580 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4581 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4584 std::vector<int> multiValV;
4585 std::pair<int, std::pair<int,int> > slicV;
4586 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4587 int nbc=self->getNumberOfCompo();
4588 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4590 std::vector<int> multiVal;
4591 std::pair<int, std::pair<int,int> > slic;
4592 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4593 int *pt=self->getPointer();
4594 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4601 std::ostringstream oss;
4602 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4603 throw INTERP_KERNEL::Exception(oss.str().c_str());
4609 pt[singleVal]=singleValV;
4614 if(multiValV.size()!=1)
4616 std::ostringstream oss;
4617 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4618 throw INTERP_KERNEL::Exception(oss.str().c_str());
4620 pt[singleVal]=multiValV[0];
4625 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4629 throw INTERP_KERNEL::Exception(msg);
4638 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4642 std::ostringstream oss;
4643 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4644 throw INTERP_KERNEL::Exception(oss.str().c_str());
4652 if(multiVal.size()!=multiValV.size())
4654 std::ostringstream oss;
4655 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4656 throw INTERP_KERNEL::Exception(oss.str().c_str());
4658 for(int i=0;i<(int)multiVal.size();i++)
4660 int pos=multiVal[i];
4663 std::ostringstream oss;
4664 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4665 throw INTERP_KERNEL::Exception(oss.str().c_str());
4667 pt[multiVal[i]]=multiValV[i];
4673 const int *ptV=daIntTyyppV->getConstPointer();
4674 if(nbc>daIntTyyppV->getNumberOfCompo())
4676 std::ostringstream oss;
4677 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4678 throw INTERP_KERNEL::Exception(oss.str().c_str());
4680 std::copy(ptV,ptV+nbc,pt);
4684 throw INTERP_KERNEL::Exception(msg);
4689 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4694 for(int j=0;j<sz;j++)
4695 pt[slic.first+j*slic.second.second]=singleValV;
4700 if(sz!=(int)multiValV.size())
4702 std::ostringstream oss;
4703 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4704 throw INTERP_KERNEL::Exception(oss.str().c_str());
4706 for(int j=0;j<sz;j++)
4707 pt[slic.first+j*slic.second.second]=multiValV[j];
4712 const int *ptV=daIntTyyppV->getConstPointer();
4713 if(sz>daIntTyyppV->getNumberOfCompo())
4715 std::ostringstream oss;
4716 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
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]=ptV[j];
4724 throw INTERP_KERNEL::Exception(msg);
4728 throw INTERP_KERNEL::Exception(msg);
4734 class DataArrayChar : public DataArray
4737 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4738 int getHashCode() const throw(INTERP_KERNEL::Exception);
4739 bool empty() const throw(INTERP_KERNEL::Exception);
4740 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4741 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4742 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4743 char popBackSilent() throw(INTERP_KERNEL::Exception);
4744 void pack() const throw(INTERP_KERNEL::Exception);
4745 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4746 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4747 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4748 void reverse() throw(INTERP_KERNEL::Exception);
4749 void fillWithZero() throw(INTERP_KERNEL::Exception);
4750 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4751 std::string repr() const throw(INTERP_KERNEL::Exception);
4752 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4753 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4754 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4755 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4756 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4757 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4758 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4759 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4760 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4761 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4762 char front() const throw(INTERP_KERNEL::Exception);
4763 char back() const throw(INTERP_KERNEL::Exception);
4764 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4765 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4766 char *getPointer() throw(INTERP_KERNEL::Exception);
4767 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4768 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4769 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4770 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4771 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4772 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4773 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4774 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4775 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4776 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4777 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4780 int __len__() const throw(INTERP_KERNEL::Exception)
4782 if(self->isAllocated())
4784 return self->getNumberOfTuples();
4788 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4792 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4795 bool ret0=self->isEqualIfNotWhy(other,ret1);
4796 PyObject *ret=PyTuple_New(2);
4797 PyObject *ret0Py=ret0?Py_True:Py_False;
4799 PyTuple_SetItem(ret,0,ret0Py);
4800 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4804 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4807 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4808 if (!SWIG_IsOK(res1))
4811 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4812 if(size!=self->getNumberOfTuples())
4814 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4816 return self->renumber(tmp);
4820 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4822 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4823 da2->checkAllocated();
4824 int size=self->getNumberOfTuples();
4825 if(size!=self->getNumberOfTuples())
4827 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4829 return self->renumber(da2->getConstPointer());
4833 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4836 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4837 if (!SWIG_IsOK(res1))
4840 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4841 if(size!=self->getNumberOfTuples())
4843 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4845 return self->renumberR(tmp);
4849 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4851 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4852 da2->checkAllocated();
4853 int size=self->getNumberOfTuples();
4854 if(size!=self->getNumberOfTuples())
4856 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4858 return self->renumberR(da2->getConstPointer());
4862 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4865 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4866 if (!SWIG_IsOK(res1))
4869 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4870 if(size!=self->getNumberOfTuples())
4872 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4874 return self->renumberAndReduce(tmp,newNbOfTuple);
4878 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4880 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4881 da2->checkAllocated();
4882 int size=self->getNumberOfTuples();
4883 if(size!=self->getNumberOfTuples())
4885 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4887 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4891 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4893 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4894 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4895 return DataArrayChar::Aggregate(tmp);
4898 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4900 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4901 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4902 return DataArrayChar::Meld(tmp);
4907 class DataArrayByteIterator;
4909 class DataArrayByte : public DataArrayChar
4912 static DataArrayByte *New();
4913 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4914 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4915 char byteValue() const throw(INTERP_KERNEL::Exception);
4918 DataArrayByte() throw(INTERP_KERNEL::Exception)
4920 return DataArrayByte::New();
4923 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4925 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) !";
4926 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4930 if(PyInt_Check(nbOfTuples))
4932 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4934 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4937 if(PyInt_Check(nbOfComp))
4938 {//DataArrayByte.New([1,3,4,5],2,2)
4939 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4941 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4942 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4943 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4944 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4948 throw INTERP_KERNEL::Exception(msg);
4951 {//DataArrayByte.New([1,3,4],3)
4952 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4954 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4955 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4960 throw INTERP_KERNEL::Exception(msg);
4963 {// DataArrayByte.New([1,3,4])
4964 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4965 int tmpp1=-1,tmpp2=-1;
4966 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4967 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4971 else if(PyInt_Check(elt0))
4973 int nbOfTuples1=PyInt_AS_LONG(elt0);
4975 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4980 if(PyInt_Check(nbOfTuples))
4981 {//DataArrayByte.New(5,2)
4982 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4984 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4985 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4986 ret->alloc(nbOfTuples1,nbOfCompo);
4990 throw INTERP_KERNEL::Exception(msg);
4993 throw INTERP_KERNEL::Exception(msg);
4996 {//DataArrayByte.New(5)
4997 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4998 ret->alloc(nbOfTuples1,1);
5003 throw INTERP_KERNEL::Exception(msg);
5006 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5008 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5011 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5013 std::ostringstream oss;
5014 self->reprQuickOverview(oss);
5018 int __int__() const throw(INTERP_KERNEL::Exception)
5020 return (int) self->byteValue();
5023 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5025 return self->iterator();
5028 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5030 return (int)self->getIJ(tupleId,compoId);
5033 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5035 return (int)self->getIJSafe(tupleId,compoId);
5038 std::string __str__() const throw(INTERP_KERNEL::Exception)
5040 return self->repr();
5043 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5045 const char *vals=self->getConstPointer();
5046 int nbOfComp=self->getNumberOfComponents();
5047 int nbOfTuples=self->getNumberOfTuples();
5048 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5051 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5054 int ival=-1; std::vector<int> ivval;
5055 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5056 std::vector<char> vals(sz);
5057 std::copy(pt,pt+sz,vals.begin());
5058 return self->presenceOfTuple(vals);
5061 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5064 int ival=-1; std::vector<int> ivval;
5065 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5066 std::vector<char> vals2(sz);
5067 std::copy(pt,pt+sz,vals2.begin());
5068 return self->presenceOfValue(vals2);
5071 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5074 int ival=-1; std::vector<int> ivval;
5075 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5076 std::vector<char> vals2(sz);
5077 std::copy(pt,pt+sz,vals2.begin());
5078 return self->locateValue(vals2);
5081 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5084 int ival=-1; std::vector<int> ivval;
5085 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5086 std::vector<char> vals(sz);
5087 std::copy(pt,pt+sz,vals.begin());
5088 return self->locateTuple(vals);
5091 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5094 int ival=-1; std::vector<int> ivval;
5095 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5096 std::vector<char> vals(sz);
5097 std::copy(pt,pt+sz,vals.begin());
5098 return self->search(vals);
5101 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5103 int sz=self->getNumberOfComponents();
5104 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5105 self->getTuple(tupleId,tmp);
5106 PyObject *ret=PyTuple_New(sz);
5107 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5111 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5114 int r1=(int)self->getMaxValue(tmp);
5115 PyObject *ret=PyTuple_New(2);
5116 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5117 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5121 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5124 int r1=(int)self->getMinValue(tmp);
5125 PyObject *ret=PyTuple_New(2);
5126 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5127 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5131 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5133 int nbOfCompo=self->getNumberOfComponents();
5138 if(PyInt_Check(obj))
5140 int val=(int)PyInt_AS_LONG(obj);
5141 return self->locateValue(val);
5144 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5147 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5151 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5153 int nbOfCompo=self->getNumberOfComponents();
5160 if(PyInt_Check(obj))
5162 int val=(int)PyInt_AS_LONG(obj);
5163 return self->presenceOfValue(val);
5166 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5169 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5175 class DataArrayByteTuple;
5177 class DataArrayByteIterator
5180 DataArrayByteIterator(DataArrayByte *da);
5181 ~DataArrayByteIterator();
5184 class DataArrayByteTuple
5187 std::string repr() const throw(INTERP_KERNEL::Exception);
5188 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5191 std::string __str__() const throw(INTERP_KERNEL::Exception)
5193 return self->repr();
5196 char __int__() const throw(INTERP_KERNEL::Exception)
5198 return self->byteValue();
5201 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5203 return self->buildDAByte(1,self->getNumberOfCompo());
5208 class DataArrayAsciiCharIterator;
5210 class DataArrayAsciiChar : public DataArrayChar
5213 static DataArrayAsciiChar *New();
5214 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5215 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5216 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5219 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5221 return DataArrayAsciiChar::New();
5224 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5226 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) !";
5227 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5231 if(PyInt_Check(nbOfTuples))
5233 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5235 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5238 if(PyInt_Check(nbOfComp))
5239 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5240 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5242 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5243 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5244 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5245 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5249 throw INTERP_KERNEL::Exception(msg);
5252 {//DataArrayAsciiChar.New([1,3,4],3)
5253 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5255 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5256 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5260 else if(PyString_Check(nbOfTuples))
5262 if(PyString_Size(nbOfTuples)!=1)
5263 throw INTERP_KERNEL::Exception(msg);
5264 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5265 std::vector<std::string> tmp;
5266 if(fillStringVector(elt0,tmp))
5267 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5269 throw INTERP_KERNEL::Exception(msg);
5272 throw INTERP_KERNEL::Exception(msg);
5276 std::vector<std::string> tmmp;
5277 if(fillStringVector(elt0,tmmp))
5278 //DataArrayAsciiChar.New(["abc","de","fghi"])
5279 return DataArrayAsciiChar::New(tmmp,' ');
5282 // DataArrayAsciiChar.New([1,3,4])
5283 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5284 int tmpp1=-1,tmpp2=-1;
5285 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5286 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5291 else if(PyInt_Check(elt0))
5293 int nbOfTuples1=PyInt_AS_LONG(elt0);
5295 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5300 if(PyInt_Check(nbOfTuples))
5301 {//DataArrayAsciiChar.New(5,2)
5302 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5304 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5305 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5306 ret->alloc(nbOfTuples1,nbOfCompo);
5310 throw INTERP_KERNEL::Exception(msg);
5313 throw INTERP_KERNEL::Exception(msg);
5316 {//DataArrayAsciiChar.New(5)
5317 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5318 ret->alloc(nbOfTuples1,1);
5323 throw INTERP_KERNEL::Exception(msg);
5326 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5328 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5331 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5333 std::ostringstream oss;
5334 self->reprQuickOverview(oss);
5338 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5340 return self->iterator();
5343 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5345 char tmp[2]; tmp[1]='\0';
5346 tmp[0]=self->getIJ(tupleId,compoId);
5347 return std::string(tmp);
5350 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5352 char tmp[2]; tmp[1]='\0';
5353 tmp[0]=self->getIJSafe(tupleId,compoId);
5354 return std::string(tmp);
5357 std::string __str__() const throw(INTERP_KERNEL::Exception)
5359 return self->repr();
5362 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5364 const char *vals=self->getConstPointer();
5365 int nbOfComp=self->getNumberOfComponents();
5366 int nbOfTuples=self->getNumberOfTuples();
5367 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5370 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5372 if(PyString_Check(tupl))
5374 Py_ssize_t sz=PyString_Size(tupl);
5375 std::vector<char> vals(sz);
5376 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5377 return self->presenceOfTuple(vals);
5380 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5383 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5385 if(PyString_Check(vals))
5387 Py_ssize_t sz=PyString_Size(vals);
5388 std::vector<char> vals2(sz);
5389 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5390 return self->presenceOfValue(vals2);
5393 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5396 int locateValue(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->locateValue(vals2);
5406 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5409 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5411 if(PyString_Check(tupl))
5413 Py_ssize_t sz=PyString_Size(tupl);
5414 std::vector<char> vals(sz);
5415 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5416 return self->locateTuple(vals);
5419 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5422 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5424 if(PyString_Check(strOrListOfInt))
5426 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5427 std::vector<char> vals(sz);
5428 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5429 return self->search(vals);
5432 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5435 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5437 int sz=self->getNumberOfComponents();
5438 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5439 self->getTuple(tupleId,tmp);
5440 return PyString_FromString(tmp);
5443 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5446 char tmp2[2]; tmp2[1]='\0';
5447 tmp2[0]=self->getMaxValue(tmp);
5448 PyObject *ret=PyTuple_New(2);
5449 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5450 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5454 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5457 char tmp2[2]; tmp2[1]='\0';
5458 tmp2[0]=self->getMinValue(tmp);
5459 PyObject *ret=PyTuple_New(2);
5460 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5461 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5465 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5467 int nbOfCompo=self->getNumberOfComponents();
5472 if(PyString_Check(obj))
5474 Py_ssize_t sz=PyString_Size(obj);
5475 char *pt=PyString_AsString(obj);
5477 return self->locateValue(pt[0]);
5479 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5482 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5485 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5489 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5491 int nbOfCompo=self->getNumberOfComponents();
5498 if(PyString_Check(obj))
5500 Py_ssize_t sz=PyString_Size(obj);
5501 char *pt=PyString_AsString(obj);
5503 return self->presenceOfValue(pt[0]);
5505 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5508 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5511 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5515 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5518 std::vector<int> stdvecTyyppArr;
5519 std::pair<int, std::pair<int,int> > sTyyppArr;
5520 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5521 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5525 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5527 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5529 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5531 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5533 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5537 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5539 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.";
5541 std::vector<int> stdvecTyyppArr;
5542 std::pair<int, std::pair<int,int> > sTyyppArr;
5543 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5544 int nbOfCompo=self->getNumberOfComponents();
5545 int nbOfTuples=self->getNumberOfTuples();
5546 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5548 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5549 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5558 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5564 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5565 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5568 //value vector<string>
5571 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5572 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5575 //value DataArrayChar
5578 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5582 throw INTERP_KERNEL::Exception(msg);
5586 {//obj list-tuple[int]
5592 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5598 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5599 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5602 //value vector<string>
5605 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5606 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5609 //value DataArrayChar
5612 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5616 throw INTERP_KERNEL::Exception(msg);
5627 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5633 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5634 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5637 //value vector<string>
5640 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5641 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5644 //value DataArrayChar
5647 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5651 throw INTERP_KERNEL::Exception(msg);
5662 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5668 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5669 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5672 //value vector<string>
5675 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5676 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5679 //value DataArrayChar
5682 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5686 throw INTERP_KERNEL::Exception(msg);
5691 throw INTERP_KERNEL::Exception(msg);
5697 class DataArrayAsciiCharTuple;
5699 class DataArrayAsciiCharIterator
5702 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5703 ~DataArrayAsciiCharIterator();
5708 DataArrayAsciiCharTuple *ret=self->nextt();
5710 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5713 PyErr_SetString(PyExc_StopIteration,"No more data.");
5720 class DataArrayAsciiCharTuple
5723 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5724 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5727 std::string __str__() const throw(INTERP_KERNEL::Exception)
5729 return self->repr();
5732 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5734 return self->buildDAAsciiChar(1,self->getNumberOfCompo());