1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) ParaMEDMEM::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) ParaMEDMEM::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject ParaMEDMEM::DataArray::deepCpy;
46 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
47 %newobject ParaMEDMEM::DataArray::selectByTupleId;
48 %newobject ParaMEDMEM::DataArray::selectByTupleIdSafe;
49 %newobject ParaMEDMEM::DataArray::selectByTupleId2;
50 %newobject ParaMEDMEM::DataArray::Aggregate;
51 %newobject ParaMEDMEM::DataArrayInt::New;
52 %newobject ParaMEDMEM::DataArrayInt::__iter__;
53 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
54 %newobject ParaMEDMEM::DataArrayInt::performCpy;
55 %newobject ParaMEDMEM::DataArrayInt::substr;
56 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
57 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
58 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
59 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
60 %newobject ParaMEDMEM::DataArrayInt::renumber;
61 %newobject ParaMEDMEM::DataArrayInt::renumberR;
62 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
63 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
64 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
65 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
66 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
67 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
68 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
69 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
70 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
71 %newobject ParaMEDMEM::DataArrayInt::negate;
72 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
73 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
74 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
75 %newobject ParaMEDMEM::DataArrayInt::Meld;
76 %newobject ParaMEDMEM::DataArrayInt::Add;
77 %newobject ParaMEDMEM::DataArrayInt::Substract;
78 %newobject ParaMEDMEM::DataArrayInt::Multiply;
79 %newobject ParaMEDMEM::DataArrayInt::Divide;
80 %newobject ParaMEDMEM::DataArrayInt::Pow;
81 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
82 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
83 %newobject ParaMEDMEM::DataArrayInt::Range;
84 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
85 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
86 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
87 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
88 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
89 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
90 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
91 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
92 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
93 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
94 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
95 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
96 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
97 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
98 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
99 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
100 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
101 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
102 %newobject ParaMEDMEM::DataArrayInt::__neg__;
103 %newobject ParaMEDMEM::DataArrayInt::__add__;
104 %newobject ParaMEDMEM::DataArrayInt::__radd__;
105 %newobject ParaMEDMEM::DataArrayInt::__sub__;
106 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
107 %newobject ParaMEDMEM::DataArrayInt::__mul__;
108 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
109 %newobject ParaMEDMEM::DataArrayInt::__div__;
110 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
111 %newobject ParaMEDMEM::DataArrayInt::__mod__;
112 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
113 %newobject ParaMEDMEM::DataArrayInt::__pow__;
114 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
115 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
116 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
117 %newobject ParaMEDMEM::DataArrayChar::renumber;
118 %newobject ParaMEDMEM::DataArrayChar::renumberR;
119 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
120 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
121 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
122 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
123 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
124 %newobject ParaMEDMEM::DataArrayChar::Meld;
125 %newobject ParaMEDMEM::DataArrayByte::New;
126 %newobject ParaMEDMEM::DataArrayByte::__iter__;
127 %newobject ParaMEDMEM::DataArrayByte::performCpy;
128 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
129 %newobject ParaMEDMEM::DataArrayChar::substr;
130 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
131 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
132 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
133 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
134 %newobject ParaMEDMEM::DataArrayDouble::New;
135 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
136 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
137 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
138 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
139 %newobject ParaMEDMEM::DataArrayDouble::Meld;
140 %newobject ParaMEDMEM::DataArrayDouble::Dot;
141 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
142 %newobject ParaMEDMEM::DataArrayDouble::Add;
143 %newobject ParaMEDMEM::DataArrayDouble::Substract;
144 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
145 %newobject ParaMEDMEM::DataArrayDouble::Divide;
146 %newobject ParaMEDMEM::DataArrayDouble::Pow;
147 %newobject ParaMEDMEM::DataArrayDouble::substr;
148 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
149 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
150 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
151 %newobject ParaMEDMEM::DataArrayDouble::negate;
152 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
153 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
154 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
155 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
156 %newobject ParaMEDMEM::DataArrayDouble::determinant;
157 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
158 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
159 %newobject ParaMEDMEM::DataArrayDouble::inverse;
160 %newobject ParaMEDMEM::DataArrayDouble::trace;
161 %newobject ParaMEDMEM::DataArrayDouble::deviator;
162 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
163 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
164 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
165 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
166 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
167 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
168 %newobject ParaMEDMEM::DataArrayDouble::renumber;
169 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
170 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
171 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
172 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
173 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
174 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
175 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
176 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
177 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
178 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
179 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
180 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
181 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
182 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
183 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
184 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
185 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
186 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
187 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
189 %feature("unref") DataArray "$this->decrRef();"
190 %feature("unref") DataArrayDouble "$this->decrRef();"
191 %feature("unref") DataArrayInt "$this->decrRef();"
192 %feature("unref") DataArrayChar "$this->decrRef();"
193 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
194 %feature("unref") DataArrayByte "$this->decrRef();"
198 class DataArray : public RefCountObject, public TimeLabel
201 void setName(const char *name);
202 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
203 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
204 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
205 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
206 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
207 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
208 std::string getName() const;
209 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
210 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
211 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
212 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
213 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
214 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
215 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
216 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
217 int getNumberOfComponents() const;
218 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
219 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
220 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
221 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
222 virtual void desallocate() throw(INTERP_KERNEL::Exception);
223 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
224 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
225 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
226 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
227 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
228 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
229 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
230 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
231 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
232 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
233 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
234 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
235 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
236 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
237 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
238 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
239 void updateTime() const;
242 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
244 const std::vector<std::string>& comps=self->getInfoOnComponents();
245 PyObject *ret=PyList_New((int)comps.size());
246 for(int i=0;i<(int)comps.size();i++)
247 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
251 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
253 std::vector<int> tmp;
254 convertPyToNewIntArr3(li,tmp);
255 self->copyPartOfStringInfoFrom(other,tmp);
258 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
260 std::vector<int> tmp;
261 convertPyToNewIntArr3(li,tmp);
262 self->copyPartOfStringInfoFrom2(tmp,other);
265 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
268 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
269 if (!SWIG_IsOK(res1))
272 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
273 if(size!=self->getNumberOfTuples())
275 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
277 self->renumberInPlace(tmp);
281 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
283 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
284 da2->checkAllocated();
285 int size=self->getNumberOfTuples();
286 if(size!=self->getNumberOfTuples())
288 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
290 self->renumberInPlace(da2->getConstPointer());
294 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
297 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
298 if (!SWIG_IsOK(res1))
301 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
302 if(size!=self->getNumberOfTuples())
304 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
306 self->renumberInPlaceR(tmp);
310 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
312 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
313 da2->checkAllocated();
314 int size=self->getNumberOfTuples();
315 if(size!=self->getNumberOfTuples())
317 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
319 self->renumberInPlaceR(da2->getConstPointer());
323 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
324 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
326 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
327 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
328 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
329 DataArrayInt *tuplesSelecPtr2=0;
332 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
334 throw INTERP_KERNEL::Exception(msg);
336 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
339 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
341 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
342 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
345 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
347 std::vector<std::pair<int,int> > ranges;
348 convertPyToVectorPairInt(li,ranges);
349 return self->selectByTupleRanges(ranges);
352 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
355 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
356 if (!SWIG_IsOK(res1))
359 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
360 return self->selectByTupleId(tmp,tmp+size);
364 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
366 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
367 da2->checkAllocated();
368 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
372 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
375 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
376 if (!SWIG_IsOK(res1))
379 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
380 return self->selectByTupleIdSafe(tmp,tmp+size);
384 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
386 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
387 da2->checkAllocated();
388 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
392 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
394 std::vector<int> tmp;
395 convertPyToNewIntArr3(li,tmp);
396 DataArray *ret=self->keepSelectedComponents(tmp);
397 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
400 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
402 if(!PySlice_Check(slic))
403 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
404 Py_ssize_t strt=2,stp=2,step=2;
405 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
406 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
407 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
408 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
409 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
411 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
412 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
415 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
417 if(!PySlice_Check(slic))
418 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
419 Py_ssize_t strt=2,stp=2,step=2;
420 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
421 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
422 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
424 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
425 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
428 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
430 if(!PySlice_Check(slic))
431 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
432 Py_ssize_t strt=2,stp=2,step=2;
433 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
434 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
435 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
436 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
437 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
438 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
441 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
443 if(!PySlice_Check(slic))
444 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
445 Py_ssize_t strt=2,stp=2,step=2;
446 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
447 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
448 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
449 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
450 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
451 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
454 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
456 std::vector<const DataArray *> tmp;
457 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
458 return DataArray::Aggregate(tmp);
461 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
463 if(!PySlice_Check(slic))
464 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
465 Py_ssize_t strt=2,stp=2,step=2;
466 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
467 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
468 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
469 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
472 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
474 if(!PySlice_Check(slic))
475 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
476 Py_ssize_t strt=2,stp=2,step=2;
477 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
478 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
479 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
480 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
486 class DataArrayDoubleIterator;
488 class DataArrayDouble : public DataArray
491 static DataArrayDouble *New();
492 double doubleValue() const throw(INTERP_KERNEL::Exception);
493 bool empty() const throw(INTERP_KERNEL::Exception);
494 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
495 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
496 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
497 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
498 double popBackSilent() throw(INTERP_KERNEL::Exception);
499 void pack() const throw(INTERP_KERNEL::Exception);
500 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
501 void fillWithZero() throw(INTERP_KERNEL::Exception);
502 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
503 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
504 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
505 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
506 void reverse() throw(INTERP_KERNEL::Exception);
507 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
508 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
509 std::string repr() const throw(INTERP_KERNEL::Exception);
510 std::string reprZip() const throw(INTERP_KERNEL::Exception);
511 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
512 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
513 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
514 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
515 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
516 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
517 void transpose() throw(INTERP_KERNEL::Exception);
518 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
519 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
520 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
521 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
522 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
523 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
524 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
525 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
526 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
527 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
528 double front() const throw(INTERP_KERNEL::Exception);
529 double back() const throw(INTERP_KERNEL::Exception);
530 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
531 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
532 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
533 double *getPointer() throw(INTERP_KERNEL::Exception);
534 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
535 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
536 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
537 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
538 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
539 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
540 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
541 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
542 double getAverageValue() const throw(INTERP_KERNEL::Exception);
543 double norm2() const throw(INTERP_KERNEL::Exception);
544 double normMax() const throw(INTERP_KERNEL::Exception);
545 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
546 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
550 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
561 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
562 void abs() throw(INTERP_KERNEL::Exception);
563 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
564 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
565 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
566 void applyPow(double val) throw(INTERP_KERNEL::Exception);
567 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
570 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
571 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
572 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
573 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
574 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
575 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
576 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
577 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
578 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
579 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
580 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
581 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
582 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
583 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
584 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
585 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
586 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
587 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
588 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
589 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
590 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
591 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
592 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
595 DataArrayDouble() throw(INTERP_KERNEL::Exception)
597 return DataArrayDouble::New();
600 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
602 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)";
603 std::string msg(msgBase);
605 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
608 if(PyList_Check(elt0) || PyTuple_Check(elt0))
612 if(PyInt_Check(nbOfTuples))
614 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
616 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
619 if(PyInt_Check(elt2))
620 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
621 int nbOfCompo=PyInt_AS_LONG(elt2);
623 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
624 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
625 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
626 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
630 throw INTERP_KERNEL::Exception(msg.c_str());
633 {//DataArrayDouble.New([1.,3.,4.],3)
634 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
636 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
637 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
642 throw INTERP_KERNEL::Exception(msg.c_str());
645 {// DataArrayDouble.New([1.,3.,4.])
646 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
647 int tmpp1=-1,tmpp2=-1;
648 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
649 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
653 else if(PyInt_Check(elt0))
655 int nbOfTuples1=PyInt_AS_LONG(elt0);
657 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
662 if(PyInt_Check(nbOfTuples))
663 {//DataArrayDouble.New(5,2)
664 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
666 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
667 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
668 ret->alloc(nbOfTuples1,nbOfCompo);
672 throw INTERP_KERNEL::Exception(msg.c_str());
675 throw INTERP_KERNEL::Exception(msg.c_str());
678 {//DataArrayDouble.New(5)
679 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
680 ret->alloc(nbOfTuples1,1);
685 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
686 {//DataArrayDouble.New(numpyArray)
687 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
691 throw INTERP_KERNEL::Exception(msg.c_str());
694 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
696 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
699 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
702 std::vector<double> bb;
704 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
705 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
706 self->pushBackValsSilent(tmp,tmp+nbTuples);
709 std::string __repr__() const throw(INTERP_KERNEL::Exception)
711 std::ostringstream oss;
712 self->reprQuickOverview(oss);
716 std::string __str__() const throw(INTERP_KERNEL::Exception)
721 double __float__() const throw(INTERP_KERNEL::Exception)
723 return self->doubleValue();
726 int __len__() const throw(INTERP_KERNEL::Exception)
728 if(self->isAllocated())
730 return self->getNumberOfTuples();
734 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
738 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
740 return self->iterator();
743 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
745 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 !";
746 if(PyList_Check(li) || PyTuple_Check(li))
750 if(PyInt_Check(nbOfTuples))
752 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
754 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
757 if(PyInt_Check(nbOfComp))
758 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
759 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
761 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
762 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
763 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
766 throw INTERP_KERNEL::Exception(msg);
769 {//DataArrayDouble.setValues([1.,3.,4.],3)
771 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
772 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
776 throw INTERP_KERNEL::Exception(msg);
779 {// DataArrayDouble.setValues([1.,3.,4.])
780 int tmpp1=-1,tmpp2=-1;
781 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
782 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
786 throw INTERP_KERNEL::Exception(msg);
789 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
791 const double *vals=self->getConstPointer();
792 return convertDblArrToPyList(vals,self->getNbOfElems());
796 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
798 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
802 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
805 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
806 PyObject *ret=PyTuple_New(2);
807 PyObject *ret0Py=ret0?Py_True:Py_False;
809 PyTuple_SetItem(ret,0,ret0Py);
810 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
814 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
816 const double *vals=self->getConstPointer();
817 int nbOfComp=self->getNumberOfComponents();
818 int nbOfTuples=self->getNumberOfTuples();
819 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
822 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
825 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
826 if (!SWIG_IsOK(res1))
829 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
830 if(size!=self->getNumberOfTuples())
832 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
834 return self->renumber(tmp);
838 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
840 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
841 da2->checkAllocated();
842 int size=self->getNumberOfTuples();
843 if(size!=self->getNumberOfTuples())
845 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
847 return self->renumber(da2->getConstPointer());
851 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
854 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
855 if (!SWIG_IsOK(res1))
858 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
859 if(size!=self->getNumberOfTuples())
861 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
863 return self->renumberR(tmp);
867 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
869 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
870 da2->checkAllocated();
871 int size=self->getNumberOfTuples();
872 if(size!=self->getNumberOfTuples())
874 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
876 return self->renumberR(da2->getConstPointer());
880 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
883 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
884 if (!SWIG_IsOK(res1))
887 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
888 if(size!=self->getNumberOfTuples())
890 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
892 return self->renumberAndReduce(tmp,newNbOfTuple);
896 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
898 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
899 da2->checkAllocated();
900 int size=self->getNumberOfTuples();
901 if(size!=self->getNumberOfTuples())
903 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
905 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
909 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
911 int thisTupleId,otherTupleId;
912 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
913 PyObject *ret=PyTuple_New(3);
914 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
915 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
916 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
920 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
923 double r1=self->getMaxValue(tmp);
924 PyObject *ret=PyTuple_New(2);
925 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
926 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
930 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
933 double r1=self->getMaxValue2(tmp);
934 PyObject *ret=PyTuple_New(2);
935 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
936 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
940 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
943 double r1=self->getMinValue(tmp);
944 PyObject *ret=PyTuple_New(2);
945 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
946 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
950 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
953 double r1=self->getMinValue2(tmp);
954 PyObject *ret=PyTuple_New(2);
955 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
956 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
960 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
962 int nbOfCompo=self->getNumberOfComponents();
963 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
964 self->getMinMaxPerComponent(tmp);
965 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
969 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
971 int sz=self->getNumberOfComponents();
972 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
973 self->accumulate(tmp);
974 return convertDblArrToPyList(tmp,sz);
977 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
980 std::vector<int> val2;
981 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
982 return self->accumulatePerChunck(bg,bg+sz);
985 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
987 DataArrayInt *comm, *commIndex;
988 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
989 PyObject *res = PyList_New(2);
990 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
991 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
995 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
999 DataArrayDoubleTuple *aa;
1000 std::vector<double> bb;
1002 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1003 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1005 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1006 PyObject *ret=PyTuple_New(2);
1007 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1008 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1012 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1014 std::vector<int> tmp;
1015 convertPyToNewIntArr3(li,tmp);
1016 self->setSelectedComponents(a,tmp);
1019 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1021 int sz=self->getNumberOfComponents();
1022 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1023 self->getTuple(tupleId,tmp);
1024 return convertDblArrToPyList(tmp,sz);
1027 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1029 std::vector<const DataArrayDouble *> tmp;
1030 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1031 return DataArrayDouble::Aggregate(tmp);
1034 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1036 std::vector<const DataArrayDouble *> tmp;
1037 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1038 return DataArrayDouble::Meld(tmp);
1041 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1045 DataArrayDoubleTuple *aa;
1046 std::vector<double> bb;
1048 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1049 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1050 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1051 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1052 DataArrayInt *c=0,*cI=0;
1053 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1054 PyObject *ret=PyTuple_New(2);
1055 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1056 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1060 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1062 DataArrayInt *ret1=0;
1063 bool ret0=self->areIncludedInMe(other,prec,ret1);
1064 PyObject *ret=PyTuple_New(2);
1065 PyObject *ret0Py=ret0?Py_True:Py_False;
1067 PyTuple_SetItem(ret,0,ret0Py);
1068 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1072 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1074 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1075 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1076 self->checkAllocated();
1077 int nbOfTuples=self->getNumberOfTuples();
1078 int nbOfComponents=self->getNumberOfComponents();
1080 std::vector<int> vt1,vc1;
1081 std::pair<int, std::pair<int,int> > pt1,pc1;
1082 DataArrayInt *dt1=0,*dc1=0;
1084 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1085 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1089 if(nbOfComponents==1)
1090 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1091 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1093 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1095 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1097 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1099 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1102 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1103 std::vector<int> v2(1,ic1);
1104 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1108 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1109 std::vector<int> v2(1,ic1);
1110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1114 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1115 std::vector<int> v2(1,ic1);
1116 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1120 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1121 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1125 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1126 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1130 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1131 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1135 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1136 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1140 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1141 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1142 std::vector<int> v2(nbOfComp);
1143 for(int i=0;i<nbOfComp;i++)
1144 v2[i]=pc1.first+i*pc1.second.second;
1145 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1149 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1150 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1151 std::vector<int> v2(nbOfComp);
1152 for(int i=0;i<nbOfComp;i++)
1153 v2[i]=pc1.first+i*pc1.second.second;
1154 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1158 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1159 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1160 std::vector<int> v2(nbOfComp);
1161 for(int i=0;i<nbOfComp;i++)
1162 v2[i]=pc1.first+i*pc1.second.second;
1163 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1167 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1168 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1169 std::vector<int> v2(nbOfComp);
1170 for(int i=0;i<nbOfComp;i++)
1171 v2[i]=pc1.first+i*pc1.second.second;
1172 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1175 throw INTERP_KERNEL::Exception(msg);
1179 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1181 self->checkAllocated();
1182 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1183 int nbOfTuples=self->getNumberOfTuples();
1184 int nbOfComponents=self->getNumberOfComponents();
1187 std::vector<double> v1;
1188 DataArrayDouble *d1=0;
1189 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1191 std::vector<int> vt1,vc1;
1192 std::pair<int, std::pair<int,int> > pt1,pc1;
1193 DataArrayInt *dt1=0,*dc1=0;
1194 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1195 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1203 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1206 tmp=DataArrayDouble::New();
1207 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1208 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1211 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1214 throw INTERP_KERNEL::Exception(msg);
1223 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1226 tmp=DataArrayDouble::New();
1227 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1228 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1231 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1234 throw INTERP_KERNEL::Exception(msg);
1243 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1246 tmp=DataArrayDouble::New();
1247 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1248 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1251 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1254 throw INTERP_KERNEL::Exception(msg);
1263 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1266 tmp=DataArrayDouble::New();
1267 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1268 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1271 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1274 throw INTERP_KERNEL::Exception(msg);
1283 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1286 tmp=DataArrayDouble::New();
1287 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1288 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1291 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1294 throw INTERP_KERNEL::Exception(msg);
1303 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1306 tmp=DataArrayDouble::New();
1307 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1308 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1311 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1314 throw INTERP_KERNEL::Exception(msg);
1323 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1326 tmp=DataArrayDouble::New();
1327 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1328 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1331 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1334 throw INTERP_KERNEL::Exception(msg);
1343 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1346 tmp=DataArrayDouble::New();
1347 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1348 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1351 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1354 throw INTERP_KERNEL::Exception(msg);
1363 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1366 tmp=DataArrayDouble::New();
1367 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1368 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1371 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1374 throw INTERP_KERNEL::Exception(msg);
1383 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1386 tmp=DataArrayDouble::New();
1387 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1388 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1391 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1394 throw INTERP_KERNEL::Exception(msg);
1403 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1406 tmp=DataArrayDouble::New();
1407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1408 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1411 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1414 throw INTERP_KERNEL::Exception(msg);
1423 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1426 tmp=DataArrayDouble::New();
1427 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1428 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1431 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1434 throw INTERP_KERNEL::Exception(msg);
1443 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1446 tmp=DataArrayDouble::New();
1447 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1448 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1451 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1454 throw INTERP_KERNEL::Exception(msg);
1463 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1466 tmp=DataArrayDouble::New();
1467 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1468 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1471 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1474 throw INTERP_KERNEL::Exception(msg);
1483 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1486 tmp=DataArrayDouble::New();
1487 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1488 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1491 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1494 throw INTERP_KERNEL::Exception(msg);
1503 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1506 tmp=DataArrayDouble::New();
1507 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1508 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1511 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1514 throw INTERP_KERNEL::Exception(msg);
1519 throw INTERP_KERNEL::Exception(msg);
1524 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1526 return self->negate();
1529 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1531 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1534 DataArrayDoubleTuple *aa;
1535 std::vector<double> bb;
1538 #ifndef WITHOUT_AUTOFIELD
1540 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1542 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1545 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1546 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1548 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1551 throw INTERP_KERNEL::Exception(msg);
1555 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1560 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1561 ret->applyLin(1.,val);
1562 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1566 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1570 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1571 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1575 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1576 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1579 throw INTERP_KERNEL::Exception(msg);
1583 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1585 const char msg[]="Unexpected situation in __radd__ !";
1588 DataArrayDoubleTuple *aa;
1589 std::vector<double> bb;
1591 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1596 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1597 ret->applyLin(1.,val);
1602 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1603 return DataArrayDouble::Add(self,aaa);
1607 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1608 return DataArrayDouble::Add(self,aaa);
1611 throw INTERP_KERNEL::Exception(msg);
1615 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1617 const char msg[]="Unexpected situation in __iadd__ !";
1620 DataArrayDoubleTuple *aa;
1621 std::vector<double> bb;
1623 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1628 self->applyLin(1.,val);
1629 Py_XINCREF(trueSelf);
1635 Py_XINCREF(trueSelf);
1640 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1641 self->addEqual(aaa);
1642 Py_XINCREF(trueSelf);
1647 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1648 self->addEqual(aaa);
1649 Py_XINCREF(trueSelf);
1653 throw INTERP_KERNEL::Exception(msg);
1657 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1659 const char msg[]="Unexpected situation in __sub__ !";
1662 DataArrayDoubleTuple *aa;
1663 std::vector<double> bb;
1666 #ifndef WITHOUT_AUTOFIELD
1668 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1670 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1673 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1674 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1676 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1679 throw INTERP_KERNEL::Exception(msg);
1683 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1688 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1689 ret->applyLin(1.,-val);
1690 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1694 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1698 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1699 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1703 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1704 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1707 throw INTERP_KERNEL::Exception(msg);
1711 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1713 const char msg[]="Unexpected situation in __rsub__ !";
1716 DataArrayDoubleTuple *aa;
1717 std::vector<double> bb;
1719 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1724 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1725 ret->applyLin(-1.,val);
1730 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1731 return DataArrayDouble::Substract(aaa,self);
1735 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1736 return DataArrayDouble::Substract(aaa,self);
1739 throw INTERP_KERNEL::Exception(msg);
1743 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1745 const char msg[]="Unexpected situation in __isub__ !";
1748 DataArrayDoubleTuple *aa;
1749 std::vector<double> bb;
1751 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1756 self->applyLin(1,-val);
1757 Py_XINCREF(trueSelf);
1762 self->substractEqual(a);
1763 Py_XINCREF(trueSelf);
1768 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1769 self->substractEqual(aaa);
1770 Py_XINCREF(trueSelf);
1775 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1776 self->substractEqual(aaa);
1777 Py_XINCREF(trueSelf);
1781 throw INTERP_KERNEL::Exception(msg);
1785 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1787 const char msg[]="Unexpected situation in __mul__ !";
1790 DataArrayDoubleTuple *aa;
1791 std::vector<double> bb;
1794 #ifndef WITHOUT_AUTOFIELD
1796 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1798 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1801 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1802 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1804 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1807 throw INTERP_KERNEL::Exception(msg);
1811 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1816 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1817 ret->applyLin(val,0.);
1818 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1822 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1826 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1827 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1831 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1832 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1835 throw INTERP_KERNEL::Exception(msg);
1839 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1841 const char msg[]="Unexpected situation in __rmul__ !";
1844 DataArrayDoubleTuple *aa;
1845 std::vector<double> bb;
1847 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1852 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1853 ret->applyLin(val,0.);
1858 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1859 return DataArrayDouble::Multiply(self,aaa);
1863 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1864 return DataArrayDouble::Multiply(self,aaa);
1867 throw INTERP_KERNEL::Exception(msg);
1871 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1873 const char msg[]="Unexpected situation in __imul__ !";
1876 DataArrayDoubleTuple *aa;
1877 std::vector<double> bb;
1879 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1884 self->applyLin(val,0.);
1885 Py_XINCREF(trueSelf);
1890 self->multiplyEqual(a);
1891 Py_XINCREF(trueSelf);
1896 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1897 self->multiplyEqual(aaa);
1898 Py_XINCREF(trueSelf);
1903 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1904 self->multiplyEqual(aaa);
1905 Py_XINCREF(trueSelf);
1909 throw INTERP_KERNEL::Exception(msg);
1913 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1915 const char msg[]="Unexpected situation in __div__ !";
1918 DataArrayDoubleTuple *aa;
1919 std::vector<double> bb;
1922 #ifndef WITHOUT_AUTOFIELD
1924 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1926 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1929 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1930 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1932 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1935 throw INTERP_KERNEL::Exception(msg);
1939 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1945 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1946 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1947 ret->applyLin(1/val,0.);
1948 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1952 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1956 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1957 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1961 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1962 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1965 throw INTERP_KERNEL::Exception(msg);
1969 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1971 const char msg[]="Unexpected situation in __rdiv__ !";
1974 DataArrayDoubleTuple *aa;
1975 std::vector<double> bb;
1977 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1982 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1988 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1989 return DataArrayDouble::Divide(aaa,self);
1993 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1994 return DataArrayDouble::Divide(aaa,self);
1997 throw INTERP_KERNEL::Exception(msg);
2001 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2003 const char msg[]="Unexpected situation in __idiv__ !";
2006 DataArrayDoubleTuple *aa;
2007 std::vector<double> bb;
2009 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2015 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2016 self->applyLin(1./val,0.);
2017 Py_XINCREF(trueSelf);
2022 self->divideEqual(a);
2023 Py_XINCREF(trueSelf);
2028 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2029 self->divideEqual(aaa);
2030 Py_XINCREF(trueSelf);
2035 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2036 self->divideEqual(aaa);
2037 Py_XINCREF(trueSelf);
2041 throw INTERP_KERNEL::Exception(msg);
2045 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2047 const char msg[]="Unexpected situation in __pow__ !";
2050 DataArrayDoubleTuple *aa;
2051 std::vector<double> bb;
2053 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2058 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2064 return DataArrayDouble::Pow(self,a);
2068 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2069 return DataArrayDouble::Pow(self,aaa);
2073 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2074 return DataArrayDouble::Pow(self,aaa);
2077 throw INTERP_KERNEL::Exception(msg);
2081 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2083 const char msg[]="Unexpected situation in __rpow__ !";
2086 DataArrayDoubleTuple *aa;
2087 std::vector<double> bb;
2089 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2094 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2095 ret->applyRPow(val);
2100 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2101 return DataArrayDouble::Pow(aaa,self);
2105 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2106 return DataArrayDouble::Pow(aaa,self);
2109 throw INTERP_KERNEL::Exception(msg);
2113 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2115 const char msg[]="Unexpected situation in __ipow__ !";
2118 DataArrayDoubleTuple *aa;
2119 std::vector<double> bb;
2121 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2126 self->applyPow(val);
2127 Py_XINCREF(trueSelf);
2133 Py_XINCREF(trueSelf);
2138 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2139 self->powEqual(aaa);
2140 Py_XINCREF(trueSelf);
2145 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2146 self->powEqual(aaa);
2147 Py_XINCREF(trueSelf);
2151 throw INTERP_KERNEL::Exception(msg);
2155 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2157 DataArrayInt *c=0,*cI=0;
2159 self->computeTupleIdsNearTuples(other,eps,c,cI);
2160 PyObject *ret=PyTuple_New(2);
2161 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2162 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2166 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2168 DataArrayInt *ret1=0;
2169 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2170 PyObject *ret=PyTuple_New(2);
2171 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2172 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2178 class DataArrayDoubleTuple;
2180 class DataArrayDoubleIterator
2183 DataArrayDoubleIterator(DataArrayDouble *da);
2184 ~DataArrayDoubleIterator();
2189 DataArrayDoubleTuple *ret=self->nextt();
2191 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2194 PyErr_SetString(PyExc_StopIteration,"No more data.");
2201 class DataArrayDoubleTuple
2204 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2205 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2208 std::string __str__() const throw(INTERP_KERNEL::Exception)
2210 return self->repr();
2213 double __float__() const throw(INTERP_KERNEL::Exception)
2215 return self->doubleValue();
2218 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2220 return self->buildDADouble(1,self->getNumberOfCompo());
2223 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2225 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2226 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2227 Py_XINCREF(trueSelf);
2231 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2233 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2234 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2235 Py_XINCREF(trueSelf);
2239 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2241 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2242 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2243 Py_XINCREF(trueSelf);
2247 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2249 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2250 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2251 Py_XINCREF(trueSelf);
2255 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2257 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2260 std::vector<int> multiVal;
2261 std::pair<int, std::pair<int,int> > slic;
2262 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2263 const double *pt=self->getConstPointer();
2264 int nbc=self->getNumberOfCompo();
2265 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2272 std::ostringstream oss;
2273 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2274 throw INTERP_KERNEL::Exception(oss.str().c_str());
2277 return PyFloat_FromDouble(pt[singleVal]);
2281 return PyFloat_FromDouble(pt[nbc+singleVal]);
2284 std::ostringstream oss;
2285 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2286 throw INTERP_KERNEL::Exception(oss.str().c_str());
2292 PyObject *t=PyTuple_New(multiVal.size());
2293 for(int j=0;j<(int)multiVal.size();j++)
2295 int cid=multiVal[j];
2298 std::ostringstream oss;
2299 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2300 throw INTERP_KERNEL::Exception(oss.str().c_str());
2302 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2308 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2309 PyObject *t=PyTuple_New(sz);
2310 for(int j=0;j<sz;j++)
2311 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2315 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2319 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2321 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2322 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2325 std::vector<double> multiValV;
2326 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2327 int nbc=self->getNumberOfCompo();
2328 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2330 std::vector<int> multiVal;
2331 std::pair<int, std::pair<int,int> > slic;
2332 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2333 double *pt=self->getPointer();
2334 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2341 std::ostringstream oss;
2342 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2343 throw INTERP_KERNEL::Exception(oss.str().c_str());
2349 pt[singleVal]=singleValV;
2354 if(multiValV.size()!=1)
2356 std::ostringstream oss;
2357 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2358 throw INTERP_KERNEL::Exception(oss.str().c_str());
2360 pt[singleVal]=multiValV[0];
2365 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2369 throw INTERP_KERNEL::Exception(msg);
2378 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2382 std::ostringstream oss;
2383 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2384 throw INTERP_KERNEL::Exception(oss.str().c_str());
2392 if(multiVal.size()!=multiValV.size())
2394 std::ostringstream oss;
2395 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2396 throw INTERP_KERNEL::Exception(oss.str().c_str());
2398 for(int i=0;i<(int)multiVal.size();i++)
2400 int pos=multiVal[i];
2403 std::ostringstream oss;
2404 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2405 throw INTERP_KERNEL::Exception(oss.str().c_str());
2407 pt[multiVal[i]]=multiValV[i];
2413 const double *ptV=daIntTyyppV->getConstPointer();
2414 if(nbc>daIntTyyppV->getNumberOfCompo())
2416 std::ostringstream oss;
2417 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2418 throw INTERP_KERNEL::Exception(oss.str().c_str());
2420 std::copy(ptV,ptV+nbc,pt);
2424 throw INTERP_KERNEL::Exception(msg);
2429 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2434 for(int j=0;j<sz;j++)
2435 pt[slic.first+j*slic.second.second]=singleValV;
2440 if(sz!=(int)multiValV.size())
2442 std::ostringstream oss;
2443 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2444 throw INTERP_KERNEL::Exception(oss.str().c_str());
2446 for(int j=0;j<sz;j++)
2447 pt[slic.first+j*slic.second.second]=multiValV[j];
2452 const double *ptV=daIntTyyppV->getConstPointer();
2453 if(sz>daIntTyyppV->getNumberOfCompo())
2455 std::ostringstream oss;
2456 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2457 throw INTERP_KERNEL::Exception(oss.str().c_str());
2459 for(int j=0;j<sz;j++)
2460 pt[slic.first+j*slic.second.second]=ptV[j];
2464 throw INTERP_KERNEL::Exception(msg);
2468 throw INTERP_KERNEL::Exception(msg);
2474 class DataArrayIntIterator;
2476 class DataArrayInt : public DataArray
2479 static DataArrayInt *New();
2480 int intValue() const throw(INTERP_KERNEL::Exception);
2481 int getHashCode() const throw(INTERP_KERNEL::Exception);
2482 bool empty() const throw(INTERP_KERNEL::Exception);
2483 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2484 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2485 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2486 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2487 int popBackSilent() throw(INTERP_KERNEL::Exception);
2488 void pack() const throw(INTERP_KERNEL::Exception);
2489 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2490 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2491 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2492 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2493 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2494 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2495 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2496 void reverse() throw(INTERP_KERNEL::Exception);
2497 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2498 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2499 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2500 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2501 void fillWithZero() throw(INTERP_KERNEL::Exception);
2502 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2503 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2504 std::string repr() const throw(INTERP_KERNEL::Exception);
2505 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2506 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2507 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2508 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2509 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2510 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2511 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2512 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2513 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2514 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2515 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2516 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2517 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2518 void transpose() throw(INTERP_KERNEL::Exception);
2519 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2520 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2521 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2522 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2523 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2524 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2525 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2526 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2527 int front() const throw(INTERP_KERNEL::Exception);
2528 int back() const throw(INTERP_KERNEL::Exception);
2529 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2530 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2531 int *getPointer() throw(INTERP_KERNEL::Exception);
2532 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2533 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2534 const int *begin() const throw(INTERP_KERNEL::Exception);
2535 const int *end() const throw(INTERP_KERNEL::Exception);
2536 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2537 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2538 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2539 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2540 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2541 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2542 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2543 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2544 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2545 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2546 int count(int value) const throw(INTERP_KERNEL::Exception);
2547 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2548 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2549 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2550 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2551 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2552 void abs() throw(INTERP_KERNEL::Exception);
2553 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2554 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2555 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2556 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2557 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2558 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2559 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2560 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2561 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2562 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2563 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2564 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2565 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2566 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2567 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2568 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2569 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2570 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2572 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2573 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2574 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2575 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2576 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2577 void computeOffsets() throw(INTERP_KERNEL::Exception);
2578 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2583 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2584 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2585 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2586 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2587 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2588 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2589 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2590 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2591 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2592 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2593 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2594 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2595 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2597 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2600 DataArrayInt() throw(INTERP_KERNEL::Exception)
2602 return DataArrayInt::New();
2605 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2607 const char *msgBase="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)";
2608 std::string msg(msgBase);
2610 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2613 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2617 if(PyInt_Check(nbOfTuples))
2619 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2621 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2624 if(PyInt_Check(nbOfComp))
2625 {//DataArrayInt.New([1,3,4,5],2,2)
2626 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2628 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2629 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2630 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2631 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2635 throw INTERP_KERNEL::Exception(msg.c_str());
2638 {//DataArrayInt.New([1,3,4],3)
2639 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2641 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2642 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2647 throw INTERP_KERNEL::Exception(msg.c_str());
2650 {// DataArrayInt.New([1,3,4])
2651 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2652 int tmpp1=-1,tmpp2=-1;
2653 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2654 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2658 else if(PyInt_Check(elt0))
2660 int nbOfTuples1=PyInt_AS_LONG(elt0);
2662 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2667 if(PyInt_Check(nbOfTuples))
2668 {//DataArrayInt.New(5,2)
2669 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2671 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2672 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2673 ret->alloc(nbOfTuples1,nbOfCompo);
2677 throw INTERP_KERNEL::Exception(msg.c_str());
2680 throw INTERP_KERNEL::Exception(msg.c_str());
2683 {//DataArrayInt.New(5)
2684 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2685 ret->alloc(nbOfTuples1,1);
2690 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2691 {//DataArrayInt.New(numpyArray)
2692 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2696 throw INTERP_KERNEL::Exception(msg.c_str());
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 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2749 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2750 PyObject *ret=PyList_New(slcs.size());
2751 for(std::size_t i=0;i<slcs.size();i++)
2752 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2756 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2758 if(!PySlice_Check(slic))
2759 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2760 Py_ssize_t strt=2,stp=2,step=2;
2761 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2762 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2763 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2764 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2765 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 !");
2766 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2769 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2771 int newNbOfTuples=-1;
2772 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2773 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2774 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2775 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2776 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2777 PyObject *ret=PyTuple_New(2);
2778 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2779 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2783 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2785 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 !";
2786 if(PyList_Check(li) || PyTuple_Check(li))
2790 if(PyInt_Check(nbOfTuples))
2792 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2794 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2797 if(PyInt_Check(nbOfComp))
2798 {//DataArrayInt.setValues([1,3,4,5],2,2)
2799 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2801 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2802 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2803 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2806 throw INTERP_KERNEL::Exception(msg);
2809 {//DataArrayInt.setValues([1,3,4],3)
2811 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2812 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2816 throw INTERP_KERNEL::Exception(msg);
2819 {// DataArrayInt.setValues([1,3,4])
2820 int tmpp1=-1,tmpp2=-1;
2821 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2822 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2826 throw INTERP_KERNEL::Exception(msg);
2829 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2831 const int *vals=self->getConstPointer();
2832 return convertIntArrToPyList(vals,self->getNbOfElems());
2836 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2838 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2842 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2845 bool ret0=self->isEqualIfNotWhy(other,ret1);
2846 PyObject *ret=PyTuple_New(2);
2847 PyObject *ret0Py=ret0?Py_True:Py_False;
2849 PyTuple_SetItem(ret,0,ret0Py);
2850 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2854 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2856 const int *vals=self->getConstPointer();
2857 int nbOfComp=self->getNumberOfComponents();
2858 int nbOfTuples=self->getNumberOfTuples();
2859 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2862 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2864 std::vector<const DataArrayInt *> groups;
2865 std::vector< std::vector<int> > fidsOfGroups;
2866 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2867 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2868 PyObject *ret = PyList_New(2);
2869 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2870 int sz=fidsOfGroups.size();
2871 PyObject *ret1 = PyList_New(sz);
2872 for(int i=0;i<sz;i++)
2873 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2874 PyList_SetItem(ret,1,ret1);
2878 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2881 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2882 if (!SWIG_IsOK(res1))
2885 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2886 self->transformWithIndArr(tmp,tmp+size);
2890 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2891 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2895 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2899 std::vector<int> multiVal;
2900 std::pair<int, std::pair<int,int> > slic;
2901 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2902 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2906 return self->getIdsEqualList(&singleVal,&singleVal+1);
2908 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2910 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2912 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2916 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2920 std::vector<int> multiVal;
2921 std::pair<int, std::pair<int,int> > slic;
2922 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2923 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2927 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2929 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2931 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2933 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2937 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2939 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2941 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2942 if (!SWIG_IsOK(res1))
2945 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2946 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2950 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2952 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2953 da2->checkAllocated();
2954 int size=self->getNumberOfTuples();
2955 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2957 PyObject *ret = PyList_New(3);
2958 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2959 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2960 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2964 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2967 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2968 if (!SWIG_IsOK(res1))
2971 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2972 return self->transformWithIndArrR(tmp,tmp+size);
2976 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2977 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2981 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2984 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2985 if (!SWIG_IsOK(res1))
2988 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2989 if(size!=self->getNumberOfTuples())
2991 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2993 return self->renumberAndReduce(tmp,newNbOfTuple);
2997 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2999 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3000 da2->checkAllocated();
3001 int size=self->getNumberOfTuples();
3002 if(size!=self->getNumberOfTuples())
3004 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3006 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3010 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3013 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3014 if (!SWIG_IsOK(res1))
3017 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3018 if(size!=self->getNumberOfTuples())
3020 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3022 return self->renumber(tmp);
3026 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3028 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3029 da2->checkAllocated();
3030 int size=self->getNumberOfTuples();
3031 if(size!=self->getNumberOfTuples())
3033 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3035 return self->renumber(da2->getConstPointer());
3039 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3042 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3043 if (!SWIG_IsOK(res1))
3046 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3047 if(size!=self->getNumberOfTuples())
3049 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3051 return self->renumberR(tmp);
3055 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3057 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3058 da2->checkAllocated();
3059 int size=self->getNumberOfTuples();
3060 if(size!=self->getNumberOfTuples())
3062 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3064 return self->renumberR(da2->getConstPointer());
3068 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3070 std::vector<int> tmp;
3071 convertPyToNewIntArr3(li,tmp);
3072 self->setSelectedComponents(a,tmp);
3075 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3077 int sz=self->getNumberOfComponents();
3078 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3079 self->getTuple(tupleId,tmp);
3080 return convertIntArrToPyList(tmp,sz);
3083 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3085 DataArrayInt *arr=0;
3086 DataArrayInt *arrI=0;
3087 self->changeSurjectiveFormat(targetNb,arr,arrI);
3088 PyObject *res = PyList_New(2);
3089 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3090 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3094 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3096 std::vector<const DataArrayInt *> tmp;
3097 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3098 return DataArrayInt::Meld(tmp);
3101 static DataArrayInt *Aggregate(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::Aggregate(tmp);
3108 static DataArrayInt *AggregateIndexes(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::AggregateIndexes(tmp);
3115 static DataArrayInt *BuildUnion(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::BuildUnion(tmp);
3122 static DataArrayInt *BuildIntersection(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::BuildIntersection(tmp);
3129 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3132 int r1=self->getMaxValue(tmp);
3133 PyObject *ret=PyTuple_New(2);
3134 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3135 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3139 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3142 int r1=self->getMinValue(tmp);
3143 PyObject *ret=PyTuple_New(2);
3144 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3145 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3149 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3151 int nbOfCompo=self->getNumberOfComponents();
3156 if(PyInt_Check(obj))
3158 int val=(int)PyInt_AS_LONG(obj);
3159 return self->locateValue(val);
3162 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3166 std::vector<int> arr;
3167 convertPyToNewIntArr3(obj,arr);
3168 return self->locateTuple(arr);
3173 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3175 int nbOfCompo=self->getNumberOfComponents();
3182 if(PyInt_Check(obj))
3184 int val=(int)PyInt_AS_LONG(obj);
3185 return self->presenceOfValue(val);
3188 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3192 std::vector<int> arr;
3193 convertPyToNewIntArr3(obj,arr);
3194 return self->presenceOfTuple(arr);
3199 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3201 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3202 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3203 self->checkAllocated();
3204 int nbOfTuples=self->getNumberOfTuples();
3205 int nbOfComponents=self->getNumberOfComponents();
3207 std::vector<int> vt1,vc1;
3208 std::pair<int, std::pair<int,int> > pt1,pc1;
3209 DataArrayInt *dt1=0,*dc1=0;
3211 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3212 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3217 if(nbOfComponents==1)
3218 return PyInt_FromLong(self->getIJSafe(it1,0));
3219 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3222 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3224 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3226 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3228 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3231 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3232 std::vector<int> v2(1,ic1);
3233 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3237 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3238 std::vector<int> v2(1,ic1);
3239 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3243 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3244 std::vector<int> v2(1,ic1);
3245 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3249 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3250 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3254 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3255 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3259 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3260 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3264 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3265 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3269 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3270 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3271 std::vector<int> v2(nbOfComp);
3272 for(int i=0;i<nbOfComp;i++)
3273 v2[i]=pc1.first+i*pc1.second.second;
3274 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3278 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3279 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3280 std::vector<int> v2(nbOfComp);
3281 for(int i=0;i<nbOfComp;i++)
3282 v2[i]=pc1.first+i*pc1.second.second;
3283 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3287 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3288 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3289 std::vector<int> v2(nbOfComp);
3290 for(int i=0;i<nbOfComp;i++)
3291 v2[i]=pc1.first+i*pc1.second.second;
3292 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3296 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3297 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3298 std::vector<int> v2(nbOfComp);
3299 for(int i=0;i<nbOfComp;i++)
3300 v2[i]=pc1.first+i*pc1.second.second;
3301 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3304 throw INTERP_KERNEL::Exception(msg);
3308 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3310 self->checkAllocated();
3311 const char msg[]="Unexpected situation in __setitem__ !";
3312 int nbOfTuples=self->getNumberOfTuples();
3313 int nbOfComponents=self->getNumberOfComponents();
3316 std::vector<int> v1;
3318 DataArrayIntTuple *dd1=0;
3319 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3321 std::vector<int> vt1,vc1;
3322 std::pair<int, std::pair<int,int> > pt1,pc1;
3323 DataArrayInt *dt1=0,*dc1=0;
3324 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3325 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3333 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3336 tmp=DataArrayInt::New();
3337 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3338 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3341 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3344 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3345 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3348 throw INTERP_KERNEL::Exception(msg);
3357 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3360 tmp=DataArrayInt::New();
3361 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3362 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3365 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3368 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3369 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3372 throw INTERP_KERNEL::Exception(msg);
3381 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3384 tmp=DataArrayInt::New();
3385 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3386 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3389 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3392 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3393 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3396 throw INTERP_KERNEL::Exception(msg);
3405 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3408 tmp=DataArrayInt::New();
3409 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3410 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3413 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3416 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3417 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3420 throw INTERP_KERNEL::Exception(msg);
3429 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3432 tmp=DataArrayInt::New();
3433 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3434 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3437 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3440 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3441 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3444 throw INTERP_KERNEL::Exception(msg);
3453 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3456 tmp=DataArrayInt::New();
3457 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3458 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3461 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3464 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3465 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3468 throw INTERP_KERNEL::Exception(msg);
3477 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3480 tmp=DataArrayInt::New();
3481 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3482 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3485 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3488 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3489 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3492 throw INTERP_KERNEL::Exception(msg);
3501 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3504 tmp=DataArrayInt::New();
3505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3506 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3509 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3512 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3513 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3516 throw INTERP_KERNEL::Exception(msg);
3525 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3528 tmp=DataArrayInt::New();
3529 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3530 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3533 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3536 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3537 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3552 tmp=DataArrayInt::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3557 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3560 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3561 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3564 throw INTERP_KERNEL::Exception(msg);
3573 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3576 tmp=DataArrayInt::New();
3577 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3578 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3581 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3584 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3585 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3588 throw INTERP_KERNEL::Exception(msg);
3597 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3600 tmp=DataArrayInt::New();
3601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3602 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3605 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3608 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3609 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3612 throw INTERP_KERNEL::Exception(msg);
3621 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3624 tmp=DataArrayInt::New();
3625 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3626 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3629 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3632 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3633 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3636 throw INTERP_KERNEL::Exception(msg);
3645 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3648 tmp=DataArrayInt::New();
3649 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3650 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3653 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3656 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3657 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3660 throw INTERP_KERNEL::Exception(msg);
3669 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3672 tmp=DataArrayInt::New();
3673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3674 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3677 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3680 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3681 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3684 throw INTERP_KERNEL::Exception(msg);
3693 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3696 tmp=DataArrayInt::New();
3697 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3698 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3701 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3704 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3705 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3708 throw INTERP_KERNEL::Exception(msg);
3713 throw INTERP_KERNEL::Exception(msg);
3718 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3720 return self->negate();
3723 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3725 const char msg[]="Unexpected situation in __add__ !";
3728 std::vector<int> aa;
3729 DataArrayIntTuple *aaa;
3731 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3736 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3737 ret->applyLin(1,val);
3742 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3743 return DataArrayInt::Add(self,aaaa);
3747 return DataArrayInt::Add(self,a);
3751 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3752 return DataArrayInt::Add(self,aaaa);
3755 throw INTERP_KERNEL::Exception(msg);
3759 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3761 const char msg[]="Unexpected situation in __radd__ !";
3764 std::vector<int> aa;
3765 DataArrayIntTuple *aaa;
3767 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3772 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3773 ret->applyLin(1,val);
3778 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3779 return DataArrayInt::Add(self,aaaa);
3783 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3784 return DataArrayInt::Add(self,aaaa);
3787 throw INTERP_KERNEL::Exception(msg);
3791 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3793 const char msg[]="Unexpected situation in __iadd__ !";
3796 std::vector<int> aa;
3797 DataArrayIntTuple *aaa;
3799 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3804 self->applyLin(1,val);
3805 Py_XINCREF(trueSelf);
3810 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3812 Py_XINCREF(trueSelf);
3818 Py_XINCREF(trueSelf);
3823 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3824 self->addEqual(aaaa);
3825 Py_XINCREF(trueSelf);
3829 throw INTERP_KERNEL::Exception(msg);
3833 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3835 const char msg[]="Unexpected situation in __sub__ !";
3838 std::vector<int> aa;
3839 DataArrayIntTuple *aaa;
3841 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3846 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3847 ret->applyLin(1,-val);
3852 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3853 return DataArrayInt::Substract(self,aaaa);
3857 return DataArrayInt::Substract(self,a);
3861 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3862 return DataArrayInt::Substract(self,aaaa);
3865 throw INTERP_KERNEL::Exception(msg);
3869 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3871 const char msg[]="Unexpected situation in __rsub__ !";
3874 std::vector<int> aa;
3875 DataArrayIntTuple *aaa;
3877 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3882 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3883 ret->applyLin(-1,val);
3888 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3889 return DataArrayInt::Substract(aaaa,self);
3893 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3894 return DataArrayInt::Substract(aaaa,self);
3897 throw INTERP_KERNEL::Exception(msg);
3901 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3903 const char msg[]="Unexpected situation in __isub__ !";
3906 std::vector<int> aa;
3907 DataArrayIntTuple *aaa;
3909 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3914 self->applyLin(1,-val);
3915 Py_XINCREF(trueSelf);
3920 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3921 self->substractEqual(bb);
3922 Py_XINCREF(trueSelf);
3927 self->substractEqual(a);
3928 Py_XINCREF(trueSelf);
3933 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3934 self->substractEqual(aaaa);
3935 Py_XINCREF(trueSelf);
3939 throw INTERP_KERNEL::Exception(msg);
3943 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3945 const char msg[]="Unexpected situation in __mul__ !";
3948 std::vector<int> aa;
3949 DataArrayIntTuple *aaa;
3951 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3956 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3957 ret->applyLin(val,0);
3962 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3963 return DataArrayInt::Multiply(self,aaaa);
3967 return DataArrayInt::Multiply(self,a);
3971 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3972 return DataArrayInt::Multiply(self,aaaa);
3975 throw INTERP_KERNEL::Exception(msg);
3979 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3981 const char msg[]="Unexpected situation in __rmul__ !";
3984 std::vector<int> aa;
3985 DataArrayIntTuple *aaa;
3987 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3992 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3993 ret->applyLin(val,0);
3998 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3999 return DataArrayInt::Multiply(self,aaaa);
4003 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4004 return DataArrayInt::Multiply(self,aaaa);
4007 throw INTERP_KERNEL::Exception(msg);
4011 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4013 const char msg[]="Unexpected situation in __imul__ !";
4016 std::vector<int> aa;
4017 DataArrayIntTuple *aaa;
4019 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4024 self->applyLin(val,0);
4025 Py_XINCREF(trueSelf);
4030 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4031 self->multiplyEqual(bb);
4032 Py_XINCREF(trueSelf);
4037 self->multiplyEqual(a);
4038 Py_XINCREF(trueSelf);
4043 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4044 self->multiplyEqual(aaaa);
4045 Py_XINCREF(trueSelf);
4049 throw INTERP_KERNEL::Exception(msg);
4053 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4055 const char msg[]="Unexpected situation in __div__ !";
4058 std::vector<int> aa;
4059 DataArrayIntTuple *aaa;
4061 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4066 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4067 ret->applyDivideBy(val);
4072 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4073 return DataArrayInt::Divide(self,aaaa);
4077 return DataArrayInt::Divide(self,a);
4081 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4082 return DataArrayInt::Divide(self,aaaa);
4085 throw INTERP_KERNEL::Exception(msg);
4089 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4091 const char msg[]="Unexpected situation in __rdiv__ !";
4094 std::vector<int> aa;
4095 DataArrayIntTuple *aaa;
4097 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4102 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4108 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4109 return DataArrayInt::Divide(aaaa,self);
4113 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4114 return DataArrayInt::Divide(aaaa,self);
4117 throw INTERP_KERNEL::Exception(msg);
4121 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4123 const char msg[]="Unexpected situation in __idiv__ !";
4126 std::vector<int> aa;
4127 DataArrayIntTuple *aaa;
4129 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4134 self->applyDivideBy(val);
4135 Py_XINCREF(trueSelf);
4140 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4141 self->divideEqual(bb);
4142 Py_XINCREF(trueSelf);
4147 self->divideEqual(a);
4148 Py_XINCREF(trueSelf);
4153 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4154 self->divideEqual(aaaa);
4155 Py_XINCREF(trueSelf);
4159 throw INTERP_KERNEL::Exception(msg);
4163 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4165 const char msg[]="Unexpected situation in __mod__ !";
4168 std::vector<int> aa;
4169 DataArrayIntTuple *aaa;
4171 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4176 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4177 ret->applyModulus(val);
4182 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4183 return DataArrayInt::Modulus(self,aaaa);
4187 return DataArrayInt::Modulus(self,a);
4191 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4192 return DataArrayInt::Modulus(self,aaaa);
4195 throw INTERP_KERNEL::Exception(msg);
4199 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4201 const char msg[]="Unexpected situation in __rmod__ !";
4204 std::vector<int> aa;
4205 DataArrayIntTuple *aaa;
4207 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4212 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4213 ret->applyRModulus(val);
4218 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4219 return DataArrayInt::Modulus(aaaa,self);
4223 return DataArrayInt::Modulus(a,self);
4227 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4228 return DataArrayInt::Modulus(aaaa,self);
4231 throw INTERP_KERNEL::Exception(msg);
4235 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4237 const char msg[]="Unexpected situation in __imod__ !";
4240 std::vector<int> aa;
4241 DataArrayIntTuple *aaa;
4243 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4248 self->applyModulus(val);
4249 Py_XINCREF(trueSelf);
4254 self->modulusEqual(a);
4255 Py_XINCREF(trueSelf);
4260 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4261 self->modulusEqual(aaaa);
4262 Py_XINCREF(trueSelf);
4266 throw INTERP_KERNEL::Exception(msg);
4270 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4272 const char msg[]="Unexpected situation in __pow__ !";
4275 std::vector<int> aa;
4276 DataArrayIntTuple *aaa;
4278 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4283 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4289 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4290 return DataArrayInt::Pow(self,aaaa);
4294 return DataArrayInt::Pow(self,a);
4298 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4299 return DataArrayInt::Pow(self,aaaa);
4302 throw INTERP_KERNEL::Exception(msg);
4306 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4308 const char msg[]="Unexpected situation in __rpow__ !";
4311 std::vector<int> aa;
4312 DataArrayIntTuple *aaa;
4314 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4319 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4320 ret->applyRPow(val);
4325 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4326 return DataArrayInt::Pow(aaaa,self);
4330 return DataArrayInt::Pow(a,self);
4334 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4335 return DataArrayInt::Pow(aaaa,self);
4338 throw INTERP_KERNEL::Exception(msg);
4342 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4344 const char msg[]="Unexpected situation in __ipow__ !";
4347 std::vector<int> aa;
4348 DataArrayIntTuple *aaa;
4350 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4355 self->applyPow(val);
4356 Py_XINCREF(trueSelf);
4362 Py_XINCREF(trueSelf);
4367 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4368 self->powEqual(aaaa);
4369 Py_XINCREF(trueSelf);
4373 throw INTERP_KERNEL::Exception(msg);
4377 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4379 std::ostringstream oss;
4380 self->reprQuickOverview(oss);
4384 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4386 int szArr,sw,iTypppArr;
4387 std::vector<int> stdvecTyyppArr;
4388 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4389 self->pushBackValsSilent(tmp,tmp+szArr);
4392 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4394 std::vector<int> ret1;
4395 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4396 std::size_t sz=ret0.size();
4397 PyObject *pyRet=PyTuple_New(2);
4398 PyObject *pyRet0=PyList_New((int)sz);
4399 PyObject *pyRet1=PyList_New((int)sz);
4400 for(std::size_t i=0;i<sz;i++)
4402 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4403 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4405 PyTuple_SetItem(pyRet,0,pyRet0);
4406 PyTuple_SetItem(pyRet,1,pyRet1);
4410 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4412 DataArrayInt *ret0=0,*ret1=0;
4413 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4414 PyObject *pyRet=PyTuple_New(2);
4415 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4416 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4422 class DataArrayIntTuple;
4424 class DataArrayIntIterator
4427 DataArrayIntIterator(DataArrayInt *da);
4428 ~DataArrayIntIterator();
4433 DataArrayIntTuple *ret=self->nextt();
4435 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4438 PyErr_SetString(PyExc_StopIteration,"No more data.");
4445 class DataArrayIntTuple
4448 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4449 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4452 std::string __str__() const throw(INTERP_KERNEL::Exception)
4454 return self->repr();
4457 int __int__() const throw(INTERP_KERNEL::Exception)
4459 return self->intValue();
4462 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4464 return self->buildDAInt(1,self->getNumberOfCompo());
4467 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4469 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4470 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4471 Py_XINCREF(trueSelf);
4475 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4477 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4478 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4479 Py_XINCREF(trueSelf);
4483 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4485 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4486 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4487 Py_XINCREF(trueSelf);
4491 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4493 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4494 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4495 Py_XINCREF(trueSelf);
4499 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4501 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4502 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4503 Py_XINCREF(trueSelf);
4507 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4509 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4512 std::vector<int> multiVal;
4513 std::pair<int, std::pair<int,int> > slic;
4514 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4515 const int *pt=self->getConstPointer();
4516 int nbc=self->getNumberOfCompo();
4517 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4524 std::ostringstream oss;
4525 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4526 throw INTERP_KERNEL::Exception(oss.str().c_str());
4529 return PyInt_FromLong(pt[singleVal]);
4533 return PyInt_FromLong(pt[nbc+singleVal]);
4536 std::ostringstream oss;
4537 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4538 throw INTERP_KERNEL::Exception(oss.str().c_str());
4544 PyObject *t=PyTuple_New(multiVal.size());
4545 for(int j=0;j<(int)multiVal.size();j++)
4547 int cid=multiVal[j];
4550 std::ostringstream oss;
4551 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4552 throw INTERP_KERNEL::Exception(oss.str().c_str());
4554 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4560 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4561 PyObject *t=PyTuple_New(sz);
4562 for(int j=0;j<sz;j++)
4563 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4567 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4571 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4573 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4574 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4577 std::vector<int> multiValV;
4578 std::pair<int, std::pair<int,int> > slicV;
4579 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4580 int nbc=self->getNumberOfCompo();
4581 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4583 std::vector<int> multiVal;
4584 std::pair<int, std::pair<int,int> > slic;
4585 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4586 int *pt=self->getPointer();
4587 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4594 std::ostringstream oss;
4595 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4596 throw INTERP_KERNEL::Exception(oss.str().c_str());
4602 pt[singleVal]=singleValV;
4607 if(multiValV.size()!=1)
4609 std::ostringstream oss;
4610 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4611 throw INTERP_KERNEL::Exception(oss.str().c_str());
4613 pt[singleVal]=multiValV[0];
4618 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4622 throw INTERP_KERNEL::Exception(msg);
4631 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4635 std::ostringstream oss;
4636 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4637 throw INTERP_KERNEL::Exception(oss.str().c_str());
4645 if(multiVal.size()!=multiValV.size())
4647 std::ostringstream oss;
4648 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4649 throw INTERP_KERNEL::Exception(oss.str().c_str());
4651 for(int i=0;i<(int)multiVal.size();i++)
4653 int pos=multiVal[i];
4656 std::ostringstream oss;
4657 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4658 throw INTERP_KERNEL::Exception(oss.str().c_str());
4660 pt[multiVal[i]]=multiValV[i];
4666 const int *ptV=daIntTyyppV->getConstPointer();
4667 if(nbc>daIntTyyppV->getNumberOfCompo())
4669 std::ostringstream oss;
4670 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4671 throw INTERP_KERNEL::Exception(oss.str().c_str());
4673 std::copy(ptV,ptV+nbc,pt);
4677 throw INTERP_KERNEL::Exception(msg);
4682 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4687 for(int j=0;j<sz;j++)
4688 pt[slic.first+j*slic.second.second]=singleValV;
4693 if(sz!=(int)multiValV.size())
4695 std::ostringstream oss;
4696 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4697 throw INTERP_KERNEL::Exception(oss.str().c_str());
4699 for(int j=0;j<sz;j++)
4700 pt[slic.first+j*slic.second.second]=multiValV[j];
4705 const int *ptV=daIntTyyppV->getConstPointer();
4706 if(sz>daIntTyyppV->getNumberOfCompo())
4708 std::ostringstream oss;
4709 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4710 throw INTERP_KERNEL::Exception(oss.str().c_str());
4712 for(int j=0;j<sz;j++)
4713 pt[slic.first+j*slic.second.second]=ptV[j];
4717 throw INTERP_KERNEL::Exception(msg);
4721 throw INTERP_KERNEL::Exception(msg);
4727 class DataArrayChar : public DataArray
4730 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4731 int getHashCode() const throw(INTERP_KERNEL::Exception);
4732 bool empty() const throw(INTERP_KERNEL::Exception);
4733 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4734 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4735 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4736 char popBackSilent() throw(INTERP_KERNEL::Exception);
4737 void pack() const throw(INTERP_KERNEL::Exception);
4738 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4739 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4740 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4741 void reverse() throw(INTERP_KERNEL::Exception);
4742 void fillWithZero() throw(INTERP_KERNEL::Exception);
4743 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4744 std::string repr() const throw(INTERP_KERNEL::Exception);
4745 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4746 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4747 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4748 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4749 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4750 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4751 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4752 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4753 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4754 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4755 char front() const throw(INTERP_KERNEL::Exception);
4756 char back() const throw(INTERP_KERNEL::Exception);
4757 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4758 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4759 char *getPointer() throw(INTERP_KERNEL::Exception);
4760 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4761 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4762 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4763 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4764 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4765 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4766 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4767 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4768 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4769 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4770 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4773 int __len__() const throw(INTERP_KERNEL::Exception)
4775 if(self->isAllocated())
4777 return self->getNumberOfTuples();
4781 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4785 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4788 bool ret0=self->isEqualIfNotWhy(other,ret1);
4789 PyObject *ret=PyTuple_New(2);
4790 PyObject *ret0Py=ret0?Py_True:Py_False;
4792 PyTuple_SetItem(ret,0,ret0Py);
4793 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4797 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4800 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4801 if (!SWIG_IsOK(res1))
4804 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4805 if(size!=self->getNumberOfTuples())
4807 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4809 return self->renumber(tmp);
4813 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4815 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4816 da2->checkAllocated();
4817 int size=self->getNumberOfTuples();
4818 if(size!=self->getNumberOfTuples())
4820 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4822 return self->renumber(da2->getConstPointer());
4826 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4829 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4830 if (!SWIG_IsOK(res1))
4833 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4834 if(size!=self->getNumberOfTuples())
4836 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4838 return self->renumberR(tmp);
4842 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4844 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4845 da2->checkAllocated();
4846 int size=self->getNumberOfTuples();
4847 if(size!=self->getNumberOfTuples())
4849 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4851 return self->renumberR(da2->getConstPointer());
4855 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4858 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4859 if (!SWIG_IsOK(res1))
4862 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4863 if(size!=self->getNumberOfTuples())
4865 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4867 return self->renumberAndReduce(tmp,newNbOfTuple);
4871 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4873 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4874 da2->checkAllocated();
4875 int size=self->getNumberOfTuples();
4876 if(size!=self->getNumberOfTuples())
4878 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4880 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4884 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4886 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4887 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4888 return DataArrayChar::Aggregate(tmp);
4891 static DataArrayChar *Meld(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::Meld(tmp);
4900 class DataArrayByteIterator;
4902 class DataArrayByte : public DataArrayChar
4905 static DataArrayByte *New();
4906 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4907 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4908 char byteValue() const throw(INTERP_KERNEL::Exception);
4911 DataArrayByte() throw(INTERP_KERNEL::Exception)
4913 return DataArrayByte::New();
4916 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4918 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) !";
4919 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4923 if(PyInt_Check(nbOfTuples))
4925 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4927 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4930 if(PyInt_Check(nbOfComp))
4931 {//DataArrayByte.New([1,3,4,5],2,2)
4932 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4934 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4935 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4936 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4937 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4941 throw INTERP_KERNEL::Exception(msg);
4944 {//DataArrayByte.New([1,3,4],3)
4945 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4947 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4948 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4953 throw INTERP_KERNEL::Exception(msg);
4956 {// DataArrayByte.New([1,3,4])
4957 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4958 int tmpp1=-1,tmpp2=-1;
4959 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4960 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4964 else if(PyInt_Check(elt0))
4966 int nbOfTuples1=PyInt_AS_LONG(elt0);
4968 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4973 if(PyInt_Check(nbOfTuples))
4974 {//DataArrayByte.New(5,2)
4975 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4977 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4978 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4979 ret->alloc(nbOfTuples1,nbOfCompo);
4983 throw INTERP_KERNEL::Exception(msg);
4986 throw INTERP_KERNEL::Exception(msg);
4989 {//DataArrayByte.New(5)
4990 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4991 ret->alloc(nbOfTuples1,1);
4996 throw INTERP_KERNEL::Exception(msg);
4999 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5001 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5004 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5006 std::ostringstream oss;
5007 self->reprQuickOverview(oss);
5011 int __int__() const throw(INTERP_KERNEL::Exception)
5013 return (int) self->byteValue();
5016 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5018 return self->iterator();
5021 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5023 return (int)self->getIJ(tupleId,compoId);
5026 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5028 return (int)self->getIJSafe(tupleId,compoId);
5031 std::string __str__() const throw(INTERP_KERNEL::Exception)
5033 return self->repr();
5036 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5038 const char *vals=self->getConstPointer();
5039 int nbOfComp=self->getNumberOfComponents();
5040 int nbOfTuples=self->getNumberOfTuples();
5041 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5044 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5047 int ival=-1; std::vector<int> ivval;
5048 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5049 std::vector<char> vals(sz);
5050 std::copy(pt,pt+sz,vals.begin());
5051 return self->presenceOfTuple(vals);
5054 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5057 int ival=-1; std::vector<int> ivval;
5058 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5059 std::vector<char> vals2(sz);
5060 std::copy(pt,pt+sz,vals2.begin());
5061 return self->presenceOfValue(vals2);
5064 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5067 int ival=-1; std::vector<int> ivval;
5068 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5069 std::vector<char> vals2(sz);
5070 std::copy(pt,pt+sz,vals2.begin());
5071 return self->locateValue(vals2);
5074 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5077 int ival=-1; std::vector<int> ivval;
5078 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5079 std::vector<char> vals(sz);
5080 std::copy(pt,pt+sz,vals.begin());
5081 return self->locateTuple(vals);
5084 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5087 int ival=-1; std::vector<int> ivval;
5088 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5089 std::vector<char> vals(sz);
5090 std::copy(pt,pt+sz,vals.begin());
5091 return self->search(vals);
5094 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5096 int sz=self->getNumberOfComponents();
5097 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5098 self->getTuple(tupleId,tmp);
5099 PyObject *ret=PyTuple_New(sz);
5100 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5104 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5107 int r1=(int)self->getMaxValue(tmp);
5108 PyObject *ret=PyTuple_New(2);
5109 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5110 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5114 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5117 int r1=(int)self->getMinValue(tmp);
5118 PyObject *ret=PyTuple_New(2);
5119 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5120 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5124 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5126 int nbOfCompo=self->getNumberOfComponents();
5131 if(PyInt_Check(obj))
5133 int val=(int)PyInt_AS_LONG(obj);
5134 return self->locateValue(val);
5137 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5140 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5144 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5146 int nbOfCompo=self->getNumberOfComponents();
5153 if(PyInt_Check(obj))
5155 int val=(int)PyInt_AS_LONG(obj);
5156 return self->presenceOfValue(val);
5159 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5162 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5168 class DataArrayByteTuple;
5170 class DataArrayByteIterator
5173 DataArrayByteIterator(DataArrayByte *da);
5174 ~DataArrayByteIterator();
5177 class DataArrayByteTuple
5180 std::string repr() const throw(INTERP_KERNEL::Exception);
5181 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5184 std::string __str__() const throw(INTERP_KERNEL::Exception)
5186 return self->repr();
5189 char __int__() const throw(INTERP_KERNEL::Exception)
5191 return self->byteValue();
5194 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5196 return self->buildDAByte(1,self->getNumberOfCompo());
5201 class DataArrayAsciiCharIterator;
5203 class DataArrayAsciiChar : public DataArrayChar
5206 static DataArrayAsciiChar *New();
5207 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5208 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5209 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5212 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5214 return DataArrayAsciiChar::New();
5217 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5219 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) !";
5220 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5224 if(PyInt_Check(nbOfTuples))
5226 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5228 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5231 if(PyInt_Check(nbOfComp))
5232 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5233 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5235 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5236 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5237 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5238 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5242 throw INTERP_KERNEL::Exception(msg);
5245 {//DataArrayAsciiChar.New([1,3,4],3)
5246 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5248 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5249 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5253 else if(PyString_Check(nbOfTuples))
5255 if(PyString_Size(nbOfTuples)!=1)
5256 throw INTERP_KERNEL::Exception(msg);
5257 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5258 std::vector<std::string> tmp;
5259 if(fillStringVector(elt0,tmp))
5260 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5262 throw INTERP_KERNEL::Exception(msg);
5265 throw INTERP_KERNEL::Exception(msg);
5269 std::vector<std::string> tmmp;
5270 if(fillStringVector(elt0,tmmp))
5271 //DataArrayAsciiChar.New(["abc","de","fghi"])
5272 return DataArrayAsciiChar::New(tmmp,' ');
5275 // DataArrayAsciiChar.New([1,3,4])
5276 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5277 int tmpp1=-1,tmpp2=-1;
5278 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5279 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5284 else if(PyInt_Check(elt0))
5286 int nbOfTuples1=PyInt_AS_LONG(elt0);
5288 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5293 if(PyInt_Check(nbOfTuples))
5294 {//DataArrayAsciiChar.New(5,2)
5295 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5297 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5298 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5299 ret->alloc(nbOfTuples1,nbOfCompo);
5303 throw INTERP_KERNEL::Exception(msg);
5306 throw INTERP_KERNEL::Exception(msg);
5309 {//DataArrayAsciiChar.New(5)
5310 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5311 ret->alloc(nbOfTuples1,1);
5316 throw INTERP_KERNEL::Exception(msg);
5319 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5321 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5324 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5326 std::ostringstream oss;
5327 self->reprQuickOverview(oss);
5331 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5333 return self->iterator();
5336 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5338 char tmp[2]; tmp[1]='\0';
5339 tmp[0]=self->getIJ(tupleId,compoId);
5340 return std::string(tmp);
5343 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5345 char tmp[2]; tmp[1]='\0';
5346 tmp[0]=self->getIJSafe(tupleId,compoId);
5347 return std::string(tmp);
5350 std::string __str__() const throw(INTERP_KERNEL::Exception)
5352 return self->repr();
5355 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5357 const char *vals=self->getConstPointer();
5358 int nbOfComp=self->getNumberOfComponents();
5359 int nbOfTuples=self->getNumberOfTuples();
5360 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5363 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5365 if(PyString_Check(tupl))
5367 Py_ssize_t sz=PyString_Size(tupl);
5368 std::vector<char> vals(sz);
5369 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5370 return self->presenceOfTuple(vals);
5373 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5376 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5378 if(PyString_Check(vals))
5380 Py_ssize_t sz=PyString_Size(vals);
5381 std::vector<char> vals2(sz);
5382 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5383 return self->presenceOfValue(vals2);
5386 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5389 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5391 if(PyString_Check(vals))
5393 Py_ssize_t sz=PyString_Size(vals);
5394 std::vector<char> vals2(sz);
5395 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5396 return self->locateValue(vals2);
5399 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5402 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5404 if(PyString_Check(tupl))
5406 Py_ssize_t sz=PyString_Size(tupl);
5407 std::vector<char> vals(sz);
5408 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5409 return self->locateTuple(vals);
5412 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5415 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5417 if(PyString_Check(strOrListOfInt))
5419 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5420 std::vector<char> vals(sz);
5421 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5422 return self->search(vals);
5425 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5428 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5430 int sz=self->getNumberOfComponents();
5431 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5432 self->getTuple(tupleId,tmp);
5433 return PyString_FromString(tmp);
5436 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5439 char tmp2[2]; tmp2[1]='\0';
5440 tmp2[0]=self->getMaxValue(tmp);
5441 PyObject *ret=PyTuple_New(2);
5442 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5443 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5447 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5450 char tmp2[2]; tmp2[1]='\0';
5451 tmp2[0]=self->getMinValue(tmp);
5452 PyObject *ret=PyTuple_New(2);
5453 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5454 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5458 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5460 int nbOfCompo=self->getNumberOfComponents();
5465 if(PyString_Check(obj))
5467 Py_ssize_t sz=PyString_Size(obj);
5468 char *pt=PyString_AsString(obj);
5470 return self->locateValue(pt[0]);
5472 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5475 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5478 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5482 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5484 int nbOfCompo=self->getNumberOfComponents();
5491 if(PyString_Check(obj))
5493 Py_ssize_t sz=PyString_Size(obj);
5494 char *pt=PyString_AsString(obj);
5496 return self->presenceOfValue(pt[0]);
5498 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5501 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5504 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5508 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5511 std::vector<int> stdvecTyyppArr;
5512 std::pair<int, std::pair<int,int> > sTyyppArr;
5513 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5514 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5518 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5520 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5522 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5524 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5526 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5530 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5532 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.";
5534 std::vector<int> stdvecTyyppArr;
5535 std::pair<int, std::pair<int,int> > sTyyppArr;
5536 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5537 int nbOfCompo=self->getNumberOfComponents();
5538 int nbOfTuples=self->getNumberOfTuples();
5539 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5541 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5542 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5551 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5557 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5558 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5561 //value vector<string>
5564 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5565 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5568 //value DataArrayChar
5571 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5575 throw INTERP_KERNEL::Exception(msg);
5579 {//obj list-tuple[int]
5585 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5591 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5592 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5595 //value vector<string>
5598 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5599 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5602 //value DataArrayChar
5605 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5609 throw INTERP_KERNEL::Exception(msg);
5620 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5626 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5627 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5630 //value vector<string>
5633 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5634 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5637 //value DataArrayChar
5640 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5644 throw INTERP_KERNEL::Exception(msg);
5655 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5661 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5662 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5665 //value vector<string>
5668 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5669 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5672 //value DataArrayChar
5675 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5679 throw INTERP_KERNEL::Exception(msg);
5684 throw INTERP_KERNEL::Exception(msg);
5690 class DataArrayAsciiCharTuple;
5692 class DataArrayAsciiCharIterator
5695 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5696 ~DataArrayAsciiCharIterator();
5701 DataArrayAsciiCharTuple *ret=self->nextt();
5703 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5706 PyErr_SetString(PyExc_StopIteration,"No more data.");
5713 class DataArrayAsciiCharTuple
5716 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5717 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5720 std::string __str__() const throw(INTERP_KERNEL::Exception)
5722 return self->repr();
5725 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5727 return self->buildDAAsciiChar(1,self->getNumberOfCompo());