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::getIdsEqualTuple;
71 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
72 %newobject ParaMEDMEM::DataArrayInt::negate;
73 %newobject ParaMEDMEM::DataArrayInt::computeAbs;
74 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
75 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
76 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
77 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
78 %newobject ParaMEDMEM::DataArrayInt::Meld;
79 %newobject ParaMEDMEM::DataArrayInt::Add;
80 %newobject ParaMEDMEM::DataArrayInt::Substract;
81 %newobject ParaMEDMEM::DataArrayInt::Multiply;
82 %newobject ParaMEDMEM::DataArrayInt::Divide;
83 %newobject ParaMEDMEM::DataArrayInt::Pow;
84 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
85 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
86 %newobject ParaMEDMEM::DataArrayInt::Range;
87 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
88 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
89 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
90 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
91 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
92 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
93 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
94 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
95 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
96 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
97 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
98 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
99 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
100 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
101 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
102 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
103 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
104 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
105 %newobject ParaMEDMEM::DataArrayInt::__neg__;
106 %newobject ParaMEDMEM::DataArrayInt::__add__;
107 %newobject ParaMEDMEM::DataArrayInt::__radd__;
108 %newobject ParaMEDMEM::DataArrayInt::__sub__;
109 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
110 %newobject ParaMEDMEM::DataArrayInt::__mul__;
111 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
112 %newobject ParaMEDMEM::DataArrayInt::__div__;
113 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
114 %newobject ParaMEDMEM::DataArrayInt::__mod__;
115 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
116 %newobject ParaMEDMEM::DataArrayInt::__pow__;
117 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
118 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
119 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
120 %newobject ParaMEDMEM::DataArrayChar::renumber;
121 %newobject ParaMEDMEM::DataArrayChar::renumberR;
122 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
123 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
124 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
125 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
126 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
127 %newobject ParaMEDMEM::DataArrayChar::Meld;
128 %newobject ParaMEDMEM::DataArrayByte::New;
129 %newobject ParaMEDMEM::DataArrayByte::__iter__;
130 %newobject ParaMEDMEM::DataArrayByte::performCpy;
131 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
132 %newobject ParaMEDMEM::DataArrayChar::substr;
133 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
134 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
135 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
136 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
137 %newobject ParaMEDMEM::DataArrayDouble::New;
138 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
139 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
140 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
141 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
142 %newobject ParaMEDMEM::DataArrayDouble::Meld;
143 %newobject ParaMEDMEM::DataArrayDouble::Dot;
144 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
145 %newobject ParaMEDMEM::DataArrayDouble::Add;
146 %newobject ParaMEDMEM::DataArrayDouble::Substract;
147 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
148 %newobject ParaMEDMEM::DataArrayDouble::Divide;
149 %newobject ParaMEDMEM::DataArrayDouble::Pow;
150 %newobject ParaMEDMEM::DataArrayDouble::substr;
151 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
152 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
153 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
154 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
155 %newobject ParaMEDMEM::DataArrayDouble::negate;
156 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
157 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
158 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
159 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
160 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
161 %newobject ParaMEDMEM::DataArrayDouble::determinant;
162 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
163 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
164 %newobject ParaMEDMEM::DataArrayDouble::inverse;
165 %newobject ParaMEDMEM::DataArrayDouble::trace;
166 %newobject ParaMEDMEM::DataArrayDouble::deviator;
167 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
168 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
169 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
170 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
171 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
172 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
173 %newobject ParaMEDMEM::DataArrayDouble::renumber;
174 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
175 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
176 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
177 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
178 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
179 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
180 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
181 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
182 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
183 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
184 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
185 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
186 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
187 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
188 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
189 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
190 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
191 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
192 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
194 %feature("unref") DataArray "$this->decrRef();"
195 %feature("unref") DataArrayDouble "$this->decrRef();"
196 %feature("unref") DataArrayInt "$this->decrRef();"
197 %feature("unref") DataArrayChar "$this->decrRef();"
198 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
199 %feature("unref") DataArrayByte "$this->decrRef();"
203 class DataArray : public RefCountObject, public TimeLabel
206 void setName(const char *name);
207 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
208 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
209 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
210 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
211 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
212 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
213 std::string getName() const;
214 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
215 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
216 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
217 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
218 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
219 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
220 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
221 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
222 int getNumberOfComponents() const;
223 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
224 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
225 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
226 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
227 virtual void desallocate() throw(INTERP_KERNEL::Exception);
228 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
229 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
230 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
231 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
232 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
233 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
234 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
235 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
236 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
237 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
238 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
239 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
240 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
241 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
242 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
243 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
244 void updateTime() const;
247 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
249 const std::vector<std::string>& comps=self->getInfoOnComponents();
250 PyObject *ret=PyList_New((int)comps.size());
251 for(int i=0;i<(int)comps.size();i++)
252 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
256 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
258 std::vector<int> tmp;
259 convertPyToNewIntArr3(li,tmp);
260 self->copyPartOfStringInfoFrom(other,tmp);
263 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
265 std::vector<int> tmp;
266 convertPyToNewIntArr3(li,tmp);
267 self->copyPartOfStringInfoFrom2(tmp,other);
270 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
273 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
274 if (!SWIG_IsOK(res1))
277 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
278 if(size!=self->getNumberOfTuples())
280 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
282 self->renumberInPlace(tmp);
286 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
288 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
289 da2->checkAllocated();
290 int size=self->getNumberOfTuples();
291 if(size!=self->getNumberOfTuples())
293 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
295 self->renumberInPlace(da2->getConstPointer());
299 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
302 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
303 if (!SWIG_IsOK(res1))
306 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
307 if(size!=self->getNumberOfTuples())
309 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
311 self->renumberInPlaceR(tmp);
315 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
317 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
318 da2->checkAllocated();
319 int size=self->getNumberOfTuples();
320 if(size!=self->getNumberOfTuples())
322 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
324 self->renumberInPlaceR(da2->getConstPointer());
328 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
329 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
331 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
332 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
333 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
334 DataArrayInt *tuplesSelecPtr2=0;
337 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
339 throw INTERP_KERNEL::Exception(msg);
341 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
344 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
346 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
347 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
350 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
352 std::vector<std::pair<int,int> > ranges;
353 convertPyToVectorPairInt(li,ranges);
354 return self->selectByTupleRanges(ranges);
357 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
360 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
361 if (!SWIG_IsOK(res1))
364 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
365 return self->selectByTupleId(tmp,tmp+size);
369 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
371 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
372 da2->checkAllocated();
373 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
377 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
380 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
381 if (!SWIG_IsOK(res1))
384 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
385 return self->selectByTupleIdSafe(tmp,tmp+size);
389 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
391 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
392 da2->checkAllocated();
393 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
397 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
399 std::vector<int> tmp;
400 convertPyToNewIntArr3(li,tmp);
401 DataArray *ret=self->keepSelectedComponents(tmp);
402 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
405 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
407 if(!PySlice_Check(slic))
408 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
409 Py_ssize_t strt=2,stp=2,step=2;
410 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
411 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
412 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
413 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
414 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
416 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
417 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
420 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
422 if(!PySlice_Check(slic))
423 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
424 Py_ssize_t strt=2,stp=2,step=2;
425 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
426 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
427 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
429 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
430 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
433 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
435 if(!PySlice_Check(slic))
436 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
437 Py_ssize_t strt=2,stp=2,step=2;
438 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
439 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
440 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
441 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
442 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
443 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
446 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
448 if(!PySlice_Check(slic))
449 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
450 Py_ssize_t strt=2,stp=2,step=2;
451 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
452 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
453 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
454 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
455 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
456 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
459 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
461 std::vector<const DataArray *> tmp;
462 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
463 return DataArray::Aggregate(tmp);
466 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
468 if(!PySlice_Check(slic))
469 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
470 Py_ssize_t strt=2,stp=2,step=2;
471 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
472 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
473 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
474 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
477 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
479 if(!PySlice_Check(slic))
480 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
481 Py_ssize_t strt=2,stp=2,step=2;
482 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
483 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
484 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
485 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
491 class DataArrayDoubleIterator;
493 class DataArrayDouble : public DataArray
496 static DataArrayDouble *New();
497 double doubleValue() const throw(INTERP_KERNEL::Exception);
498 bool empty() const throw(INTERP_KERNEL::Exception);
499 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
500 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
501 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
502 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
503 double popBackSilent() throw(INTERP_KERNEL::Exception);
504 void pack() const throw(INTERP_KERNEL::Exception);
505 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
506 void fillWithZero() throw(INTERP_KERNEL::Exception);
507 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
508 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
509 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
510 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
511 void reverse() throw(INTERP_KERNEL::Exception);
512 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
513 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
514 std::string repr() const throw(INTERP_KERNEL::Exception);
515 std::string reprZip() const throw(INTERP_KERNEL::Exception);
516 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
517 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
518 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
519 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
520 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
521 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
522 void transpose() throw(INTERP_KERNEL::Exception);
523 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
524 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
525 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
526 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
527 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
528 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
529 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
530 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
531 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
532 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
533 double front() const throw(INTERP_KERNEL::Exception);
534 double back() const throw(INTERP_KERNEL::Exception);
535 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
536 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
537 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
538 double *getPointer() throw(INTERP_KERNEL::Exception);
539 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
540 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
541 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
542 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
543 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
544 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
545 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
546 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
547 double getAverageValue() const throw(INTERP_KERNEL::Exception);
548 double norm2() const throw(INTERP_KERNEL::Exception);
549 double normMax() const throw(INTERP_KERNEL::Exception);
550 double normMin() const throw(INTERP_KERNEL::Exception);
551 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
567 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
568 void abs() throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
570 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
571 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
572 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
573 void applyPow(double val) throw(INTERP_KERNEL::Exception);
574 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
575 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
576 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
577 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
578 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
579 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
580 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
581 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
582 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
583 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
584 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
585 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
586 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
587 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
588 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
589 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
590 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
591 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
592 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
593 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
594 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
595 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
596 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
597 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
598 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
599 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
600 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
603 DataArrayDouble() throw(INTERP_KERNEL::Exception)
605 return DataArrayDouble::New();
608 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
610 const char *msgBase="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
611 std::string msg(msgBase);
613 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
616 if(PyList_Check(elt0) || PyTuple_Check(elt0))
620 if(PyInt_Check(nbOfTuples))
622 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
624 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
627 if(PyInt_Check(elt2))
628 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
629 int nbOfCompo=PyInt_AS_LONG(elt2);
631 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
632 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
633 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
634 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
638 throw INTERP_KERNEL::Exception(msg.c_str());
641 {//DataArrayDouble.New([1.,3.,4.],3)
642 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
644 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
645 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
650 throw INTERP_KERNEL::Exception(msg.c_str());
653 {// DataArrayDouble.New([1.,3.,4.])
654 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
655 int tmpp1=-1,tmpp2=-1;
656 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
657 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
661 else if(PyInt_Check(elt0))
663 int nbOfTuples1=PyInt_AS_LONG(elt0);
665 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
670 if(PyInt_Check(nbOfTuples))
671 {//DataArrayDouble.New(5,2)
672 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
674 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
675 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
676 ret->alloc(nbOfTuples1,nbOfCompo);
680 throw INTERP_KERNEL::Exception(msg.c_str());
683 throw INTERP_KERNEL::Exception(msg.c_str());
686 {//DataArrayDouble.New(5)
687 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
688 ret->alloc(nbOfTuples1,1);
693 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
694 {//DataArrayDouble.New(numpyArray)
695 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
699 throw INTERP_KERNEL::Exception(msg.c_str());
702 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
704 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
707 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
710 std::vector<double> bb;
712 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
713 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
714 self->pushBackValsSilent(tmp,tmp+nbTuples);
717 std::string __repr__() const throw(INTERP_KERNEL::Exception)
719 std::ostringstream oss;
720 self->reprQuickOverview(oss);
724 std::string __str__() const throw(INTERP_KERNEL::Exception)
729 double __float__() const throw(INTERP_KERNEL::Exception)
731 return self->doubleValue();
734 int __len__() const throw(INTERP_KERNEL::Exception)
736 if(self->isAllocated())
738 return self->getNumberOfTuples();
742 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
746 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
748 return self->iterator();
751 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
753 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 !";
754 if(PyList_Check(li) || PyTuple_Check(li))
758 if(PyInt_Check(nbOfTuples))
760 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
762 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
765 if(PyInt_Check(nbOfComp))
766 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
767 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
769 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
770 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
771 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
774 throw INTERP_KERNEL::Exception(msg);
777 {//DataArrayDouble.setValues([1.,3.,4.],3)
779 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
780 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
784 throw INTERP_KERNEL::Exception(msg);
787 {// DataArrayDouble.setValues([1.,3.,4.])
788 int tmpp1=-1,tmpp2=-1;
789 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
790 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
794 throw INTERP_KERNEL::Exception(msg);
797 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
799 const double *vals=self->getConstPointer();
800 return convertDblArrToPyList(vals,self->getNbOfElems());
804 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
806 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
810 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
813 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
814 PyObject *ret=PyTuple_New(2);
815 PyObject *ret0Py=ret0?Py_True:Py_False;
817 PyTuple_SetItem(ret,0,ret0Py);
818 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
822 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
824 const double *vals=self->getConstPointer();
825 int nbOfComp=self->getNumberOfComponents();
826 int nbOfTuples=self->getNumberOfTuples();
827 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
830 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
833 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
834 if (!SWIG_IsOK(res1))
837 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
838 if(size!=self->getNumberOfTuples())
840 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
842 return self->renumber(tmp);
846 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
848 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
849 da2->checkAllocated();
850 int size=self->getNumberOfTuples();
851 if(size!=self->getNumberOfTuples())
853 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
855 return self->renumber(da2->getConstPointer());
859 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
862 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
863 if (!SWIG_IsOK(res1))
866 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
867 if(size!=self->getNumberOfTuples())
869 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
871 return self->renumberR(tmp);
875 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
877 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
878 da2->checkAllocated();
879 int size=self->getNumberOfTuples();
880 if(size!=self->getNumberOfTuples())
882 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
884 return self->renumberR(da2->getConstPointer());
888 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
891 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
892 if (!SWIG_IsOK(res1))
895 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
896 if(size!=self->getNumberOfTuples())
898 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
900 return self->renumberAndReduce(tmp,newNbOfTuple);
904 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
906 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
907 da2->checkAllocated();
908 int size=self->getNumberOfTuples();
909 if(size!=self->getNumberOfTuples())
911 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
913 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
917 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
919 int thisTupleId,otherTupleId;
920 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
921 PyObject *ret=PyTuple_New(3);
922 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
923 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
924 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
928 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
931 double r1=self->getMaxValue(tmp);
932 PyObject *ret=PyTuple_New(2);
933 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
934 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
938 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
941 double r1=self->getMaxValue2(tmp);
942 PyObject *ret=PyTuple_New(2);
943 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
944 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
948 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
951 double r1=self->getMinValue(tmp);
952 PyObject *ret=PyTuple_New(2);
953 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
954 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
958 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
961 double r1=self->getMinValue2(tmp);
962 PyObject *ret=PyTuple_New(2);
963 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
964 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
968 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
970 int nbOfCompo=self->getNumberOfComponents();
971 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
972 self->getMinMaxPerComponent(tmp);
973 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
977 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
979 int sz=self->getNumberOfComponents();
980 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
981 self->accumulate(tmp);
982 return convertDblArrToPyList(tmp,sz);
985 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
988 std::vector<int> val2;
989 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
990 return self->accumulatePerChunck(bg,bg+sz);
993 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
995 DataArrayInt *comm, *commIndex;
996 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
997 PyObject *res = PyList_New(2);
998 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
999 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1003 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1007 DataArrayDoubleTuple *aa;
1008 std::vector<double> bb;
1010 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1011 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1013 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1014 PyObject *ret=PyTuple_New(2);
1015 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1016 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1020 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1022 std::vector<int> tmp;
1023 convertPyToNewIntArr3(li,tmp);
1024 self->setSelectedComponents(a,tmp);
1027 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1029 int sz=self->getNumberOfComponents();
1030 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1031 self->getTuple(tupleId,tmp);
1032 return convertDblArrToPyList(tmp,sz);
1035 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1037 std::vector<const DataArrayDouble *> tmp;
1038 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1039 return DataArrayDouble::Aggregate(tmp);
1042 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1044 std::vector<const DataArrayDouble *> tmp;
1045 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1046 return DataArrayDouble::Meld(tmp);
1049 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1053 DataArrayDoubleTuple *aa;
1054 std::vector<double> bb;
1056 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1057 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1058 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1059 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1060 DataArrayInt *c=0,*cI=0;
1061 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1062 PyObject *ret=PyTuple_New(2);
1063 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1064 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1068 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1070 DataArrayInt *ret1=0;
1071 bool ret0=self->areIncludedInMe(other,prec,ret1);
1072 PyObject *ret=PyTuple_New(2);
1073 PyObject *ret0Py=ret0?Py_True:Py_False;
1075 PyTuple_SetItem(ret,0,ret0Py);
1076 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1080 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1082 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1083 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1084 self->checkAllocated();
1085 int nbOfTuples=self->getNumberOfTuples();
1086 int nbOfComponents=self->getNumberOfComponents();
1088 std::vector<int> vt1,vc1;
1089 std::pair<int, std::pair<int,int> > pt1,pc1;
1090 DataArrayInt *dt1=0,*dc1=0;
1092 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1093 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1097 if(nbOfComponents==1)
1098 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1099 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1101 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1103 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1105 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1107 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1110 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1111 std::vector<int> v2(1,ic1);
1112 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1116 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1117 std::vector<int> v2(1,ic1);
1118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1122 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1123 std::vector<int> v2(1,ic1);
1124 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1128 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1133 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1134 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1138 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1139 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1143 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1144 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1148 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1149 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1150 std::vector<int> v2(nbOfComp);
1151 for(int i=0;i<nbOfComp;i++)
1152 v2[i]=pc1.first+i*pc1.second.second;
1153 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1157 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1158 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1159 std::vector<int> v2(nbOfComp);
1160 for(int i=0;i<nbOfComp;i++)
1161 v2[i]=pc1.first+i*pc1.second.second;
1162 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1166 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1167 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1168 std::vector<int> v2(nbOfComp);
1169 for(int i=0;i<nbOfComp;i++)
1170 v2[i]=pc1.first+i*pc1.second.second;
1171 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1175 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1176 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1177 std::vector<int> v2(nbOfComp);
1178 for(int i=0;i<nbOfComp;i++)
1179 v2[i]=pc1.first+i*pc1.second.second;
1180 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1183 throw INTERP_KERNEL::Exception(msg);
1187 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1189 self->checkAllocated();
1190 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1191 int nbOfTuples=self->getNumberOfTuples();
1192 int nbOfComponents=self->getNumberOfComponents();
1195 std::vector<double> v1;
1196 DataArrayDouble *d1=0;
1197 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1199 std::vector<int> vt1,vc1;
1200 std::pair<int, std::pair<int,int> > pt1,pc1;
1201 DataArrayInt *dt1=0,*dc1=0;
1202 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1203 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1211 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1214 tmp=DataArrayDouble::New();
1215 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1216 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1219 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1222 throw INTERP_KERNEL::Exception(msg);
1231 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1234 tmp=DataArrayDouble::New();
1235 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1236 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1239 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1242 throw INTERP_KERNEL::Exception(msg);
1251 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1254 tmp=DataArrayDouble::New();
1255 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1256 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1259 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1262 throw INTERP_KERNEL::Exception(msg);
1271 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1274 tmp=DataArrayDouble::New();
1275 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1276 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1279 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1282 throw INTERP_KERNEL::Exception(msg);
1291 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1294 tmp=DataArrayDouble::New();
1295 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1296 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1299 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1302 throw INTERP_KERNEL::Exception(msg);
1311 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1314 tmp=DataArrayDouble::New();
1315 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1316 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1319 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1322 throw INTERP_KERNEL::Exception(msg);
1331 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1334 tmp=DataArrayDouble::New();
1335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1336 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1339 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1342 throw INTERP_KERNEL::Exception(msg);
1351 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1354 tmp=DataArrayDouble::New();
1355 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1356 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1359 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1362 throw INTERP_KERNEL::Exception(msg);
1371 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1374 tmp=DataArrayDouble::New();
1375 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1376 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1379 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1382 throw INTERP_KERNEL::Exception(msg);
1391 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1394 tmp=DataArrayDouble::New();
1395 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1396 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1399 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1402 throw INTERP_KERNEL::Exception(msg);
1411 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1414 tmp=DataArrayDouble::New();
1415 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1416 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1419 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1422 throw INTERP_KERNEL::Exception(msg);
1431 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1434 tmp=DataArrayDouble::New();
1435 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1436 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1439 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1442 throw INTERP_KERNEL::Exception(msg);
1451 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1454 tmp=DataArrayDouble::New();
1455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1456 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1459 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1462 throw INTERP_KERNEL::Exception(msg);
1471 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1474 tmp=DataArrayDouble::New();
1475 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1476 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1479 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1482 throw INTERP_KERNEL::Exception(msg);
1491 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1494 tmp=DataArrayDouble::New();
1495 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1496 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1499 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1502 throw INTERP_KERNEL::Exception(msg);
1511 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1514 tmp=DataArrayDouble::New();
1515 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1516 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1519 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1522 throw INTERP_KERNEL::Exception(msg);
1527 throw INTERP_KERNEL::Exception(msg);
1532 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1534 return self->negate();
1537 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1539 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1542 DataArrayDoubleTuple *aa;
1543 std::vector<double> bb;
1546 #ifndef WITHOUT_AUTOFIELD
1548 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1550 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1553 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1554 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1556 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1559 throw INTERP_KERNEL::Exception(msg);
1563 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1568 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1569 ret->applyLin(1.,val);
1570 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1574 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1578 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1579 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1583 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1584 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1587 throw INTERP_KERNEL::Exception(msg);
1591 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1593 const char msg[]="Unexpected situation in __radd__ !";
1596 DataArrayDoubleTuple *aa;
1597 std::vector<double> bb;
1599 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1604 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1605 ret->applyLin(1.,val);
1610 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1611 return DataArrayDouble::Add(self,aaa);
1615 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1616 return DataArrayDouble::Add(self,aaa);
1619 throw INTERP_KERNEL::Exception(msg);
1623 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1625 const char msg[]="Unexpected situation in __iadd__ !";
1628 DataArrayDoubleTuple *aa;
1629 std::vector<double> bb;
1631 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1636 self->applyLin(1.,val);
1637 Py_XINCREF(trueSelf);
1643 Py_XINCREF(trueSelf);
1648 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1649 self->addEqual(aaa);
1650 Py_XINCREF(trueSelf);
1655 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1656 self->addEqual(aaa);
1657 Py_XINCREF(trueSelf);
1661 throw INTERP_KERNEL::Exception(msg);
1665 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1667 const char msg[]="Unexpected situation in __sub__ !";
1670 DataArrayDoubleTuple *aa;
1671 std::vector<double> bb;
1674 #ifndef WITHOUT_AUTOFIELD
1676 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1678 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1681 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1682 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1684 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1687 throw INTERP_KERNEL::Exception(msg);
1691 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1696 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1697 ret->applyLin(1.,-val);
1698 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1702 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1706 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1707 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1711 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1712 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1715 throw INTERP_KERNEL::Exception(msg);
1719 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1721 const char msg[]="Unexpected situation in __rsub__ !";
1724 DataArrayDoubleTuple *aa;
1725 std::vector<double> bb;
1727 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1732 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1733 ret->applyLin(-1.,val);
1738 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1739 return DataArrayDouble::Substract(aaa,self);
1743 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1744 return DataArrayDouble::Substract(aaa,self);
1747 throw INTERP_KERNEL::Exception(msg);
1751 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1753 const char msg[]="Unexpected situation in __isub__ !";
1756 DataArrayDoubleTuple *aa;
1757 std::vector<double> bb;
1759 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1764 self->applyLin(1,-val);
1765 Py_XINCREF(trueSelf);
1770 self->substractEqual(a);
1771 Py_XINCREF(trueSelf);
1776 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1777 self->substractEqual(aaa);
1778 Py_XINCREF(trueSelf);
1783 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1784 self->substractEqual(aaa);
1785 Py_XINCREF(trueSelf);
1789 throw INTERP_KERNEL::Exception(msg);
1793 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1795 const char msg[]="Unexpected situation in __mul__ !";
1798 DataArrayDoubleTuple *aa;
1799 std::vector<double> bb;
1802 #ifndef WITHOUT_AUTOFIELD
1804 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1806 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1809 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1810 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1812 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1815 throw INTERP_KERNEL::Exception(msg);
1819 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1824 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1825 ret->applyLin(val,0.);
1826 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1830 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1834 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1835 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1839 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1840 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1843 throw INTERP_KERNEL::Exception(msg);
1847 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1849 const char msg[]="Unexpected situation in __rmul__ !";
1852 DataArrayDoubleTuple *aa;
1853 std::vector<double> bb;
1855 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1860 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1861 ret->applyLin(val,0.);
1866 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1867 return DataArrayDouble::Multiply(self,aaa);
1871 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1872 return DataArrayDouble::Multiply(self,aaa);
1875 throw INTERP_KERNEL::Exception(msg);
1879 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1881 const char msg[]="Unexpected situation in __imul__ !";
1884 DataArrayDoubleTuple *aa;
1885 std::vector<double> bb;
1887 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1892 self->applyLin(val,0.);
1893 Py_XINCREF(trueSelf);
1898 self->multiplyEqual(a);
1899 Py_XINCREF(trueSelf);
1904 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1905 self->multiplyEqual(aaa);
1906 Py_XINCREF(trueSelf);
1911 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1912 self->multiplyEqual(aaa);
1913 Py_XINCREF(trueSelf);
1917 throw INTERP_KERNEL::Exception(msg);
1921 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1923 const char msg[]="Unexpected situation in __div__ !";
1926 DataArrayDoubleTuple *aa;
1927 std::vector<double> bb;
1930 #ifndef WITHOUT_AUTOFIELD
1932 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1934 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1937 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1938 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1940 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1943 throw INTERP_KERNEL::Exception(msg);
1947 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1953 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1954 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1955 ret->applyLin(1/val,0.);
1956 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1960 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1964 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1965 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1969 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1970 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1973 throw INTERP_KERNEL::Exception(msg);
1977 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1979 const char msg[]="Unexpected situation in __rdiv__ !";
1982 DataArrayDoubleTuple *aa;
1983 std::vector<double> bb;
1985 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1990 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1996 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1997 return DataArrayDouble::Divide(aaa,self);
2001 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2002 return DataArrayDouble::Divide(aaa,self);
2005 throw INTERP_KERNEL::Exception(msg);
2009 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2011 const char msg[]="Unexpected situation in __idiv__ !";
2014 DataArrayDoubleTuple *aa;
2015 std::vector<double> bb;
2017 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2023 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2024 self->applyLin(1./val,0.);
2025 Py_XINCREF(trueSelf);
2030 self->divideEqual(a);
2031 Py_XINCREF(trueSelf);
2036 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2037 self->divideEqual(aaa);
2038 Py_XINCREF(trueSelf);
2043 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2044 self->divideEqual(aaa);
2045 Py_XINCREF(trueSelf);
2049 throw INTERP_KERNEL::Exception(msg);
2053 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2055 const char msg[]="Unexpected situation in __pow__ !";
2058 DataArrayDoubleTuple *aa;
2059 std::vector<double> bb;
2061 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2072 return DataArrayDouble::Pow(self,a);
2076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2077 return DataArrayDouble::Pow(self,aaa);
2081 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2082 return DataArrayDouble::Pow(self,aaa);
2085 throw INTERP_KERNEL::Exception(msg);
2089 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2091 const char msg[]="Unexpected situation in __rpow__ !";
2094 DataArrayDoubleTuple *aa;
2095 std::vector<double> bb;
2097 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2102 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2103 ret->applyRPow(val);
2108 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2109 return DataArrayDouble::Pow(aaa,self);
2113 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2114 return DataArrayDouble::Pow(aaa,self);
2117 throw INTERP_KERNEL::Exception(msg);
2121 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2123 const char msg[]="Unexpected situation in __ipow__ !";
2126 DataArrayDoubleTuple *aa;
2127 std::vector<double> bb;
2129 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2134 self->applyPow(val);
2135 Py_XINCREF(trueSelf);
2141 Py_XINCREF(trueSelf);
2146 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2147 self->powEqual(aaa);
2148 Py_XINCREF(trueSelf);
2153 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2154 self->powEqual(aaa);
2155 Py_XINCREF(trueSelf);
2159 throw INTERP_KERNEL::Exception(msg);
2163 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2165 DataArrayInt *c=0,*cI=0;
2167 self->computeTupleIdsNearTuples(other,eps,c,cI);
2168 PyObject *ret=PyTuple_New(2);
2169 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2170 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2174 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2176 DataArrayInt *ret1=0;
2177 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2178 PyObject *ret=PyTuple_New(2);
2179 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2180 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2186 class DataArrayDoubleTuple;
2188 class DataArrayDoubleIterator
2191 DataArrayDoubleIterator(DataArrayDouble *da);
2192 ~DataArrayDoubleIterator();
2197 DataArrayDoubleTuple *ret=self->nextt();
2199 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2202 PyErr_SetString(PyExc_StopIteration,"No more data.");
2209 class DataArrayDoubleTuple
2212 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2213 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2216 std::string __str__() const throw(INTERP_KERNEL::Exception)
2218 return self->repr();
2221 double __float__() const throw(INTERP_KERNEL::Exception)
2223 return self->doubleValue();
2226 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2228 return self->buildDADouble(1,self->getNumberOfCompo());
2231 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2233 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2234 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2235 Py_XINCREF(trueSelf);
2239 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2241 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2242 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2243 Py_XINCREF(trueSelf);
2247 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2249 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2250 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2251 Py_XINCREF(trueSelf);
2255 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2257 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2258 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2259 Py_XINCREF(trueSelf);
2263 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2265 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2268 std::vector<int> multiVal;
2269 std::pair<int, std::pair<int,int> > slic;
2270 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2271 const double *pt=self->getConstPointer();
2272 int nbc=self->getNumberOfCompo();
2273 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2280 std::ostringstream oss;
2281 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2282 throw INTERP_KERNEL::Exception(oss.str().c_str());
2285 return PyFloat_FromDouble(pt[singleVal]);
2289 return PyFloat_FromDouble(pt[nbc+singleVal]);
2292 std::ostringstream oss;
2293 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2294 throw INTERP_KERNEL::Exception(oss.str().c_str());
2300 PyObject *t=PyTuple_New(multiVal.size());
2301 for(int j=0;j<(int)multiVal.size();j++)
2303 int cid=multiVal[j];
2306 std::ostringstream oss;
2307 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2308 throw INTERP_KERNEL::Exception(oss.str().c_str());
2310 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2316 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2317 PyObject *t=PyTuple_New(sz);
2318 for(int j=0;j<sz;j++)
2319 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2323 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2327 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2329 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2330 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2333 std::vector<double> multiValV;
2334 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2335 int nbc=self->getNumberOfCompo();
2336 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2338 std::vector<int> multiVal;
2339 std::pair<int, std::pair<int,int> > slic;
2340 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2341 double *pt=self->getPointer();
2342 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2349 std::ostringstream oss;
2350 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2351 throw INTERP_KERNEL::Exception(oss.str().c_str());
2357 pt[singleVal]=singleValV;
2362 if(multiValV.size()!=1)
2364 std::ostringstream oss;
2365 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2366 throw INTERP_KERNEL::Exception(oss.str().c_str());
2368 pt[singleVal]=multiValV[0];
2373 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2377 throw INTERP_KERNEL::Exception(msg);
2386 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2390 std::ostringstream oss;
2391 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2392 throw INTERP_KERNEL::Exception(oss.str().c_str());
2400 if(multiVal.size()!=multiValV.size())
2402 std::ostringstream oss;
2403 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2404 throw INTERP_KERNEL::Exception(oss.str().c_str());
2406 for(int i=0;i<(int)multiVal.size();i++)
2408 int pos=multiVal[i];
2411 std::ostringstream oss;
2412 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2413 throw INTERP_KERNEL::Exception(oss.str().c_str());
2415 pt[multiVal[i]]=multiValV[i];
2421 const double *ptV=daIntTyyppV->getConstPointer();
2422 if(nbc>daIntTyyppV->getNumberOfCompo())
2424 std::ostringstream oss;
2425 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2426 throw INTERP_KERNEL::Exception(oss.str().c_str());
2428 std::copy(ptV,ptV+nbc,pt);
2432 throw INTERP_KERNEL::Exception(msg);
2437 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2442 for(int j=0;j<sz;j++)
2443 pt[slic.first+j*slic.second.second]=singleValV;
2448 if(sz!=(int)multiValV.size())
2450 std::ostringstream oss;
2451 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2452 throw INTERP_KERNEL::Exception(oss.str().c_str());
2454 for(int j=0;j<sz;j++)
2455 pt[slic.first+j*slic.second.second]=multiValV[j];
2460 const double *ptV=daIntTyyppV->getConstPointer();
2461 if(sz>daIntTyyppV->getNumberOfCompo())
2463 std::ostringstream oss;
2464 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2465 throw INTERP_KERNEL::Exception(oss.str().c_str());
2467 for(int j=0;j<sz;j++)
2468 pt[slic.first+j*slic.second.second]=ptV[j];
2472 throw INTERP_KERNEL::Exception(msg);
2476 throw INTERP_KERNEL::Exception(msg);
2482 class DataArrayIntIterator;
2484 class DataArrayInt : public DataArray
2487 static DataArrayInt *New();
2488 int intValue() const throw(INTERP_KERNEL::Exception);
2489 int getHashCode() const throw(INTERP_KERNEL::Exception);
2490 bool empty() const throw(INTERP_KERNEL::Exception);
2491 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2492 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2493 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2494 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2495 int popBackSilent() throw(INTERP_KERNEL::Exception);
2496 void pack() const throw(INTERP_KERNEL::Exception);
2497 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2498 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2499 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2500 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2501 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2502 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2503 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2504 void reverse() throw(INTERP_KERNEL::Exception);
2505 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2506 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2507 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2508 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2509 void fillWithZero() throw(INTERP_KERNEL::Exception);
2510 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2511 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2512 std::string repr() const throw(INTERP_KERNEL::Exception);
2513 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2514 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2516 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2517 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2518 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2519 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2520 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2521 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2522 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2523 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2524 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2525 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2526 void transpose() throw(INTERP_KERNEL::Exception);
2527 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2528 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2529 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2530 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2531 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2532 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2533 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2534 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2535 int front() const throw(INTERP_KERNEL::Exception);
2536 int back() const throw(INTERP_KERNEL::Exception);
2537 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2538 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2539 int *getPointer() throw(INTERP_KERNEL::Exception);
2540 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2541 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2542 const int *begin() const throw(INTERP_KERNEL::Exception);
2543 const int *end() const throw(INTERP_KERNEL::Exception);
2544 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2545 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2546 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2547 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2548 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2549 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2550 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2551 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2552 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2553 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2554 int count(int value) const throw(INTERP_KERNEL::Exception);
2555 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2556 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2557 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2558 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2559 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2560 void abs() throw(INTERP_KERNEL::Exception);
2561 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2562 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2563 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2564 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2565 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2566 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2567 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2568 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2569 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2570 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2572 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2573 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2574 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2575 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2576 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2577 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2578 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2579 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2583 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2584 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2585 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2586 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2587 void computeOffsets() throw(INTERP_KERNEL::Exception);
2588 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2589 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2591 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2592 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2593 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2594 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2595 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2596 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2597 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2598 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2599 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2600 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2601 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2602 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2603 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2604 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2605 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2607 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2610 DataArrayInt() throw(INTERP_KERNEL::Exception)
2612 return DataArrayInt::New();
2615 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2617 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)";
2618 std::string msg(msgBase);
2620 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2623 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2627 if(PyInt_Check(nbOfTuples))
2629 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2631 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2634 if(PyInt_Check(nbOfComp))
2635 {//DataArrayInt.New([1,3,4,5],2,2)
2636 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2638 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2639 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2640 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2641 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2645 throw INTERP_KERNEL::Exception(msg.c_str());
2648 {//DataArrayInt.New([1,3,4],3)
2649 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2651 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2652 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2657 throw INTERP_KERNEL::Exception(msg.c_str());
2660 {// DataArrayInt.New([1,3,4])
2661 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2662 int tmpp1=-1,tmpp2=-1;
2663 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2664 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2668 else if(PyInt_Check(elt0))
2670 int nbOfTuples1=PyInt_AS_LONG(elt0);
2672 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2677 if(PyInt_Check(nbOfTuples))
2678 {//DataArrayInt.New(5,2)
2679 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2681 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2682 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2683 ret->alloc(nbOfTuples1,nbOfCompo);
2687 throw INTERP_KERNEL::Exception(msg.c_str());
2690 throw INTERP_KERNEL::Exception(msg.c_str());
2693 {//DataArrayInt.New(5)
2694 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2695 ret->alloc(nbOfTuples1,1);
2700 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2701 {//DataArrayInt.New(numpyArray)
2702 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2706 throw INTERP_KERNEL::Exception(msg.c_str());
2709 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2711 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2714 std::string __str__() const throw(INTERP_KERNEL::Exception)
2716 return self->repr();
2719 int __len__() const throw(INTERP_KERNEL::Exception)
2721 if(self->isAllocated())
2723 return self->getNumberOfTuples();
2727 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2731 int __int__() const throw(INTERP_KERNEL::Exception)
2733 return self->intValue();
2736 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2738 return self->iterator();
2741 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2743 int sz=self->getNumberOfComponents();
2744 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2745 self->accumulate(tmp);
2746 return convertIntArrToPyList(tmp,sz);
2749 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2752 std::vector<int> val2;
2753 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2754 return self->accumulatePerChunck(bg,bg+sz);
2757 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2760 std::vector<int> val2;
2761 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2762 return self->getIdsEqualTuple(bg,bg+sz);
2765 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2767 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2768 PyObject *ret=PyList_New(slcs.size());
2769 for(std::size_t i=0;i<slcs.size();i++)
2770 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2774 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2776 if(!PySlice_Check(slic))
2777 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2778 Py_ssize_t strt=2,stp=2,step=2;
2779 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2780 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2781 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2782 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2783 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 !");
2784 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2787 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2789 int newNbOfTuples=-1;
2790 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2791 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2792 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2793 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2794 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2795 PyObject *ret=PyTuple_New(2);
2796 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2797 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2801 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2803 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 !";
2804 if(PyList_Check(li) || PyTuple_Check(li))
2808 if(PyInt_Check(nbOfTuples))
2810 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2812 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2815 if(PyInt_Check(nbOfComp))
2816 {//DataArrayInt.setValues([1,3,4,5],2,2)
2817 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2819 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2820 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2821 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2824 throw INTERP_KERNEL::Exception(msg);
2827 {//DataArrayInt.setValues([1,3,4],3)
2829 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2830 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2834 throw INTERP_KERNEL::Exception(msg);
2837 {// DataArrayInt.setValues([1,3,4])
2838 int tmpp1=-1,tmpp2=-1;
2839 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2840 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2844 throw INTERP_KERNEL::Exception(msg);
2847 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2849 const int *vals=self->getConstPointer();
2850 return convertIntArrToPyList(vals,self->getNbOfElems());
2854 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2856 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2860 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2863 bool ret0=self->isEqualIfNotWhy(other,ret1);
2864 PyObject *ret=PyTuple_New(2);
2865 PyObject *ret0Py=ret0?Py_True:Py_False;
2867 PyTuple_SetItem(ret,0,ret0Py);
2868 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2872 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2874 const int *vals=self->getConstPointer();
2875 int nbOfComp=self->getNumberOfComponents();
2876 int nbOfTuples=self->getNumberOfTuples();
2877 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2880 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2882 std::vector<const DataArrayInt *> groups;
2883 std::vector< std::vector<int> > fidsOfGroups;
2884 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2885 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2886 PyObject *ret = PyList_New(2);
2887 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2888 int sz=fidsOfGroups.size();
2889 PyObject *ret1 = PyList_New(sz);
2890 for(int i=0;i<sz;i++)
2891 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2892 PyList_SetItem(ret,1,ret1);
2896 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2899 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2900 if (!SWIG_IsOK(res1))
2903 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2904 self->transformWithIndArr(tmp,tmp+size);
2908 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2909 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2913 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2917 std::vector<int> multiVal;
2918 std::pair<int, std::pair<int,int> > slic;
2919 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2920 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2924 return self->getIdsEqualList(&singleVal,&singleVal+1);
2926 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2928 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2930 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2934 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2938 std::vector<int> multiVal;
2939 std::pair<int, std::pair<int,int> > slic;
2940 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2941 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2945 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2947 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2949 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2951 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2955 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2957 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2959 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2960 if (!SWIG_IsOK(res1))
2963 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2964 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2968 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2970 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2971 da2->checkAllocated();
2972 int size=self->getNumberOfTuples();
2973 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2975 PyObject *ret = PyList_New(3);
2976 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2977 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2978 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2982 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2985 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2986 if (!SWIG_IsOK(res1))
2989 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2990 return self->transformWithIndArrR(tmp,tmp+size);
2994 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2995 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2999 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3002 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3003 if (!SWIG_IsOK(res1))
3006 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3007 if(size!=self->getNumberOfTuples())
3009 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3011 return self->renumberAndReduce(tmp,newNbOfTuple);
3015 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3017 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3018 da2->checkAllocated();
3019 int size=self->getNumberOfTuples();
3020 if(size!=self->getNumberOfTuples())
3022 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3024 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3028 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3031 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3032 if (!SWIG_IsOK(res1))
3035 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3036 if(size!=self->getNumberOfTuples())
3038 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3040 return self->renumber(tmp);
3044 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3046 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3047 da2->checkAllocated();
3048 int size=self->getNumberOfTuples();
3049 if(size!=self->getNumberOfTuples())
3051 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3053 return self->renumber(da2->getConstPointer());
3057 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3060 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3061 if (!SWIG_IsOK(res1))
3064 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3065 if(size!=self->getNumberOfTuples())
3067 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3069 return self->renumberR(tmp);
3073 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3075 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3076 da2->checkAllocated();
3077 int size=self->getNumberOfTuples();
3078 if(size!=self->getNumberOfTuples())
3080 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3082 return self->renumberR(da2->getConstPointer());
3086 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3088 std::vector<int> tmp;
3089 convertPyToNewIntArr3(li,tmp);
3090 self->setSelectedComponents(a,tmp);
3093 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3095 int sz=self->getNumberOfComponents();
3096 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3097 self->getTuple(tupleId,tmp);
3098 return convertIntArrToPyList(tmp,sz);
3101 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3103 DataArrayInt *arr=0;
3104 DataArrayInt *arrI=0;
3105 self->changeSurjectiveFormat(targetNb,arr,arrI);
3106 PyObject *res = PyList_New(2);
3107 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3108 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3112 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3114 std::vector<const DataArrayInt *> tmp;
3115 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3116 return DataArrayInt::Meld(tmp);
3119 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3121 std::vector<const DataArrayInt *> tmp;
3122 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3123 return DataArrayInt::Aggregate(tmp);
3126 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3128 std::vector<const DataArrayInt *> tmp;
3129 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3130 return DataArrayInt::AggregateIndexes(tmp);
3133 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3135 std::vector<const DataArrayInt *> tmp;
3136 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3137 return DataArrayInt::BuildUnion(tmp);
3140 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3142 std::vector<const DataArrayInt *> tmp;
3143 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3144 return DataArrayInt::BuildIntersection(tmp);
3147 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3150 int r1=self->getMaxValue(tmp);
3151 PyObject *ret=PyTuple_New(2);
3152 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3153 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3157 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3160 int r1=self->getMinValue(tmp);
3161 PyObject *ret=PyTuple_New(2);
3162 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3163 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3167 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3169 int nbOfCompo=self->getNumberOfComponents();
3174 if(PyInt_Check(obj))
3176 int val=(int)PyInt_AS_LONG(obj);
3177 return self->locateValue(val);
3180 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3184 std::vector<int> arr;
3185 convertPyToNewIntArr3(obj,arr);
3186 return self->locateTuple(arr);
3191 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3193 int nbOfCompo=self->getNumberOfComponents();
3200 if(PyInt_Check(obj))
3202 int val=(int)PyInt_AS_LONG(obj);
3203 return self->presenceOfValue(val);
3206 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3210 std::vector<int> arr;
3211 convertPyToNewIntArr3(obj,arr);
3212 return self->presenceOfTuple(arr);
3217 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3219 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3220 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3221 self->checkAllocated();
3222 int nbOfTuples=self->getNumberOfTuples();
3223 int nbOfComponents=self->getNumberOfComponents();
3225 std::vector<int> vt1,vc1;
3226 std::pair<int, std::pair<int,int> > pt1,pc1;
3227 DataArrayInt *dt1=0,*dc1=0;
3229 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3230 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3235 if(nbOfComponents==1)
3236 return PyInt_FromLong(self->getIJSafe(it1,0));
3237 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3240 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3242 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3244 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3246 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3249 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3250 std::vector<int> v2(1,ic1);
3251 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3255 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3256 std::vector<int> v2(1,ic1);
3257 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3261 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3262 std::vector<int> v2(1,ic1);
3263 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3267 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3268 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3272 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3273 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3277 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3278 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3282 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3283 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3287 ret=self->selectByTupleIdSafe(&it1,&it1+1);
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(&vt1[0],&vt1[0]+vt1.size());
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 );
3305 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3306 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3307 std::vector<int> v2(nbOfComp);
3308 for(int i=0;i<nbOfComp;i++)
3309 v2[i]=pc1.first+i*pc1.second.second;
3310 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3314 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3315 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3316 std::vector<int> v2(nbOfComp);
3317 for(int i=0;i<nbOfComp;i++)
3318 v2[i]=pc1.first+i*pc1.second.second;
3319 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3322 throw INTERP_KERNEL::Exception(msg);
3326 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3328 self->checkAllocated();
3329 const char msg[]="Unexpected situation in __setitem__ !";
3330 int nbOfTuples=self->getNumberOfTuples();
3331 int nbOfComponents=self->getNumberOfComponents();
3334 std::vector<int> v1;
3336 DataArrayIntTuple *dd1=0;
3337 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3339 std::vector<int> vt1,vc1;
3340 std::pair<int, std::pair<int,int> > pt1,pc1;
3341 DataArrayInt *dt1=0,*dc1=0;
3342 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3343 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3351 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3354 tmp=DataArrayInt::New();
3355 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3356 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3359 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3362 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3363 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3366 throw INTERP_KERNEL::Exception(msg);
3375 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3378 tmp=DataArrayInt::New();
3379 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3380 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3383 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3386 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3387 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3390 throw INTERP_KERNEL::Exception(msg);
3399 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3402 tmp=DataArrayInt::New();
3403 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3404 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3407 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3410 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3411 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3414 throw INTERP_KERNEL::Exception(msg);
3423 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3426 tmp=DataArrayInt::New();
3427 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3428 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3431 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3434 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3435 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3438 throw INTERP_KERNEL::Exception(msg);
3447 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3450 tmp=DataArrayInt::New();
3451 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3452 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3455 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3458 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3459 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3462 throw INTERP_KERNEL::Exception(msg);
3471 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3474 tmp=DataArrayInt::New();
3475 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3476 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3479 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3482 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3483 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3486 throw INTERP_KERNEL::Exception(msg);
3495 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3498 tmp=DataArrayInt::New();
3499 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3500 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3503 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3506 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3507 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3510 throw INTERP_KERNEL::Exception(msg);
3519 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3522 tmp=DataArrayInt::New();
3523 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3524 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3527 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3530 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3531 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3534 throw INTERP_KERNEL::Exception(msg);
3543 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3546 tmp=DataArrayInt::New();
3547 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3548 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3551 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3554 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3555 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3558 throw INTERP_KERNEL::Exception(msg);
3567 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3570 tmp=DataArrayInt::New();
3571 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3572 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3575 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3578 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3579 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3582 throw INTERP_KERNEL::Exception(msg);
3591 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3594 tmp=DataArrayInt::New();
3595 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3596 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3599 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3602 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3603 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3606 throw INTERP_KERNEL::Exception(msg);
3615 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3618 tmp=DataArrayInt::New();
3619 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3620 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3623 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3626 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3627 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3630 throw INTERP_KERNEL::Exception(msg);
3639 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3642 tmp=DataArrayInt::New();
3643 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3644 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3647 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3650 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3651 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3654 throw INTERP_KERNEL::Exception(msg);
3663 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3666 tmp=DataArrayInt::New();
3667 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3668 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3671 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3674 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3675 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3678 throw INTERP_KERNEL::Exception(msg);
3687 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3690 tmp=DataArrayInt::New();
3691 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3692 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3695 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3698 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3699 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3702 throw INTERP_KERNEL::Exception(msg);
3711 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3714 tmp=DataArrayInt::New();
3715 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3716 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3719 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3722 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3723 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3726 throw INTERP_KERNEL::Exception(msg);
3731 throw INTERP_KERNEL::Exception(msg);
3736 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3738 return self->negate();
3741 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3743 const char msg[]="Unexpected situation in __add__ !";
3746 std::vector<int> aa;
3747 DataArrayIntTuple *aaa;
3749 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3754 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3755 ret->applyLin(1,val);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3761 return DataArrayInt::Add(self,aaaa);
3765 return DataArrayInt::Add(self,a);
3769 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3770 return DataArrayInt::Add(self,aaaa);
3773 throw INTERP_KERNEL::Exception(msg);
3777 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3779 const char msg[]="Unexpected situation in __radd__ !";
3782 std::vector<int> aa;
3783 DataArrayIntTuple *aaa;
3785 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3790 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3791 ret->applyLin(1,val);
3796 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3797 return DataArrayInt::Add(self,aaaa);
3801 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3802 return DataArrayInt::Add(self,aaaa);
3805 throw INTERP_KERNEL::Exception(msg);
3809 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3811 const char msg[]="Unexpected situation in __iadd__ !";
3814 std::vector<int> aa;
3815 DataArrayIntTuple *aaa;
3817 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3822 self->applyLin(1,val);
3823 Py_XINCREF(trueSelf);
3828 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3830 Py_XINCREF(trueSelf);
3836 Py_XINCREF(trueSelf);
3841 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3842 self->addEqual(aaaa);
3843 Py_XINCREF(trueSelf);
3847 throw INTERP_KERNEL::Exception(msg);
3851 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3853 const char msg[]="Unexpected situation in __sub__ !";
3856 std::vector<int> aa;
3857 DataArrayIntTuple *aaa;
3859 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3864 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3865 ret->applyLin(1,-val);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3871 return DataArrayInt::Substract(self,aaaa);
3875 return DataArrayInt::Substract(self,a);
3879 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3880 return DataArrayInt::Substract(self,aaaa);
3883 throw INTERP_KERNEL::Exception(msg);
3887 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3889 const char msg[]="Unexpected situation in __rsub__ !";
3892 std::vector<int> aa;
3893 DataArrayIntTuple *aaa;
3895 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3900 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3901 ret->applyLin(-1,val);
3906 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3907 return DataArrayInt::Substract(aaaa,self);
3911 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3912 return DataArrayInt::Substract(aaaa,self);
3915 throw INTERP_KERNEL::Exception(msg);
3919 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3921 const char msg[]="Unexpected situation in __isub__ !";
3924 std::vector<int> aa;
3925 DataArrayIntTuple *aaa;
3927 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3932 self->applyLin(1,-val);
3933 Py_XINCREF(trueSelf);
3938 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3939 self->substractEqual(bb);
3940 Py_XINCREF(trueSelf);
3945 self->substractEqual(a);
3946 Py_XINCREF(trueSelf);
3951 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3952 self->substractEqual(aaaa);
3953 Py_XINCREF(trueSelf);
3957 throw INTERP_KERNEL::Exception(msg);
3961 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3963 const char msg[]="Unexpected situation in __mul__ !";
3966 std::vector<int> aa;
3967 DataArrayIntTuple *aaa;
3969 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3974 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3975 ret->applyLin(val,0);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3981 return DataArrayInt::Multiply(self,aaaa);
3985 return DataArrayInt::Multiply(self,a);
3989 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3990 return DataArrayInt::Multiply(self,aaaa);
3993 throw INTERP_KERNEL::Exception(msg);
3997 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3999 const char msg[]="Unexpected situation in __rmul__ !";
4002 std::vector<int> aa;
4003 DataArrayIntTuple *aaa;
4005 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4010 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4011 ret->applyLin(val,0);
4016 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4017 return DataArrayInt::Multiply(self,aaaa);
4021 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4022 return DataArrayInt::Multiply(self,aaaa);
4025 throw INTERP_KERNEL::Exception(msg);
4029 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4031 const char msg[]="Unexpected situation in __imul__ !";
4034 std::vector<int> aa;
4035 DataArrayIntTuple *aaa;
4037 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4042 self->applyLin(val,0);
4043 Py_XINCREF(trueSelf);
4048 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4049 self->multiplyEqual(bb);
4050 Py_XINCREF(trueSelf);
4055 self->multiplyEqual(a);
4056 Py_XINCREF(trueSelf);
4061 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4062 self->multiplyEqual(aaaa);
4063 Py_XINCREF(trueSelf);
4067 throw INTERP_KERNEL::Exception(msg);
4071 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4073 const char msg[]="Unexpected situation in __div__ !";
4076 std::vector<int> aa;
4077 DataArrayIntTuple *aaa;
4079 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4084 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4085 ret->applyDivideBy(val);
4090 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4091 return DataArrayInt::Divide(self,aaaa);
4095 return DataArrayInt::Divide(self,a);
4099 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4100 return DataArrayInt::Divide(self,aaaa);
4103 throw INTERP_KERNEL::Exception(msg);
4107 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4109 const char msg[]="Unexpected situation in __rdiv__ !";
4112 std::vector<int> aa;
4113 DataArrayIntTuple *aaa;
4115 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4120 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4126 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4127 return DataArrayInt::Divide(aaaa,self);
4131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4132 return DataArrayInt::Divide(aaaa,self);
4135 throw INTERP_KERNEL::Exception(msg);
4139 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4141 const char msg[]="Unexpected situation in __idiv__ !";
4144 std::vector<int> aa;
4145 DataArrayIntTuple *aaa;
4147 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4152 self->applyDivideBy(val);
4153 Py_XINCREF(trueSelf);
4158 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4159 self->divideEqual(bb);
4160 Py_XINCREF(trueSelf);
4165 self->divideEqual(a);
4166 Py_XINCREF(trueSelf);
4171 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4172 self->divideEqual(aaaa);
4173 Py_XINCREF(trueSelf);
4177 throw INTERP_KERNEL::Exception(msg);
4181 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4183 const char msg[]="Unexpected situation in __mod__ !";
4186 std::vector<int> aa;
4187 DataArrayIntTuple *aaa;
4189 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4194 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4195 ret->applyModulus(val);
4200 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4201 return DataArrayInt::Modulus(self,aaaa);
4205 return DataArrayInt::Modulus(self,a);
4209 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4210 return DataArrayInt::Modulus(self,aaaa);
4213 throw INTERP_KERNEL::Exception(msg);
4217 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4219 const char msg[]="Unexpected situation in __rmod__ !";
4222 std::vector<int> aa;
4223 DataArrayIntTuple *aaa;
4225 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4230 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4231 ret->applyRModulus(val);
4236 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4237 return DataArrayInt::Modulus(aaaa,self);
4241 return DataArrayInt::Modulus(a,self);
4245 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4246 return DataArrayInt::Modulus(aaaa,self);
4249 throw INTERP_KERNEL::Exception(msg);
4253 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4255 const char msg[]="Unexpected situation in __imod__ !";
4258 std::vector<int> aa;
4259 DataArrayIntTuple *aaa;
4261 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4266 self->applyModulus(val);
4267 Py_XINCREF(trueSelf);
4272 self->modulusEqual(a);
4273 Py_XINCREF(trueSelf);
4278 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4279 self->modulusEqual(aaaa);
4280 Py_XINCREF(trueSelf);
4284 throw INTERP_KERNEL::Exception(msg);
4288 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4290 const char msg[]="Unexpected situation in __pow__ !";
4293 std::vector<int> aa;
4294 DataArrayIntTuple *aaa;
4296 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4301 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4307 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4308 return DataArrayInt::Pow(self,aaaa);
4312 return DataArrayInt::Pow(self,a);
4316 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4317 return DataArrayInt::Pow(self,aaaa);
4320 throw INTERP_KERNEL::Exception(msg);
4324 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4326 const char msg[]="Unexpected situation in __rpow__ !";
4329 std::vector<int> aa;
4330 DataArrayIntTuple *aaa;
4332 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4337 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4338 ret->applyRPow(val);
4343 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4344 return DataArrayInt::Pow(aaaa,self);
4348 return DataArrayInt::Pow(a,self);
4352 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4353 return DataArrayInt::Pow(aaaa,self);
4356 throw INTERP_KERNEL::Exception(msg);
4360 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4362 const char msg[]="Unexpected situation in __ipow__ !";
4365 std::vector<int> aa;
4366 DataArrayIntTuple *aaa;
4368 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4373 self->applyPow(val);
4374 Py_XINCREF(trueSelf);
4380 Py_XINCREF(trueSelf);
4385 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4386 self->powEqual(aaaa);
4387 Py_XINCREF(trueSelf);
4391 throw INTERP_KERNEL::Exception(msg);
4395 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4397 std::ostringstream oss;
4398 self->reprQuickOverview(oss);
4402 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4404 int szArr,sw,iTypppArr;
4405 std::vector<int> stdvecTyyppArr;
4406 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4407 self->pushBackValsSilent(tmp,tmp+szArr);
4410 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4412 std::vector<int> ret1;
4413 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4414 std::size_t sz=ret0.size();
4415 PyObject *pyRet=PyTuple_New(2);
4416 PyObject *pyRet0=PyList_New((int)sz);
4417 PyObject *pyRet1=PyList_New((int)sz);
4418 for(std::size_t i=0;i<sz;i++)
4420 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4421 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4423 PyTuple_SetItem(pyRet,0,pyRet0);
4424 PyTuple_SetItem(pyRet,1,pyRet1);
4428 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4430 DataArrayInt *ret0=0,*ret1=0;
4431 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4432 PyObject *pyRet=PyTuple_New(2);
4433 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4434 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4440 class DataArrayIntTuple;
4442 class DataArrayIntIterator
4445 DataArrayIntIterator(DataArrayInt *da);
4446 ~DataArrayIntIterator();
4451 DataArrayIntTuple *ret=self->nextt();
4453 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4456 PyErr_SetString(PyExc_StopIteration,"No more data.");
4463 class DataArrayIntTuple
4466 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4467 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4470 std::string __str__() const throw(INTERP_KERNEL::Exception)
4472 return self->repr();
4475 int __int__() const throw(INTERP_KERNEL::Exception)
4477 return self->intValue();
4480 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4482 return self->buildDAInt(1,self->getNumberOfCompo());
4485 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4487 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4488 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4489 Py_XINCREF(trueSelf);
4493 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4495 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4496 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4497 Py_XINCREF(trueSelf);
4501 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4503 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4504 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4505 Py_XINCREF(trueSelf);
4509 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4511 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4512 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4513 Py_XINCREF(trueSelf);
4517 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4519 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4520 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4521 Py_XINCREF(trueSelf);
4525 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4527 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4530 std::vector<int> multiVal;
4531 std::pair<int, std::pair<int,int> > slic;
4532 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4533 const int *pt=self->getConstPointer();
4534 int nbc=self->getNumberOfCompo();
4535 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4542 std::ostringstream oss;
4543 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4544 throw INTERP_KERNEL::Exception(oss.str().c_str());
4547 return PyInt_FromLong(pt[singleVal]);
4551 return PyInt_FromLong(pt[nbc+singleVal]);
4554 std::ostringstream oss;
4555 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4556 throw INTERP_KERNEL::Exception(oss.str().c_str());
4562 PyObject *t=PyTuple_New(multiVal.size());
4563 for(int j=0;j<(int)multiVal.size();j++)
4565 int cid=multiVal[j];
4568 std::ostringstream oss;
4569 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4570 throw INTERP_KERNEL::Exception(oss.str().c_str());
4572 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4578 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4579 PyObject *t=PyTuple_New(sz);
4580 for(int j=0;j<sz;j++)
4581 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4585 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4589 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4591 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4592 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4595 std::vector<int> multiValV;
4596 std::pair<int, std::pair<int,int> > slicV;
4597 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4598 int nbc=self->getNumberOfCompo();
4599 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4601 std::vector<int> multiVal;
4602 std::pair<int, std::pair<int,int> > slic;
4603 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4604 int *pt=self->getPointer();
4605 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4612 std::ostringstream oss;
4613 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4614 throw INTERP_KERNEL::Exception(oss.str().c_str());
4620 pt[singleVal]=singleValV;
4625 if(multiValV.size()!=1)
4627 std::ostringstream oss;
4628 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4629 throw INTERP_KERNEL::Exception(oss.str().c_str());
4631 pt[singleVal]=multiValV[0];
4636 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4640 throw INTERP_KERNEL::Exception(msg);
4649 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4653 std::ostringstream oss;
4654 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4655 throw INTERP_KERNEL::Exception(oss.str().c_str());
4663 if(multiVal.size()!=multiValV.size())
4665 std::ostringstream oss;
4666 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4667 throw INTERP_KERNEL::Exception(oss.str().c_str());
4669 for(int i=0;i<(int)multiVal.size();i++)
4671 int pos=multiVal[i];
4674 std::ostringstream oss;
4675 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4676 throw INTERP_KERNEL::Exception(oss.str().c_str());
4678 pt[multiVal[i]]=multiValV[i];
4684 const int *ptV=daIntTyyppV->getConstPointer();
4685 if(nbc>daIntTyyppV->getNumberOfCompo())
4687 std::ostringstream oss;
4688 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4689 throw INTERP_KERNEL::Exception(oss.str().c_str());
4691 std::copy(ptV,ptV+nbc,pt);
4695 throw INTERP_KERNEL::Exception(msg);
4700 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4705 for(int j=0;j<sz;j++)
4706 pt[slic.first+j*slic.second.second]=singleValV;
4711 if(sz!=(int)multiValV.size())
4713 std::ostringstream oss;
4714 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4715 throw INTERP_KERNEL::Exception(oss.str().c_str());
4717 for(int j=0;j<sz;j++)
4718 pt[slic.first+j*slic.second.second]=multiValV[j];
4723 const int *ptV=daIntTyyppV->getConstPointer();
4724 if(sz>daIntTyyppV->getNumberOfCompo())
4726 std::ostringstream oss;
4727 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4728 throw INTERP_KERNEL::Exception(oss.str().c_str());
4730 for(int j=0;j<sz;j++)
4731 pt[slic.first+j*slic.second.second]=ptV[j];
4735 throw INTERP_KERNEL::Exception(msg);
4739 throw INTERP_KERNEL::Exception(msg);
4745 class DataArrayChar : public DataArray
4748 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4749 int getHashCode() const throw(INTERP_KERNEL::Exception);
4750 bool empty() const throw(INTERP_KERNEL::Exception);
4751 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4752 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4753 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4754 char popBackSilent() throw(INTERP_KERNEL::Exception);
4755 void pack() const throw(INTERP_KERNEL::Exception);
4756 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4757 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4758 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4759 void reverse() throw(INTERP_KERNEL::Exception);
4760 void fillWithZero() throw(INTERP_KERNEL::Exception);
4761 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4762 std::string repr() const throw(INTERP_KERNEL::Exception);
4763 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4764 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4765 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4766 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4767 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4768 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4769 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4770 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4771 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4772 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4773 char front() const throw(INTERP_KERNEL::Exception);
4774 char back() const throw(INTERP_KERNEL::Exception);
4775 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4776 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4777 char *getPointer() throw(INTERP_KERNEL::Exception);
4778 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4779 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4780 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4781 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4782 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4783 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4784 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4785 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4786 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4787 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4788 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4791 int __len__() const throw(INTERP_KERNEL::Exception)
4793 if(self->isAllocated())
4795 return self->getNumberOfTuples();
4799 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4803 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4806 bool ret0=self->isEqualIfNotWhy(other,ret1);
4807 PyObject *ret=PyTuple_New(2);
4808 PyObject *ret0Py=ret0?Py_True:Py_False;
4810 PyTuple_SetItem(ret,0,ret0Py);
4811 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4815 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4818 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4819 if (!SWIG_IsOK(res1))
4822 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4823 if(size!=self->getNumberOfTuples())
4825 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4827 return self->renumber(tmp);
4831 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4833 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4834 da2->checkAllocated();
4835 int size=self->getNumberOfTuples();
4836 if(size!=self->getNumberOfTuples())
4838 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4840 return self->renumber(da2->getConstPointer());
4844 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4847 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4848 if (!SWIG_IsOK(res1))
4851 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4852 if(size!=self->getNumberOfTuples())
4854 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4856 return self->renumberR(tmp);
4860 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4862 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4863 da2->checkAllocated();
4864 int size=self->getNumberOfTuples();
4865 if(size!=self->getNumberOfTuples())
4867 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4869 return self->renumberR(da2->getConstPointer());
4873 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4876 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4877 if (!SWIG_IsOK(res1))
4880 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4881 if(size!=self->getNumberOfTuples())
4883 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4885 return self->renumberAndReduce(tmp,newNbOfTuple);
4889 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4891 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4892 da2->checkAllocated();
4893 int size=self->getNumberOfTuples();
4894 if(size!=self->getNumberOfTuples())
4896 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4898 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4902 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4904 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4905 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4906 return DataArrayChar::Aggregate(tmp);
4909 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4911 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4912 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4913 return DataArrayChar::Meld(tmp);
4918 class DataArrayByteIterator;
4920 class DataArrayByte : public DataArrayChar
4923 static DataArrayByte *New();
4924 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4925 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4926 char byteValue() const throw(INTERP_KERNEL::Exception);
4929 DataArrayByte() throw(INTERP_KERNEL::Exception)
4931 return DataArrayByte::New();
4934 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4936 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) !";
4937 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4941 if(PyInt_Check(nbOfTuples))
4943 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4945 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4948 if(PyInt_Check(nbOfComp))
4949 {//DataArrayByte.New([1,3,4,5],2,2)
4950 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4952 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4953 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4954 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4955 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4959 throw INTERP_KERNEL::Exception(msg);
4962 {//DataArrayByte.New([1,3,4],3)
4963 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4965 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4966 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4971 throw INTERP_KERNEL::Exception(msg);
4974 {// DataArrayByte.New([1,3,4])
4975 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4976 int tmpp1=-1,tmpp2=-1;
4977 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4978 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4982 else if(PyInt_Check(elt0))
4984 int nbOfTuples1=PyInt_AS_LONG(elt0);
4986 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4991 if(PyInt_Check(nbOfTuples))
4992 {//DataArrayByte.New(5,2)
4993 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4995 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4996 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4997 ret->alloc(nbOfTuples1,nbOfCompo);
5001 throw INTERP_KERNEL::Exception(msg);
5004 throw INTERP_KERNEL::Exception(msg);
5007 {//DataArrayByte.New(5)
5008 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5009 ret->alloc(nbOfTuples1,1);
5014 throw INTERP_KERNEL::Exception(msg);
5017 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5019 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5022 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5024 std::ostringstream oss;
5025 self->reprQuickOverview(oss);
5029 int __int__() const throw(INTERP_KERNEL::Exception)
5031 return (int) self->byteValue();
5034 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5036 return self->iterator();
5039 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5041 return (int)self->getIJ(tupleId,compoId);
5044 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5046 return (int)self->getIJSafe(tupleId,compoId);
5049 std::string __str__() const throw(INTERP_KERNEL::Exception)
5051 return self->repr();
5054 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5056 const char *vals=self->getConstPointer();
5057 int nbOfComp=self->getNumberOfComponents();
5058 int nbOfTuples=self->getNumberOfTuples();
5059 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5062 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5065 int ival=-1; std::vector<int> ivval;
5066 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5067 std::vector<char> vals(sz);
5068 std::copy(pt,pt+sz,vals.begin());
5069 return self->presenceOfTuple(vals);
5072 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5075 int ival=-1; std::vector<int> ivval;
5076 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5077 std::vector<char> vals2(sz);
5078 std::copy(pt,pt+sz,vals2.begin());
5079 return self->presenceOfValue(vals2);
5082 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5085 int ival=-1; std::vector<int> ivval;
5086 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5087 std::vector<char> vals2(sz);
5088 std::copy(pt,pt+sz,vals2.begin());
5089 return self->locateValue(vals2);
5092 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5095 int ival=-1; std::vector<int> ivval;
5096 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5097 std::vector<char> vals(sz);
5098 std::copy(pt,pt+sz,vals.begin());
5099 return self->locateTuple(vals);
5102 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5105 int ival=-1; std::vector<int> ivval;
5106 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5107 std::vector<char> vals(sz);
5108 std::copy(pt,pt+sz,vals.begin());
5109 return self->search(vals);
5112 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5114 int sz=self->getNumberOfComponents();
5115 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5116 self->getTuple(tupleId,tmp);
5117 PyObject *ret=PyTuple_New(sz);
5118 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5122 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5125 int r1=(int)self->getMaxValue(tmp);
5126 PyObject *ret=PyTuple_New(2);
5127 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5128 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5132 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5135 int r1=(int)self->getMinValue(tmp);
5136 PyObject *ret=PyTuple_New(2);
5137 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5138 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5142 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5144 int nbOfCompo=self->getNumberOfComponents();
5149 if(PyInt_Check(obj))
5151 int val=(int)PyInt_AS_LONG(obj);
5152 return self->locateValue(val);
5155 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5158 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5162 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5164 int nbOfCompo=self->getNumberOfComponents();
5171 if(PyInt_Check(obj))
5173 int val=(int)PyInt_AS_LONG(obj);
5174 return self->presenceOfValue(val);
5177 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5180 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5186 class DataArrayByteTuple;
5188 class DataArrayByteIterator
5191 DataArrayByteIterator(DataArrayByte *da);
5192 ~DataArrayByteIterator();
5195 class DataArrayByteTuple
5198 std::string repr() const throw(INTERP_KERNEL::Exception);
5199 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5202 std::string __str__() const throw(INTERP_KERNEL::Exception)
5204 return self->repr();
5207 char __int__() const throw(INTERP_KERNEL::Exception)
5209 return self->byteValue();
5212 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5214 return self->buildDAByte(1,self->getNumberOfCompo());
5219 class DataArrayAsciiCharIterator;
5221 class DataArrayAsciiChar : public DataArrayChar
5224 static DataArrayAsciiChar *New();
5225 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5226 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5227 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5230 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5232 return DataArrayAsciiChar::New();
5235 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5237 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) !";
5238 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5242 if(PyInt_Check(nbOfTuples))
5244 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5246 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5249 if(PyInt_Check(nbOfComp))
5250 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5251 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5253 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5254 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5255 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5256 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5260 throw INTERP_KERNEL::Exception(msg);
5263 {//DataArrayAsciiChar.New([1,3,4],3)
5264 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5266 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5267 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5271 else if(PyString_Check(nbOfTuples))
5273 if(PyString_Size(nbOfTuples)!=1)
5274 throw INTERP_KERNEL::Exception(msg);
5275 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5276 std::vector<std::string> tmp;
5277 if(fillStringVector(elt0,tmp))
5278 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5280 throw INTERP_KERNEL::Exception(msg);
5283 throw INTERP_KERNEL::Exception(msg);
5287 std::vector<std::string> tmmp;
5288 if(fillStringVector(elt0,tmmp))
5289 //DataArrayAsciiChar.New(["abc","de","fghi"])
5290 return DataArrayAsciiChar::New(tmmp,' ');
5293 // DataArrayAsciiChar.New([1,3,4])
5294 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5295 int tmpp1=-1,tmpp2=-1;
5296 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5297 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5302 else if(PyInt_Check(elt0))
5304 int nbOfTuples1=PyInt_AS_LONG(elt0);
5306 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5311 if(PyInt_Check(nbOfTuples))
5312 {//DataArrayAsciiChar.New(5,2)
5313 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5315 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5316 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5317 ret->alloc(nbOfTuples1,nbOfCompo);
5321 throw INTERP_KERNEL::Exception(msg);
5324 throw INTERP_KERNEL::Exception(msg);
5327 {//DataArrayAsciiChar.New(5)
5328 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5329 ret->alloc(nbOfTuples1,1);
5334 throw INTERP_KERNEL::Exception(msg);
5337 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5339 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5342 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5344 std::ostringstream oss;
5345 self->reprQuickOverview(oss);
5349 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5351 return self->iterator();
5354 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5356 char tmp[2]; tmp[1]='\0';
5357 tmp[0]=self->getIJ(tupleId,compoId);
5358 return std::string(tmp);
5361 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5363 char tmp[2]; tmp[1]='\0';
5364 tmp[0]=self->getIJSafe(tupleId,compoId);
5365 return std::string(tmp);
5368 std::string __str__() const throw(INTERP_KERNEL::Exception)
5370 return self->repr();
5373 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5375 const char *vals=self->getConstPointer();
5376 int nbOfComp=self->getNumberOfComponents();
5377 int nbOfTuples=self->getNumberOfTuples();
5378 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5381 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5383 if(PyString_Check(tupl))
5385 Py_ssize_t sz=PyString_Size(tupl);
5386 std::vector<char> vals(sz);
5387 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5388 return self->presenceOfTuple(vals);
5391 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5394 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5396 if(PyString_Check(vals))
5398 Py_ssize_t sz=PyString_Size(vals);
5399 std::vector<char> vals2(sz);
5400 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5401 return self->presenceOfValue(vals2);
5404 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5407 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5409 if(PyString_Check(vals))
5411 Py_ssize_t sz=PyString_Size(vals);
5412 std::vector<char> vals2(sz);
5413 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5414 return self->locateValue(vals2);
5417 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5420 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5422 if(PyString_Check(tupl))
5424 Py_ssize_t sz=PyString_Size(tupl);
5425 std::vector<char> vals(sz);
5426 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5427 return self->locateTuple(vals);
5430 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5433 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5435 if(PyString_Check(strOrListOfInt))
5437 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5438 std::vector<char> vals(sz);
5439 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5440 return self->search(vals);
5443 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5446 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5448 int sz=self->getNumberOfComponents();
5449 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5450 self->getTuple(tupleId,tmp);
5451 return PyString_FromString(tmp);
5454 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5457 char tmp2[2]; tmp2[1]='\0';
5458 tmp2[0]=self->getMaxValue(tmp);
5459 PyObject *ret=PyTuple_New(2);
5460 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5461 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5465 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5468 char tmp2[2]; tmp2[1]='\0';
5469 tmp2[0]=self->getMinValue(tmp);
5470 PyObject *ret=PyTuple_New(2);
5471 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5472 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5476 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5478 int nbOfCompo=self->getNumberOfComponents();
5483 if(PyString_Check(obj))
5485 Py_ssize_t sz=PyString_Size(obj);
5486 char *pt=PyString_AsString(obj);
5488 return self->locateValue(pt[0]);
5490 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5493 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5496 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5500 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5502 int nbOfCompo=self->getNumberOfComponents();
5509 if(PyString_Check(obj))
5511 Py_ssize_t sz=PyString_Size(obj);
5512 char *pt=PyString_AsString(obj);
5514 return self->presenceOfValue(pt[0]);
5516 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5519 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5522 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5526 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5529 std::vector<int> stdvecTyyppArr;
5530 std::pair<int, std::pair<int,int> > sTyyppArr;
5531 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5532 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5536 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5538 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5540 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5542 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5544 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5548 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5550 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.";
5552 std::vector<int> stdvecTyyppArr;
5553 std::pair<int, std::pair<int,int> > sTyyppArr;
5554 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5555 int nbOfCompo=self->getNumberOfComponents();
5556 int nbOfTuples=self->getNumberOfTuples();
5557 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5559 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5560 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5569 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5575 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5576 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5579 //value vector<string>
5582 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5583 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5586 //value DataArrayChar
5589 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5593 throw INTERP_KERNEL::Exception(msg);
5597 {//obj list-tuple[int]
5603 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5609 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5610 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5613 //value vector<string>
5616 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5617 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5620 //value DataArrayChar
5623 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5627 throw INTERP_KERNEL::Exception(msg);
5638 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5644 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5645 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5648 //value vector<string>
5651 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5652 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5655 //value DataArrayChar
5658 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5662 throw INTERP_KERNEL::Exception(msg);
5673 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5679 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5680 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5683 //value vector<string>
5686 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5687 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5690 //value DataArrayChar
5693 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5697 throw INTERP_KERNEL::Exception(msg);
5702 throw INTERP_KERNEL::Exception(msg);
5708 class DataArrayAsciiCharTuple;
5710 class DataArrayAsciiCharIterator
5713 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5714 ~DataArrayAsciiCharIterator();
5719 DataArrayAsciiCharTuple *ret=self->nextt();
5721 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5724 PyErr_SetString(PyExc_StopIteration,"No more data.");
5731 class DataArrayAsciiCharTuple
5734 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5735 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5738 std::string __str__() const throw(INTERP_KERNEL::Exception)
5740 return self->repr();
5743 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5745 return self->buildDAAsciiChar(1,self->getNumberOfCompo());