1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) ParaMEDMEM::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) ParaMEDMEM::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject ParaMEDMEM::DataArray::deepCpy;
46 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
47 %newobject ParaMEDMEM::DataArray::selectByTupleId;
48 %newobject ParaMEDMEM::DataArray::selectByTupleIdSafe;
49 %newobject ParaMEDMEM::DataArray::selectByTupleId2;
50 %newobject ParaMEDMEM::DataArray::Aggregate;
51 %newobject ParaMEDMEM::DataArrayInt::New;
52 %newobject ParaMEDMEM::DataArrayInt::__iter__;
53 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
54 %newobject ParaMEDMEM::DataArrayInt::performCpy;
55 %newobject ParaMEDMEM::DataArrayInt::substr;
56 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
57 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
58 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
59 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
60 %newobject ParaMEDMEM::DataArrayInt::renumber;
61 %newobject ParaMEDMEM::DataArrayInt::renumberR;
62 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
63 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
64 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
65 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
66 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
67 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
68 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
69 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
70 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualTuple;
71 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
72 %newobject ParaMEDMEM::DataArrayInt::negate;
73 %newobject ParaMEDMEM::DataArrayInt::computeAbs;
74 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
75 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
76 %newobject ParaMEDMEM::DataArrayInt::getIdsStrictlyNegative;
77 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
78 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
79 %newobject ParaMEDMEM::DataArrayInt::Meld;
80 %newobject ParaMEDMEM::DataArrayInt::Add;
81 %newobject ParaMEDMEM::DataArrayInt::Substract;
82 %newobject ParaMEDMEM::DataArrayInt::Multiply;
83 %newobject ParaMEDMEM::DataArrayInt::Divide;
84 %newobject ParaMEDMEM::DataArrayInt::Pow;
85 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
86 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
87 %newobject ParaMEDMEM::DataArrayInt::Range;
88 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
89 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
90 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
91 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
92 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
93 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
94 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
95 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
96 %newobject ParaMEDMEM::DataArrayInt::buildUniqueNotSorted;
97 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
98 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
99 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
100 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
101 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
102 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
103 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
104 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
105 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
106 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
107 %newobject ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation;
108 %newobject ParaMEDMEM::DataArrayInt::__neg__;
109 %newobject ParaMEDMEM::DataArrayInt::__add__;
110 %newobject ParaMEDMEM::DataArrayInt::__radd__;
111 %newobject ParaMEDMEM::DataArrayInt::__sub__;
112 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
113 %newobject ParaMEDMEM::DataArrayInt::__mul__;
114 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
115 %newobject ParaMEDMEM::DataArrayInt::__div__;
116 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
117 %newobject ParaMEDMEM::DataArrayInt::__mod__;
118 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
119 %newobject ParaMEDMEM::DataArrayInt::__pow__;
120 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
121 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
122 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
123 %newobject ParaMEDMEM::DataArrayChar::renumber;
124 %newobject ParaMEDMEM::DataArrayChar::renumberR;
125 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
126 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
127 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
128 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
129 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
130 %newobject ParaMEDMEM::DataArrayChar::Meld;
131 %newobject ParaMEDMEM::DataArrayByte::New;
132 %newobject ParaMEDMEM::DataArrayByte::__iter__;
133 %newobject ParaMEDMEM::DataArrayByte::performCpy;
134 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
135 %newobject ParaMEDMEM::DataArrayChar::substr;
136 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
137 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
138 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
139 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
140 %newobject ParaMEDMEM::DataArrayDouble::New;
141 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
142 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
143 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
144 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
145 %newobject ParaMEDMEM::DataArrayDouble::Meld;
146 %newobject ParaMEDMEM::DataArrayDouble::Dot;
147 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
148 %newobject ParaMEDMEM::DataArrayDouble::Add;
149 %newobject ParaMEDMEM::DataArrayDouble::Substract;
150 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
151 %newobject ParaMEDMEM::DataArrayDouble::Divide;
152 %newobject ParaMEDMEM::DataArrayDouble::Pow;
153 %newobject ParaMEDMEM::DataArrayDouble::substr;
154 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
155 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
156 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
157 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
158 %newobject ParaMEDMEM::DataArrayDouble::negate;
159 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
160 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
161 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
162 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
163 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
164 %newobject ParaMEDMEM::DataArrayDouble::determinant;
165 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
166 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
167 %newobject ParaMEDMEM::DataArrayDouble::inverse;
168 %newobject ParaMEDMEM::DataArrayDouble::trace;
169 %newobject ParaMEDMEM::DataArrayDouble::deviator;
170 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
171 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
172 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
173 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
174 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
175 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
176 %newobject ParaMEDMEM::DataArrayDouble::renumber;
177 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
178 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
179 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
180 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
181 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
182 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
183 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
184 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
185 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
186 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
187 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
188 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
189 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
190 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
191 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
192 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
193 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
194 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
195 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
197 %feature("unref") DataArray "$this->decrRef();"
198 %feature("unref") DataArrayDouble "$this->decrRef();"
199 %feature("unref") DataArrayInt "$this->decrRef();"
200 %feature("unref") DataArrayChar "$this->decrRef();"
201 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
202 %feature("unref") DataArrayByte "$this->decrRef();"
206 class DataArray : public RefCountObject, public TimeLabel
209 void setName(const std::string& name);
210 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
211 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
212 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
213 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
214 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
215 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
216 std::string getName() const;
217 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
218 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
219 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
220 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
221 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
222 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
223 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
224 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
225 int getNumberOfComponents() const;
226 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
227 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
228 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
229 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
230 virtual void desallocate() throw(INTERP_KERNEL::Exception);
231 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
232 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
233 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
234 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
235 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
236 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
237 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
238 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
239 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
240 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
241 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
242 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
243 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
244 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
245 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
246 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
247 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
248 void updateTime() const;
251 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
253 const std::vector<std::string>& comps=self->getInfoOnComponents();
254 PyObject *ret=PyList_New((int)comps.size());
255 for(int i=0;i<(int)comps.size();i++)
256 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
260 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
262 std::vector<int> tmp;
263 convertPyToNewIntArr3(li,tmp);
264 self->copyPartOfStringInfoFrom(other,tmp);
267 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
269 std::vector<int> tmp;
270 convertPyToNewIntArr3(li,tmp);
271 self->copyPartOfStringInfoFrom2(tmp,other);
274 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
277 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
278 if (!SWIG_IsOK(res1))
281 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
282 if(size!=self->getNumberOfTuples())
284 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
286 self->renumberInPlace(tmp);
290 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
292 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
293 da2->checkAllocated();
294 int size=self->getNumberOfTuples();
295 if(size!=self->getNumberOfTuples())
297 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
299 self->renumberInPlace(da2->getConstPointer());
303 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
306 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
307 if (!SWIG_IsOK(res1))
310 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
311 if(size!=self->getNumberOfTuples())
313 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
315 self->renumberInPlaceR(tmp);
319 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
321 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
322 da2->checkAllocated();
323 int size=self->getNumberOfTuples();
324 if(size!=self->getNumberOfTuples())
326 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
328 self->renumberInPlaceR(da2->getConstPointer());
332 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
333 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
335 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
336 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
337 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
338 DataArrayInt *tuplesSelecPtr2=0;
341 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
343 throw INTERP_KERNEL::Exception(msg);
345 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
348 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
350 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
351 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
354 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
356 std::vector<std::pair<int,int> > ranges;
357 convertPyToVectorPairInt(li,ranges);
358 return self->selectByTupleRanges(ranges);
361 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
364 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
365 if (!SWIG_IsOK(res1))
368 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
369 return self->selectByTupleId(tmp,tmp+size);
373 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
375 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
376 da2->checkAllocated();
377 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
381 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
384 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
385 if (!SWIG_IsOK(res1))
388 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
389 return self->selectByTupleIdSafe(tmp,tmp+size);
393 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
395 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
396 da2->checkAllocated();
397 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
401 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
403 std::vector<int> tmp;
404 convertPyToNewIntArr3(li,tmp);
405 DataArray *ret=self->keepSelectedComponents(tmp);
406 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
409 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
411 if(!PySlice_Check(slic))
412 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
413 Py_ssize_t strt=2,stp=2,step=2;
414 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
415 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
417 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
418 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
421 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
423 if(!PySlice_Check(slic))
424 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
425 Py_ssize_t strt=2,stp=2,step=2;
426 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
427 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"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 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
440 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
443 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
445 if(!PySlice_Check(slic))
446 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
447 Py_ssize_t strt=2,stp=2,step=2;
448 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
449 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
450 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
453 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
455 std::vector<const DataArray *> tmp;
456 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
457 return DataArray::Aggregate(tmp);
460 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
462 if(!PySlice_Check(slic))
463 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
464 Py_ssize_t strt=2,stp=2,step=2;
465 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
466 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
467 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
470 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
472 if(!PySlice_Check(slic))
473 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
474 Py_ssize_t strt=2,stp=2,step=2;
475 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
476 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
477 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
480 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
482 PyObject *ret(PyTuple_New(2));
483 std::string a0(self->getName());
484 const std::vector<std::string> &a1(self->getInfoOnComponents());
485 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
488 PyObject *ret1(PyList_New(sz));
489 for(int i=0;i<sz;i++)
490 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
491 PyTuple_SetItem(ret,1,ret1);
496 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
498 static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
499 if(!PyTuple_Check(inp))
500 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
501 int sz(PyTuple_Size(inp));
503 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
504 PyObject *a0(PyTuple_GetItem(inp,0));
505 if(!PyString_Check(a0))
506 throw INTERP_KERNEL::Exception(MSG);
507 PyObject *a1(PyTuple_GetItem(inp,1));
508 std::vector<std::string> a1cpp;
509 if(!fillStringVector(a1,a1cpp))
510 throw INTERP_KERNEL::Exception(MSG);
511 self->setName(PyString_AsString(a0));
512 self->setInfoOnComponents(a1cpp);
518 class DataArrayDoubleIterator;
520 class DataArrayDouble : public DataArray
523 static DataArrayDouble *New();
524 double doubleValue() const throw(INTERP_KERNEL::Exception);
525 bool empty() const throw(INTERP_KERNEL::Exception);
526 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
527 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
528 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
529 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
530 double popBackSilent() throw(INTERP_KERNEL::Exception);
531 void pack() const throw(INTERP_KERNEL::Exception);
532 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
533 void fillWithZero() throw(INTERP_KERNEL::Exception);
534 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
535 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
536 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
537 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
538 void reverse() throw(INTERP_KERNEL::Exception);
539 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
540 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
541 std::string repr() const throw(INTERP_KERNEL::Exception);
542 std::string reprZip() const throw(INTERP_KERNEL::Exception);
543 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
544 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
545 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
546 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
550 void transpose() throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
552 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
555 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
556 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
557 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
558 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
559 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
560 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
561 double front() const throw(INTERP_KERNEL::Exception);
562 double back() const throw(INTERP_KERNEL::Exception);
563 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
564 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
565 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
566 double *getPointer() throw(INTERP_KERNEL::Exception);
567 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
569 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
570 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
571 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
572 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
573 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
574 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
575 double getAverageValue() const throw(INTERP_KERNEL::Exception);
576 double norm2() const throw(INTERP_KERNEL::Exception);
577 double normMax() const throw(INTERP_KERNEL::Exception);
578 double normMin() const throw(INTERP_KERNEL::Exception);
579 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
580 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
581 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
582 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
583 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
584 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
585 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
586 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
587 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
588 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
590 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
591 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
595 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
596 void abs() throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
598 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
599 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
600 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
601 void applyPow(double val) throw(INTERP_KERNEL::Exception);
602 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
607 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
609 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
610 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
611 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
612 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
613 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
614 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
615 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
616 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
617 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
618 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
619 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
620 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
621 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
622 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
623 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
624 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
625 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
626 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
627 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
632 DataArrayDouble() throw(INTERP_KERNEL::Exception)
634 return DataArrayDouble::New();
637 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
639 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)";
640 std::string msg(msgBase);
642 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
645 if(PyList_Check(elt0) || PyTuple_Check(elt0))
649 if(PyInt_Check(nbOfTuples))
651 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
653 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
656 if(PyInt_Check(elt2))
657 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
658 int nbOfCompo=PyInt_AS_LONG(elt2);
660 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
661 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
662 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
663 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
667 throw INTERP_KERNEL::Exception(msg.c_str());
670 {//DataArrayDouble.New([1.,3.,4.],3)
671 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
673 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
674 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
679 throw INTERP_KERNEL::Exception(msg.c_str());
682 {// DataArrayDouble.New([1.,3.,4.])
683 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
684 int tmpp1=-1,tmpp2=-1;
685 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
686 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
690 else if(PyInt_Check(elt0))
692 int nbOfTuples1=PyInt_AS_LONG(elt0);
694 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
699 if(PyInt_Check(nbOfTuples))
700 {//DataArrayDouble.New(5,2)
701 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
703 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
704 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
705 ret->alloc(nbOfTuples1,nbOfCompo);
709 throw INTERP_KERNEL::Exception(msg.c_str());
712 throw INTERP_KERNEL::Exception(msg.c_str());
715 {//DataArrayDouble.New(5)
716 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
717 ret->alloc(nbOfTuples1,1);
722 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
723 {//DataArrayDouble.New(numpyArray)
724 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
728 throw INTERP_KERNEL::Exception(msg.c_str());
729 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
732 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
734 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
737 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
740 std::vector<double> bb;
742 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
743 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
744 self->pushBackValsSilent(tmp,tmp+nbTuples);
747 std::string __repr__() const throw(INTERP_KERNEL::Exception)
749 std::ostringstream oss;
750 self->reprQuickOverview(oss);
754 std::string __str__() const throw(INTERP_KERNEL::Exception)
756 return self->reprNotTooLong();
759 double __float__() const throw(INTERP_KERNEL::Exception)
761 return self->doubleValue();
764 int __len__() const throw(INTERP_KERNEL::Exception)
766 if(self->isAllocated())
768 return self->getNumberOfTuples();
772 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
776 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
778 return self->iterator();
781 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
783 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 !";
784 if(PyList_Check(li) || PyTuple_Check(li))
788 if(PyInt_Check(nbOfTuples))
790 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
792 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
795 if(PyInt_Check(nbOfComp))
796 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
797 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
799 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
800 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
801 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
804 throw INTERP_KERNEL::Exception(msg);
807 {//DataArrayDouble.setValues([1.,3.,4.],3)
809 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
810 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
814 throw INTERP_KERNEL::Exception(msg);
817 {// DataArrayDouble.setValues([1.,3.,4.])
818 int tmpp1=-1,tmpp2=-1;
819 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
820 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
824 throw INTERP_KERNEL::Exception(msg);
827 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
829 const double *vals=self->getConstPointer();
830 return convertDblArrToPyList(vals,self->getNbOfElems());
834 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
836 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
840 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
843 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
844 PyObject *ret=PyTuple_New(2);
845 PyObject *ret0Py=ret0?Py_True:Py_False;
847 PyTuple_SetItem(ret,0,ret0Py);
848 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
852 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
854 const double *vals=self->getConstPointer();
855 int nbOfComp=self->getNumberOfComponents();
856 int nbOfTuples=self->getNumberOfTuples();
857 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
860 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
863 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
864 if (!SWIG_IsOK(res1))
867 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
868 if(size!=self->getNumberOfTuples())
870 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
872 return self->renumber(tmp);
876 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
878 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
879 da2->checkAllocated();
880 int size=self->getNumberOfTuples();
881 if(size!=self->getNumberOfTuples())
883 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
885 return self->renumber(da2->getConstPointer());
889 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
892 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
893 if (!SWIG_IsOK(res1))
896 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
897 if(size!=self->getNumberOfTuples())
899 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
901 return self->renumberR(tmp);
905 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
907 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
908 da2->checkAllocated();
909 int size=self->getNumberOfTuples();
910 if(size!=self->getNumberOfTuples())
912 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
914 return self->renumberR(da2->getConstPointer());
918 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
921 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
922 if (!SWIG_IsOK(res1))
925 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
926 if(size!=self->getNumberOfTuples())
928 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
930 return self->renumberAndReduce(tmp,newNbOfTuple);
934 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
936 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
937 da2->checkAllocated();
938 int size=self->getNumberOfTuples();
939 if(size!=self->getNumberOfTuples())
941 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
943 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
947 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
949 int thisTupleId,otherTupleId;
950 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
951 PyObject *ret=PyTuple_New(3);
952 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
953 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
954 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
958 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
961 double r1=self->getMaxValue(tmp);
962 PyObject *ret=PyTuple_New(2);
963 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
964 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
968 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
971 double r1=self->getMaxValue2(tmp);
972 PyObject *ret=PyTuple_New(2);
973 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
974 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
978 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
981 double r1=self->getMinValue(tmp);
982 PyObject *ret=PyTuple_New(2);
983 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
984 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
988 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
991 double r1=self->getMinValue2(tmp);
992 PyObject *ret=PyTuple_New(2);
993 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
994 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
998 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1000 int nbOfCompo=self->getNumberOfComponents();
1001 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1002 self->getMinMaxPerComponent(tmp);
1003 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1007 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1009 int sz=self->getNumberOfComponents();
1010 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1011 self->accumulate(tmp);
1012 return convertDblArrToPyList(tmp,sz);
1015 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1018 std::vector<int> val2;
1019 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1020 return self->accumulatePerChunck(bg,bg+sz);
1023 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1025 DataArrayInt *comm, *commIndex;
1026 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1027 PyObject *res = PyList_New(2);
1028 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1029 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1033 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1037 DataArrayDoubleTuple *aa;
1038 std::vector<double> bb;
1040 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1041 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1043 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1044 PyObject *ret=PyTuple_New(2);
1045 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1046 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1050 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1052 std::vector<int> tmp;
1053 convertPyToNewIntArr3(li,tmp);
1054 self->setSelectedComponents(a,tmp);
1057 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1059 int sz=self->getNumberOfComponents();
1060 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1061 self->getTuple(tupleId,tmp);
1062 return convertDblArrToPyList(tmp,sz);
1065 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1067 std::vector<const DataArrayDouble *> tmp;
1068 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1069 return DataArrayDouble::Aggregate(tmp);
1072 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1074 std::vector<const DataArrayDouble *> tmp;
1075 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1076 return DataArrayDouble::Meld(tmp);
1079 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1083 DataArrayDoubleTuple *aa;
1084 std::vector<double> bb;
1086 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1087 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1088 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1090 DataArrayInt *c=0,*cI=0;
1091 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1092 PyObject *ret=PyTuple_New(2);
1093 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1094 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1098 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1100 DataArrayInt *ret1=0;
1101 bool ret0=self->areIncludedInMe(other,prec,ret1);
1102 PyObject *ret=PyTuple_New(2);
1103 PyObject *ret0Py=ret0?Py_True:Py_False;
1105 PyTuple_SetItem(ret,0,ret0Py);
1106 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1110 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1112 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1113 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1114 self->checkAllocated();
1115 int nbOfTuples=self->getNumberOfTuples();
1116 int nbOfComponents=self->getNumberOfComponents();
1118 std::vector<int> vt1,vc1;
1119 std::pair<int, std::pair<int,int> > pt1,pc1;
1120 DataArrayInt *dt1=0,*dc1=0;
1122 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1123 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1127 if(nbOfComponents==1)
1128 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1129 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1131 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1133 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1135 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1137 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1140 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1141 std::vector<int> v2(1,ic1);
1142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1146 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1147 std::vector<int> v2(1,ic1);
1148 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1152 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1153 std::vector<int> v2(1,ic1);
1154 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1158 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1159 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1163 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1164 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1168 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1169 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1173 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1174 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1178 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1179 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1180 std::vector<int> v2(nbOfComp);
1181 for(int i=0;i<nbOfComp;i++)
1182 v2[i]=pc1.first+i*pc1.second.second;
1183 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1187 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1188 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1189 std::vector<int> v2(nbOfComp);
1190 for(int i=0;i<nbOfComp;i++)
1191 v2[i]=pc1.first+i*pc1.second.second;
1192 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1196 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1197 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1198 std::vector<int> v2(nbOfComp);
1199 for(int i=0;i<nbOfComp;i++)
1200 v2[i]=pc1.first+i*pc1.second.second;
1201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1205 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1206 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1207 std::vector<int> v2(nbOfComp);
1208 for(int i=0;i<nbOfComp;i++)
1209 v2[i]=pc1.first+i*pc1.second.second;
1210 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1213 throw INTERP_KERNEL::Exception(msg);
1217 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1219 self->checkAllocated();
1220 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1221 int nbOfTuples=self->getNumberOfTuples();
1222 int nbOfComponents=self->getNumberOfComponents();
1225 std::vector<double> v1;
1226 DataArrayDouble *d1=0;
1227 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1229 std::vector<int> vt1,vc1;
1230 std::pair<int, std::pair<int,int> > pt1,pc1;
1231 DataArrayInt *dt1=0,*dc1=0;
1232 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1233 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1241 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1244 tmp=DataArrayDouble::New();
1245 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1246 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1249 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1252 throw INTERP_KERNEL::Exception(msg);
1261 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1264 tmp=DataArrayDouble::New();
1265 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1266 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1269 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1272 throw INTERP_KERNEL::Exception(msg);
1281 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1284 tmp=DataArrayDouble::New();
1285 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1286 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1289 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1292 throw INTERP_KERNEL::Exception(msg);
1301 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1304 tmp=DataArrayDouble::New();
1305 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1306 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1309 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1312 throw INTERP_KERNEL::Exception(msg);
1321 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1324 tmp=DataArrayDouble::New();
1325 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1326 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1329 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1332 throw INTERP_KERNEL::Exception(msg);
1341 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1344 tmp=DataArrayDouble::New();
1345 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1346 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1349 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1352 throw INTERP_KERNEL::Exception(msg);
1361 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1364 tmp=DataArrayDouble::New();
1365 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1366 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1369 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1372 throw INTERP_KERNEL::Exception(msg);
1381 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1384 tmp=DataArrayDouble::New();
1385 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1386 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1389 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1392 throw INTERP_KERNEL::Exception(msg);
1401 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1404 tmp=DataArrayDouble::New();
1405 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1406 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1409 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1412 throw INTERP_KERNEL::Exception(msg);
1421 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1424 tmp=DataArrayDouble::New();
1425 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1426 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1429 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1432 throw INTERP_KERNEL::Exception(msg);
1441 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1444 tmp=DataArrayDouble::New();
1445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1446 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1449 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1452 throw INTERP_KERNEL::Exception(msg);
1461 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1464 tmp=DataArrayDouble::New();
1465 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1466 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1469 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1472 throw INTERP_KERNEL::Exception(msg);
1481 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1484 tmp=DataArrayDouble::New();
1485 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1486 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1489 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1492 throw INTERP_KERNEL::Exception(msg);
1501 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1504 tmp=DataArrayDouble::New();
1505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1506 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1509 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1512 throw INTERP_KERNEL::Exception(msg);
1521 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1524 tmp=DataArrayDouble::New();
1525 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1526 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1529 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1532 throw INTERP_KERNEL::Exception(msg);
1541 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1544 tmp=DataArrayDouble::New();
1545 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1546 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1549 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1552 throw INTERP_KERNEL::Exception(msg);
1557 throw INTERP_KERNEL::Exception(msg);
1562 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1564 return self->negate();
1567 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1569 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1572 DataArrayDoubleTuple *aa;
1573 std::vector<double> bb;
1576 #ifndef WITHOUT_AUTOFIELD
1578 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1580 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1583 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1584 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1586 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1589 throw INTERP_KERNEL::Exception(msg);
1593 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1598 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1599 ret->applyLin(1.,val);
1600 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1604 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1608 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1609 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1613 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1614 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1617 throw INTERP_KERNEL::Exception(msg);
1621 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1623 const char msg[]="Unexpected situation in __radd__ !";
1626 DataArrayDoubleTuple *aa;
1627 std::vector<double> bb;
1629 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1634 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1635 ret->applyLin(1.,val);
1640 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1641 return DataArrayDouble::Add(self,aaa);
1645 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1646 return DataArrayDouble::Add(self,aaa);
1649 throw INTERP_KERNEL::Exception(msg);
1653 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1655 const char msg[]="Unexpected situation in __iadd__ !";
1658 DataArrayDoubleTuple *aa;
1659 std::vector<double> bb;
1661 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1666 self->applyLin(1.,val);
1667 Py_XINCREF(trueSelf);
1673 Py_XINCREF(trueSelf);
1678 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1679 self->addEqual(aaa);
1680 Py_XINCREF(trueSelf);
1685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1686 self->addEqual(aaa);
1687 Py_XINCREF(trueSelf);
1691 throw INTERP_KERNEL::Exception(msg);
1695 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1697 const char msg[]="Unexpected situation in __sub__ !";
1700 DataArrayDoubleTuple *aa;
1701 std::vector<double> bb;
1704 #ifndef WITHOUT_AUTOFIELD
1706 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1708 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1711 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1712 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1714 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1717 throw INTERP_KERNEL::Exception(msg);
1721 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1726 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1727 ret->applyLin(1.,-val);
1728 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1732 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1736 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1737 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1741 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1745 throw INTERP_KERNEL::Exception(msg);
1749 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1751 const char msg[]="Unexpected situation in __rsub__ !";
1754 DataArrayDoubleTuple *aa;
1755 std::vector<double> bb;
1757 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1762 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1763 ret->applyLin(-1.,val);
1768 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1769 return DataArrayDouble::Substract(aaa,self);
1773 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1774 return DataArrayDouble::Substract(aaa,self);
1777 throw INTERP_KERNEL::Exception(msg);
1781 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1783 const char msg[]="Unexpected situation in __isub__ !";
1786 DataArrayDoubleTuple *aa;
1787 std::vector<double> bb;
1789 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1794 self->applyLin(1,-val);
1795 Py_XINCREF(trueSelf);
1800 self->substractEqual(a);
1801 Py_XINCREF(trueSelf);
1806 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1807 self->substractEqual(aaa);
1808 Py_XINCREF(trueSelf);
1813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1814 self->substractEqual(aaa);
1815 Py_XINCREF(trueSelf);
1819 throw INTERP_KERNEL::Exception(msg);
1823 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1825 const char msg[]="Unexpected situation in __mul__ !";
1828 DataArrayDoubleTuple *aa;
1829 std::vector<double> bb;
1832 #ifndef WITHOUT_AUTOFIELD
1834 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1836 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1839 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1840 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1842 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1845 throw INTERP_KERNEL::Exception(msg);
1849 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1855 ret->applyLin(val,0.);
1856 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1860 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1864 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1865 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1869 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1870 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1873 throw INTERP_KERNEL::Exception(msg);
1877 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1879 const char msg[]="Unexpected situation in __rmul__ !";
1882 DataArrayDoubleTuple *aa;
1883 std::vector<double> bb;
1885 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1890 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1891 ret->applyLin(val,0.);
1896 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1897 return DataArrayDouble::Multiply(self,aaa);
1901 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1902 return DataArrayDouble::Multiply(self,aaa);
1905 throw INTERP_KERNEL::Exception(msg);
1909 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1911 const char msg[]="Unexpected situation in __imul__ !";
1914 DataArrayDoubleTuple *aa;
1915 std::vector<double> bb;
1917 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1922 self->applyLin(val,0.);
1923 Py_XINCREF(trueSelf);
1928 self->multiplyEqual(a);
1929 Py_XINCREF(trueSelf);
1934 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1935 self->multiplyEqual(aaa);
1936 Py_XINCREF(trueSelf);
1941 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1942 self->multiplyEqual(aaa);
1943 Py_XINCREF(trueSelf);
1947 throw INTERP_KERNEL::Exception(msg);
1951 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1953 const char msg[]="Unexpected situation in __div__ !";
1956 DataArrayDoubleTuple *aa;
1957 std::vector<double> bb;
1960 #ifndef WITHOUT_AUTOFIELD
1962 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1964 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1967 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1968 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1970 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1973 throw INTERP_KERNEL::Exception(msg);
1977 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1983 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1984 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1985 ret->applyLin(1/val,0.);
1986 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1990 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1994 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1995 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1999 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2000 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2003 throw INTERP_KERNEL::Exception(msg);
2007 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2009 const char msg[]="Unexpected situation in __rdiv__ !";
2012 DataArrayDoubleTuple *aa;
2013 std::vector<double> bb;
2015 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2020 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2026 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2027 return DataArrayDouble::Divide(aaa,self);
2031 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2032 return DataArrayDouble::Divide(aaa,self);
2035 throw INTERP_KERNEL::Exception(msg);
2039 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2041 const char msg[]="Unexpected situation in __idiv__ !";
2044 DataArrayDoubleTuple *aa;
2045 std::vector<double> bb;
2047 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2053 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2054 self->applyLin(1./val,0.);
2055 Py_XINCREF(trueSelf);
2060 self->divideEqual(a);
2061 Py_XINCREF(trueSelf);
2066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2067 self->divideEqual(aaa);
2068 Py_XINCREF(trueSelf);
2073 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2074 self->divideEqual(aaa);
2075 Py_XINCREF(trueSelf);
2079 throw INTERP_KERNEL::Exception(msg);
2083 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2085 const char msg[]="Unexpected situation in __pow__ !";
2088 DataArrayDoubleTuple *aa;
2089 std::vector<double> bb;
2091 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2096 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2102 return DataArrayDouble::Pow(self,a);
2106 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2107 return DataArrayDouble::Pow(self,aaa);
2111 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2112 return DataArrayDouble::Pow(self,aaa);
2115 throw INTERP_KERNEL::Exception(msg);
2119 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2121 const char msg[]="Unexpected situation in __rpow__ !";
2124 DataArrayDoubleTuple *aa;
2125 std::vector<double> bb;
2127 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2132 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2133 ret->applyRPow(val);
2138 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2139 return DataArrayDouble::Pow(aaa,self);
2143 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2144 return DataArrayDouble::Pow(aaa,self);
2147 throw INTERP_KERNEL::Exception(msg);
2151 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2153 const char msg[]="Unexpected situation in __ipow__ !";
2156 DataArrayDoubleTuple *aa;
2157 std::vector<double> bb;
2159 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2164 self->applyPow(val);
2165 Py_XINCREF(trueSelf);
2171 Py_XINCREF(trueSelf);
2176 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2177 self->powEqual(aaa);
2178 Py_XINCREF(trueSelf);
2183 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2184 self->powEqual(aaa);
2185 Py_XINCREF(trueSelf);
2189 throw INTERP_KERNEL::Exception(msg);
2193 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2195 DataArrayInt *c=0,*cI=0;
2197 self->computeTupleIdsNearTuples(other,eps,c,cI);
2198 PyObject *ret=PyTuple_New(2);
2199 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2200 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2204 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2206 DataArrayInt *ret1=0;
2207 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2208 PyObject *ret=PyTuple_New(2);
2209 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2210 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2215 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2217 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2218 if(!PyTuple_Check(args))
2219 throw INTERP_KERNEL::Exception(MSG);
2220 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2221 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2222 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2224 PyObject *tmp0(PyTuple_New(1));
2225 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2226 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2228 Py_DECREF(selfMeth);
2229 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2230 int sz(PyTuple_Size(args));
2232 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2233 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2234 PyObject *zeNumpyRepr(0);
2235 PyObject *tmp1(PyInt_FromLong(0));
2236 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2238 PyObject *tmp3(PyTuple_New(1));
2239 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2240 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2244 Py_DECREF(initMeth);
2248 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2251 if(!self->isAllocated())
2252 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2253 PyObject *ret(PyTuple_New(1));
2254 PyObject *ret0(PyDict_New());
2255 PyObject *numpyArryObj(ParaMEDMEM_DataArrayDouble_toNumPyArray(self));
2256 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2257 PyObject *tmp1(PyInt_FromLong(0));
2258 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2259 PyTuple_SetItem(ret,0,ret0);
2263 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2269 class DataArrayDoubleTuple;
2271 class DataArrayDoubleIterator
2274 DataArrayDoubleIterator(DataArrayDouble *da);
2275 ~DataArrayDoubleIterator();
2280 DataArrayDoubleTuple *ret=self->nextt();
2282 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2285 PyErr_SetString(PyExc_StopIteration,"No more data.");
2292 class DataArrayDoubleTuple
2295 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2296 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2299 std::string __str__() const throw(INTERP_KERNEL::Exception)
2301 return self->repr();
2304 double __float__() const throw(INTERP_KERNEL::Exception)
2306 return self->doubleValue();
2309 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2311 return self->buildDADouble(1,self->getNumberOfCompo());
2314 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2316 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2317 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2318 Py_XINCREF(trueSelf);
2322 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2324 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2325 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2326 Py_XINCREF(trueSelf);
2330 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2332 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2333 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2334 Py_XINCREF(trueSelf);
2338 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2340 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2341 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2342 Py_XINCREF(trueSelf);
2346 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2348 return PyInt_FromLong(self->getNumberOfCompo());
2351 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2353 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2356 std::vector<int> multiVal;
2357 std::pair<int, std::pair<int,int> > slic;
2358 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2359 const double *pt=self->getConstPointer();
2360 int nbc=self->getNumberOfCompo();
2361 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2368 std::ostringstream oss;
2369 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2370 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2374 return PyFloat_FromDouble(pt[singleVal]);
2378 return PyFloat_FromDouble(pt[nbc+singleVal]);
2381 std::ostringstream oss;
2382 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2383 throw INTERP_KERNEL::Exception(oss.str().c_str());
2389 PyObject *t=PyTuple_New(multiVal.size());
2390 for(int j=0;j<(int)multiVal.size();j++)
2392 int cid=multiVal[j];
2395 std::ostringstream oss;
2396 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2397 throw INTERP_KERNEL::Exception(oss.str().c_str());
2399 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2405 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2406 PyObject *t=PyTuple_New(sz);
2407 for(int j=0;j<sz;j++)
2408 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2412 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2416 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2418 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2419 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2422 std::vector<double> multiValV;
2423 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2424 int nbc=self->getNumberOfCompo();
2425 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2427 std::vector<int> multiVal;
2428 std::pair<int, std::pair<int,int> > slic;
2429 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2430 double *pt=self->getPointer();
2431 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2438 std::ostringstream oss;
2439 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2440 throw INTERP_KERNEL::Exception(oss.str().c_str());
2446 pt[singleVal]=singleValV;
2451 if(multiValV.size()!=1)
2453 std::ostringstream oss;
2454 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2455 throw INTERP_KERNEL::Exception(oss.str().c_str());
2457 pt[singleVal]=multiValV[0];
2462 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2466 throw INTERP_KERNEL::Exception(msg);
2475 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2479 std::ostringstream oss;
2480 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2481 throw INTERP_KERNEL::Exception(oss.str().c_str());
2489 if(multiVal.size()!=multiValV.size())
2491 std::ostringstream oss;
2492 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2493 throw INTERP_KERNEL::Exception(oss.str().c_str());
2495 for(int i=0;i<(int)multiVal.size();i++)
2497 int pos=multiVal[i];
2500 std::ostringstream oss;
2501 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2502 throw INTERP_KERNEL::Exception(oss.str().c_str());
2504 pt[multiVal[i]]=multiValV[i];
2510 const double *ptV=daIntTyyppV->getConstPointer();
2511 if(nbc>daIntTyyppV->getNumberOfCompo())
2513 std::ostringstream oss;
2514 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2515 throw INTERP_KERNEL::Exception(oss.str().c_str());
2517 std::copy(ptV,ptV+nbc,pt);
2521 throw INTERP_KERNEL::Exception(msg);
2526 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2531 for(int j=0;j<sz;j++)
2532 pt[slic.first+j*slic.second.second]=singleValV;
2537 if(sz!=(int)multiValV.size())
2539 std::ostringstream oss;
2540 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2541 throw INTERP_KERNEL::Exception(oss.str().c_str());
2543 for(int j=0;j<sz;j++)
2544 pt[slic.first+j*slic.second.second]=multiValV[j];
2549 const double *ptV=daIntTyyppV->getConstPointer();
2550 if(sz>daIntTyyppV->getNumberOfCompo())
2552 std::ostringstream oss;
2553 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2554 throw INTERP_KERNEL::Exception(oss.str().c_str());
2556 for(int j=0;j<sz;j++)
2557 pt[slic.first+j*slic.second.second]=ptV[j];
2561 throw INTERP_KERNEL::Exception(msg);
2565 throw INTERP_KERNEL::Exception(msg);
2571 class DataArrayIntIterator;
2573 class DataArrayInt : public DataArray
2576 static DataArrayInt *New();
2577 int intValue() const throw(INTERP_KERNEL::Exception);
2578 int getHashCode() const throw(INTERP_KERNEL::Exception);
2579 bool empty() const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2581 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2582 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2583 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2584 int popBackSilent() throw(INTERP_KERNEL::Exception);
2585 void pack() const throw(INTERP_KERNEL::Exception);
2586 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2587 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2588 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2589 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2591 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2592 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2593 void reverse() throw(INTERP_KERNEL::Exception);
2594 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2595 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2596 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2597 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2598 void fillWithZero() throw(INTERP_KERNEL::Exception);
2599 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2600 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2601 void replaceOneValByInThis(int valToBeReplaced, int replacedBy) throw(INTERP_KERNEL::Exception);
2602 std::string repr() const throw(INTERP_KERNEL::Exception);
2603 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2604 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2605 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2606 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2607 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2608 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2609 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2610 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2611 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2612 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2613 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2614 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2615 bool isIdentity2(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2616 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2617 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2618 void transpose() throw(INTERP_KERNEL::Exception);
2619 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2620 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2621 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2622 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2623 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2624 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2625 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2626 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2627 int front() const throw(INTERP_KERNEL::Exception);
2628 int back() const throw(INTERP_KERNEL::Exception);
2629 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2630 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2631 int *getPointer() throw(INTERP_KERNEL::Exception);
2632 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2633 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2634 const int *begin() const throw(INTERP_KERNEL::Exception);
2635 const int *end() const throw(INTERP_KERNEL::Exception);
2636 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2637 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2638 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2639 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2640 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2641 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2642 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2643 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2644 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2645 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2646 int count(int value) const throw(INTERP_KERNEL::Exception);
2647 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2648 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2649 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2650 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2651 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2652 void abs() throw(INTERP_KERNEL::Exception);
2653 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2654 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2655 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2656 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2657 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2658 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2659 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2660 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2661 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2662 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2663 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2664 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2665 DataArrayInt *getIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2666 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2667 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2668 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2669 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2670 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2671 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2672 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2673 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2675 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2677 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2678 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2679 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2680 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2681 void computeOffsets() throw(INTERP_KERNEL::Exception);
2682 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2683 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2684 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2685 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2686 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2688 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2689 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2690 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2691 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2692 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2693 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2694 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2695 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2696 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2697 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2698 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2699 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2700 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2702 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2705 DataArrayInt() throw(INTERP_KERNEL::Exception)
2707 return DataArrayInt::New();
2710 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2712 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)";
2713 std::string msg(msgBase);
2715 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2718 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2722 if(PyInt_Check(nbOfTuples))
2724 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2726 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2729 if(PyInt_Check(nbOfComp))
2730 {//DataArrayInt.New([1,3,4,5],2,2)
2731 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2733 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2734 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2735 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2736 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2740 throw INTERP_KERNEL::Exception(msg.c_str());
2743 {//DataArrayInt.New([1,3,4],3)
2744 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2746 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2747 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2752 throw INTERP_KERNEL::Exception(msg.c_str());
2755 {// DataArrayInt.New([1,3,4])
2756 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2757 int tmpp1=-1,tmpp2=-1;
2758 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2759 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2763 else if(PyInt_Check(elt0))
2765 int nbOfTuples1=PyInt_AS_LONG(elt0);
2767 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2772 if(PyInt_Check(nbOfTuples))
2773 {//DataArrayInt.New(5,2)
2774 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2776 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2777 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2778 ret->alloc(nbOfTuples1,nbOfCompo);
2782 throw INTERP_KERNEL::Exception(msg.c_str());
2785 throw INTERP_KERNEL::Exception(msg.c_str());
2788 {//DataArrayInt.New(5)
2789 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2790 ret->alloc(nbOfTuples1,1);
2795 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2796 {//DataArrayInt.New(numpyArray)
2797 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2801 throw INTERP_KERNEL::Exception(msg.c_str());
2802 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2805 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2807 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2810 std::string __str__() const throw(INTERP_KERNEL::Exception)
2812 return self->reprNotTooLong();
2815 int __len__() const throw(INTERP_KERNEL::Exception)
2817 if(self->isAllocated())
2819 return self->getNumberOfTuples();
2823 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2827 int __int__() const throw(INTERP_KERNEL::Exception)
2829 return self->intValue();
2832 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2834 return self->iterator();
2837 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2839 int sz=self->getNumberOfComponents();
2840 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2841 self->accumulate(tmp);
2842 return convertIntArrToPyList(tmp,sz);
2845 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2848 std::vector<int> val2;
2849 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2850 return self->accumulatePerChunck(bg,bg+sz);
2853 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2856 std::vector<int> val2;
2857 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2858 return self->getIdsEqualTuple(bg,bg+sz);
2861 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2863 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2864 PyObject *ret=PyList_New(slcs.size());
2865 for(std::size_t i=0;i<slcs.size();i++)
2866 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2870 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2872 if(!PySlice_Check(slic))
2873 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2874 Py_ssize_t strt=2,stp=2,step=2;
2875 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2876 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2877 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2878 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 !");
2879 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2882 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2885 self->getMinMaxValues(a,b);
2886 PyObject *ret=PyTuple_New(2);
2887 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2888 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2892 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2894 int newNbOfTuples=-1;
2895 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2896 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2897 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2898 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2899 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2900 PyObject *ret=PyTuple_New(2);
2901 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2902 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2906 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2908 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
2909 int szArr,sw,iTypppArr;
2910 std::vector<int> stdvecTyyppArr;
2911 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2912 int *pt(ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2913 ret->useArray(pt,true,ParaMEDMEM::C_DEALLOC,szArr,1);
2917 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2919 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 !";
2920 if(PyList_Check(li) || PyTuple_Check(li))
2924 if(PyInt_Check(nbOfTuples))
2926 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2928 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2931 if(PyInt_Check(nbOfComp))
2932 {//DataArrayInt.setValues([1,3,4,5],2,2)
2933 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2935 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2936 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2937 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2940 throw INTERP_KERNEL::Exception(msg);
2943 {//DataArrayInt.setValues([1,3,4],3)
2945 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2946 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2950 throw INTERP_KERNEL::Exception(msg);
2953 {// DataArrayInt.setValues([1,3,4])
2954 int tmpp1=-1,tmpp2=-1;
2955 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2956 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2960 throw INTERP_KERNEL::Exception(msg);
2963 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2965 const int *vals=self->getConstPointer();
2966 return convertIntArrToPyList(vals,self->getNbOfElems());
2970 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2972 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2976 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2979 bool ret0=self->isEqualIfNotWhy(other,ret1);
2980 PyObject *ret=PyTuple_New(2);
2981 PyObject *ret0Py=ret0?Py_True:Py_False;
2983 PyTuple_SetItem(ret,0,ret0Py);
2984 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2988 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2990 const int *vals=self->getConstPointer();
2991 int nbOfComp=self->getNumberOfComponents();
2992 int nbOfTuples=self->getNumberOfTuples();
2993 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2996 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2998 std::vector<const DataArrayInt *> groups;
2999 std::vector< std::vector<int> > fidsOfGroups;
3000 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
3001 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3002 PyObject *ret = PyList_New(2);
3003 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3004 int sz=fidsOfGroups.size();
3005 PyObject *ret1 = PyList_New(sz);
3006 for(int i=0;i<sz;i++)
3007 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3008 PyList_SetItem(ret,1,ret1);
3012 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3015 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3016 if (!SWIG_IsOK(res1))
3019 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3020 self->transformWithIndArr(tmp,tmp+size);
3024 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3025 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3029 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3033 std::vector<int> multiVal;
3034 std::pair<int, std::pair<int,int> > slic;
3035 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3036 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3040 return self->getIdsEqualList(&singleVal,&singleVal+1);
3042 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3044 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3046 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3050 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3054 std::vector<int> multiVal;
3055 std::pair<int, std::pair<int,int> > slic;
3056 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3057 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3061 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
3063 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3065 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3067 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3071 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3073 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3075 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3076 if (!SWIG_IsOK(res1))
3079 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3080 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3084 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3086 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3087 da2->checkAllocated();
3088 int size=self->getNumberOfTuples();
3089 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
3091 PyObject *ret = PyList_New(3);
3092 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3093 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3094 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3098 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3101 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3102 if (!SWIG_IsOK(res1))
3105 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3106 return self->transformWithIndArrR(tmp,tmp+size);
3110 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3111 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3115 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3118 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3119 if (!SWIG_IsOK(res1))
3122 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3123 if(size!=self->getNumberOfTuples())
3125 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3127 return self->renumberAndReduce(tmp,newNbOfTuple);
3131 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3133 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3134 da2->checkAllocated();
3135 int size=self->getNumberOfTuples();
3136 if(size!=self->getNumberOfTuples())
3138 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3140 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3144 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3147 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3148 if (!SWIG_IsOK(res1))
3151 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3152 if(size!=self->getNumberOfTuples())
3154 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3156 return self->renumber(tmp);
3160 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3162 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3163 da2->checkAllocated();
3164 int size=self->getNumberOfTuples();
3165 if(size!=self->getNumberOfTuples())
3167 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3169 return self->renumber(da2->getConstPointer());
3173 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3176 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3177 if (!SWIG_IsOK(res1))
3180 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3181 if(size!=self->getNumberOfTuples())
3183 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3185 return self->renumberR(tmp);
3189 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3191 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3192 da2->checkAllocated();
3193 int size=self->getNumberOfTuples();
3194 if(size!=self->getNumberOfTuples())
3196 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3198 return self->renumberR(da2->getConstPointer());
3202 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3204 std::vector<int> tmp;
3205 convertPyToNewIntArr3(li,tmp);
3206 self->setSelectedComponents(a,tmp);
3209 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3211 int sz=self->getNumberOfComponents();
3212 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3213 self->getTuple(tupleId,tmp);
3214 return convertIntArrToPyList(tmp,sz);
3217 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3219 DataArrayInt *arr=0;
3220 DataArrayInt *arrI=0;
3221 self->changeSurjectiveFormat(targetNb,arr,arrI);
3222 PyObject *res = PyList_New(2);
3223 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3224 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3228 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3230 std::vector<const DataArrayInt *> tmp;
3231 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3232 return DataArrayInt::Meld(tmp);
3235 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3237 std::vector<const DataArrayInt *> tmp;
3238 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3239 return DataArrayInt::Aggregate(tmp);
3242 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3244 std::vector<const DataArrayInt *> tmp;
3245 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3246 return DataArrayInt::AggregateIndexes(tmp);
3249 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3251 std::vector<const DataArrayInt *> tmp;
3252 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3253 return DataArrayInt::BuildUnion(tmp);
3256 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3258 std::vector<const DataArrayInt *> tmp;
3259 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3260 return DataArrayInt::BuildIntersection(tmp);
3263 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3266 int r1=self->getMaxValue(tmp);
3267 PyObject *ret=PyTuple_New(2);
3268 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3269 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3273 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3276 int r1=self->getMinValue(tmp);
3277 PyObject *ret=PyTuple_New(2);
3278 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3279 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3283 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3285 int nbOfCompo=self->getNumberOfComponents();
3290 if(PyInt_Check(obj))
3292 int val=(int)PyInt_AS_LONG(obj);
3293 return self->locateValue(val);
3296 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3300 std::vector<int> arr;
3301 convertPyToNewIntArr3(obj,arr);
3302 return self->locateTuple(arr);
3307 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3309 int nbOfCompo=self->getNumberOfComponents();
3316 if(PyInt_Check(obj))
3318 int val=(int)PyInt_AS_LONG(obj);
3319 return self->presenceOfValue(val);
3322 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3326 std::vector<int> arr;
3327 convertPyToNewIntArr3(obj,arr);
3328 return self->presenceOfTuple(arr);
3333 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3335 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3336 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3337 self->checkAllocated();
3338 int nbOfTuples=self->getNumberOfTuples();
3339 int nbOfComponents=self->getNumberOfComponents();
3341 std::vector<int> vt1,vc1;
3342 std::pair<int, std::pair<int,int> > pt1,pc1;
3343 DataArrayInt *dt1=0,*dc1=0;
3345 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3346 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3351 if(nbOfComponents==1)
3352 return PyInt_FromLong(self->getIJSafe(it1,0));
3353 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3356 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3358 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3360 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3362 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3365 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3366 std::vector<int> v2(1,ic1);
3367 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3371 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3372 std::vector<int> v2(1,ic1);
3373 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3377 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3378 std::vector<int> v2(1,ic1);
3379 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3383 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3384 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3388 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3389 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3393 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3394 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3398 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3399 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3403 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3404 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3405 std::vector<int> v2(nbOfComp);
3406 for(int i=0;i<nbOfComp;i++)
3407 v2[i]=pc1.first+i*pc1.second.second;
3408 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3412 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3413 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3414 std::vector<int> v2(nbOfComp);
3415 for(int i=0;i<nbOfComp;i++)
3416 v2[i]=pc1.first+i*pc1.second.second;
3417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3421 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3422 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3423 std::vector<int> v2(nbOfComp);
3424 for(int i=0;i<nbOfComp;i++)
3425 v2[i]=pc1.first+i*pc1.second.second;
3426 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3430 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3431 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3432 std::vector<int> v2(nbOfComp);
3433 for(int i=0;i<nbOfComp;i++)
3434 v2[i]=pc1.first+i*pc1.second.second;
3435 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3438 throw INTERP_KERNEL::Exception(msg);
3442 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3444 self->checkAllocated();
3445 const char msg[]="Unexpected situation in __setitem__ !";
3446 int nbOfTuples=self->getNumberOfTuples();
3447 int nbOfComponents=self->getNumberOfComponents();
3450 std::vector<int> v1;
3452 DataArrayIntTuple *dd1=0;
3453 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3455 std::vector<int> vt1,vc1;
3456 std::pair<int, std::pair<int,int> > pt1,pc1;
3457 DataArrayInt *dt1=0,*dc1=0;
3458 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3459 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3467 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3470 tmp=DataArrayInt::New();
3471 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3472 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3475 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3478 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3479 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3482 throw INTERP_KERNEL::Exception(msg);
3491 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3494 tmp=DataArrayInt::New();
3495 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3496 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3499 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3502 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3503 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3506 throw INTERP_KERNEL::Exception(msg);
3515 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3518 tmp=DataArrayInt::New();
3519 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3520 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3523 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3526 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3527 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3530 throw INTERP_KERNEL::Exception(msg);
3539 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3542 tmp=DataArrayInt::New();
3543 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3544 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3547 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3550 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3551 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3554 throw INTERP_KERNEL::Exception(msg);
3563 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3566 tmp=DataArrayInt::New();
3567 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3568 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3571 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3574 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3575 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3578 throw INTERP_KERNEL::Exception(msg);
3587 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3590 tmp=DataArrayInt::New();
3591 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3592 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3595 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3598 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3599 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3602 throw INTERP_KERNEL::Exception(msg);
3611 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3614 tmp=DataArrayInt::New();
3615 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3616 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3619 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3622 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3623 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3626 throw INTERP_KERNEL::Exception(msg);
3635 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3638 tmp=DataArrayInt::New();
3639 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3640 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3643 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3646 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3647 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3650 throw INTERP_KERNEL::Exception(msg);
3659 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3662 tmp=DataArrayInt::New();
3663 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3664 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3667 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3670 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3671 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3674 throw INTERP_KERNEL::Exception(msg);
3683 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3686 tmp=DataArrayInt::New();
3687 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3688 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3691 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3694 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3695 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3698 throw INTERP_KERNEL::Exception(msg);
3707 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3710 tmp=DataArrayInt::New();
3711 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3712 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3715 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3718 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3719 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3722 throw INTERP_KERNEL::Exception(msg);
3731 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3734 tmp=DataArrayInt::New();
3735 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3736 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3739 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3742 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3743 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3746 throw INTERP_KERNEL::Exception(msg);
3755 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3758 tmp=DataArrayInt::New();
3759 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3760 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3763 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3766 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3767 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3770 throw INTERP_KERNEL::Exception(msg);
3779 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3782 tmp=DataArrayInt::New();
3783 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3784 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3787 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3790 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3791 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3794 throw INTERP_KERNEL::Exception(msg);
3803 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3806 tmp=DataArrayInt::New();
3807 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3808 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3811 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3814 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3815 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3818 throw INTERP_KERNEL::Exception(msg);
3827 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3830 tmp=DataArrayInt::New();
3831 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3832 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3835 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3838 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3839 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3842 throw INTERP_KERNEL::Exception(msg);
3847 throw INTERP_KERNEL::Exception(msg);
3852 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3854 return self->negate();
3857 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3859 const char msg[]="Unexpected situation in __add__ !";
3862 std::vector<int> aa;
3863 DataArrayIntTuple *aaa;
3865 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3871 ret->applyLin(1,val);
3876 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3877 return DataArrayInt::Add(self,aaaa);
3881 return DataArrayInt::Add(self,a);
3885 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3886 return DataArrayInt::Add(self,aaaa);
3889 throw INTERP_KERNEL::Exception(msg);
3893 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3895 const char msg[]="Unexpected situation in __radd__ !";
3898 std::vector<int> aa;
3899 DataArrayIntTuple *aaa;
3901 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3906 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3907 ret->applyLin(1,val);
3912 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3913 return DataArrayInt::Add(self,aaaa);
3917 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3918 return DataArrayInt::Add(self,aaaa);
3921 throw INTERP_KERNEL::Exception(msg);
3925 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3927 const char msg[]="Unexpected situation in __iadd__ !";
3930 std::vector<int> aa;
3931 DataArrayIntTuple *aaa;
3933 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3938 self->applyLin(1,val);
3939 Py_XINCREF(trueSelf);
3944 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3946 Py_XINCREF(trueSelf);
3952 Py_XINCREF(trueSelf);
3957 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3958 self->addEqual(aaaa);
3959 Py_XINCREF(trueSelf);
3963 throw INTERP_KERNEL::Exception(msg);
3967 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3969 const char msg[]="Unexpected situation in __sub__ !";
3972 std::vector<int> aa;
3973 DataArrayIntTuple *aaa;
3975 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3981 ret->applyLin(1,-val);
3986 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3987 return DataArrayInt::Substract(self,aaaa);
3991 return DataArrayInt::Substract(self,a);
3995 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3996 return DataArrayInt::Substract(self,aaaa);
3999 throw INTERP_KERNEL::Exception(msg);
4003 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4005 const char msg[]="Unexpected situation in __rsub__ !";
4008 std::vector<int> aa;
4009 DataArrayIntTuple *aaa;
4011 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4016 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4017 ret->applyLin(-1,val);
4022 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4023 return DataArrayInt::Substract(aaaa,self);
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4028 return DataArrayInt::Substract(aaaa,self);
4031 throw INTERP_KERNEL::Exception(msg);
4035 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4037 const char msg[]="Unexpected situation in __isub__ !";
4040 std::vector<int> aa;
4041 DataArrayIntTuple *aaa;
4043 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4048 self->applyLin(1,-val);
4049 Py_XINCREF(trueSelf);
4054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4055 self->substractEqual(bb);
4056 Py_XINCREF(trueSelf);
4061 self->substractEqual(a);
4062 Py_XINCREF(trueSelf);
4067 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4068 self->substractEqual(aaaa);
4069 Py_XINCREF(trueSelf);
4073 throw INTERP_KERNEL::Exception(msg);
4077 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4079 const char msg[]="Unexpected situation in __mul__ !";
4082 std::vector<int> aa;
4083 DataArrayIntTuple *aaa;
4085 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4090 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4091 ret->applyLin(val,0);
4096 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4097 return DataArrayInt::Multiply(self,aaaa);
4101 return DataArrayInt::Multiply(self,a);
4105 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4106 return DataArrayInt::Multiply(self,aaaa);
4109 throw INTERP_KERNEL::Exception(msg);
4113 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4115 const char msg[]="Unexpected situation in __rmul__ !";
4118 std::vector<int> aa;
4119 DataArrayIntTuple *aaa;
4121 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4126 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4127 ret->applyLin(val,0);
4132 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4133 return DataArrayInt::Multiply(self,aaaa);
4137 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4138 return DataArrayInt::Multiply(self,aaaa);
4141 throw INTERP_KERNEL::Exception(msg);
4145 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4147 const char msg[]="Unexpected situation in __imul__ !";
4150 std::vector<int> aa;
4151 DataArrayIntTuple *aaa;
4153 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4158 self->applyLin(val,0);
4159 Py_XINCREF(trueSelf);
4164 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4165 self->multiplyEqual(bb);
4166 Py_XINCREF(trueSelf);
4171 self->multiplyEqual(a);
4172 Py_XINCREF(trueSelf);
4177 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4178 self->multiplyEqual(aaaa);
4179 Py_XINCREF(trueSelf);
4183 throw INTERP_KERNEL::Exception(msg);
4187 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4189 const char msg[]="Unexpected situation in __div__ !";
4192 std::vector<int> aa;
4193 DataArrayIntTuple *aaa;
4195 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4200 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4201 ret->applyDivideBy(val);
4206 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4207 return DataArrayInt::Divide(self,aaaa);
4211 return DataArrayInt::Divide(self,a);
4215 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4216 return DataArrayInt::Divide(self,aaaa);
4219 throw INTERP_KERNEL::Exception(msg);
4223 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4225 const char msg[]="Unexpected situation in __rdiv__ !";
4228 std::vector<int> aa;
4229 DataArrayIntTuple *aaa;
4231 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4236 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4242 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4243 return DataArrayInt::Divide(aaaa,self);
4247 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4248 return DataArrayInt::Divide(aaaa,self);
4251 throw INTERP_KERNEL::Exception(msg);
4255 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4257 const char msg[]="Unexpected situation in __idiv__ !";
4260 std::vector<int> aa;
4261 DataArrayIntTuple *aaa;
4263 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4268 self->applyDivideBy(val);
4269 Py_XINCREF(trueSelf);
4274 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4275 self->divideEqual(bb);
4276 Py_XINCREF(trueSelf);
4281 self->divideEqual(a);
4282 Py_XINCREF(trueSelf);
4287 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4288 self->divideEqual(aaaa);
4289 Py_XINCREF(trueSelf);
4293 throw INTERP_KERNEL::Exception(msg);
4297 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4299 const char msg[]="Unexpected situation in __mod__ !";
4302 std::vector<int> aa;
4303 DataArrayIntTuple *aaa;
4305 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4310 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4311 ret->applyModulus(val);
4316 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4317 return DataArrayInt::Modulus(self,aaaa);
4321 return DataArrayInt::Modulus(self,a);
4325 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4326 return DataArrayInt::Modulus(self,aaaa);
4329 throw INTERP_KERNEL::Exception(msg);
4333 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4335 const char msg[]="Unexpected situation in __rmod__ !";
4338 std::vector<int> aa;
4339 DataArrayIntTuple *aaa;
4341 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4346 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4347 ret->applyRModulus(val);
4352 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4353 return DataArrayInt::Modulus(aaaa,self);
4357 return DataArrayInt::Modulus(a,self);
4361 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4362 return DataArrayInt::Modulus(aaaa,self);
4365 throw INTERP_KERNEL::Exception(msg);
4369 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4371 const char msg[]="Unexpected situation in __imod__ !";
4374 std::vector<int> aa;
4375 DataArrayIntTuple *aaa;
4377 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4382 self->applyModulus(val);
4383 Py_XINCREF(trueSelf);
4388 self->modulusEqual(a);
4389 Py_XINCREF(trueSelf);
4394 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4395 self->modulusEqual(aaaa);
4396 Py_XINCREF(trueSelf);
4400 throw INTERP_KERNEL::Exception(msg);
4404 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4406 const char msg[]="Unexpected situation in __pow__ !";
4409 std::vector<int> aa;
4410 DataArrayIntTuple *aaa;
4412 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4417 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4423 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4424 return DataArrayInt::Pow(self,aaaa);
4428 return DataArrayInt::Pow(self,a);
4432 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4433 return DataArrayInt::Pow(self,aaaa);
4436 throw INTERP_KERNEL::Exception(msg);
4440 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4442 const char msg[]="Unexpected situation in __rpow__ !";
4445 std::vector<int> aa;
4446 DataArrayIntTuple *aaa;
4448 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4453 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4454 ret->applyRPow(val);
4459 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4460 return DataArrayInt::Pow(aaaa,self);
4464 return DataArrayInt::Pow(a,self);
4468 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4469 return DataArrayInt::Pow(aaaa,self);
4472 throw INTERP_KERNEL::Exception(msg);
4476 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4478 const char msg[]="Unexpected situation in __ipow__ !";
4481 std::vector<int> aa;
4482 DataArrayIntTuple *aaa;
4484 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4489 self->applyPow(val);
4490 Py_XINCREF(trueSelf);
4496 Py_XINCREF(trueSelf);
4501 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4502 self->powEqual(aaaa);
4503 Py_XINCREF(trueSelf);
4507 throw INTERP_KERNEL::Exception(msg);
4511 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4513 std::ostringstream oss;
4514 self->reprQuickOverview(oss);
4518 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4520 int szArr,sw,iTypppArr;
4521 std::vector<int> stdvecTyyppArr;
4522 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4523 self->pushBackValsSilent(tmp,tmp+szArr);
4526 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4528 std::vector<int> ret1;
4529 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4530 std::size_t sz=ret0.size();
4531 PyObject *pyRet=PyTuple_New(2);
4532 PyObject *pyRet0=PyList_New((int)sz);
4533 PyObject *pyRet1=PyList_New((int)sz);
4534 for(std::size_t i=0;i<sz;i++)
4536 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4537 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4539 PyTuple_SetItem(pyRet,0,pyRet0);
4540 PyTuple_SetItem(pyRet,1,pyRet1);
4544 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4546 DataArrayInt *ret0=0,*ret1=0;
4547 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4548 PyObject *pyRet=PyTuple_New(2);
4549 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4550 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4554 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4557 bool ret(self->isRange(a,b,c));
4558 PyObject *pyRet=PyTuple_New(2);
4559 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4561 PyTuple_SetItem(pyRet,0,ret0Py);
4563 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4569 PyTuple_SetItem(pyRet,1,ret1Py);
4574 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4576 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4577 if(!PyTuple_Check(args))
4578 throw INTERP_KERNEL::Exception(MSG);
4579 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4580 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4581 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4583 PyObject *tmp0(PyTuple_New(1));
4584 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4585 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4587 Py_DECREF(selfMeth);
4588 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4589 int sz(PyTuple_Size(args));
4591 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4592 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4593 PyObject *zeNumpyRepr(0);
4594 PyObject *tmp1(PyInt_FromLong(0));
4595 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4597 PyObject *tmp3(PyTuple_New(1));
4598 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4599 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4603 Py_DECREF(initMeth);
4607 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4610 if(!self->isAllocated())
4611 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4612 PyObject *ret(PyTuple_New(1));
4613 PyObject *ret0(PyDict_New());
4614 PyObject *numpyArryObj(ParaMEDMEM_DataArrayInt_toNumPyArray(self));
4615 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4616 PyObject *tmp1(PyInt_FromLong(0));
4617 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4618 PyTuple_SetItem(ret,0,ret0);
4622 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4628 class DataArrayIntTuple;
4630 class DataArrayIntIterator
4633 DataArrayIntIterator(DataArrayInt *da);
4634 ~DataArrayIntIterator();
4639 DataArrayIntTuple *ret=self->nextt();
4641 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4644 PyErr_SetString(PyExc_StopIteration,"No more data.");
4651 class DataArrayIntTuple
4654 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4655 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4658 std::string __str__() const throw(INTERP_KERNEL::Exception)
4660 return self->repr();
4663 int __int__() const throw(INTERP_KERNEL::Exception)
4665 return self->intValue();
4668 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4670 return self->buildDAInt(1,self->getNumberOfCompo());
4673 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4675 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4676 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4677 Py_XINCREF(trueSelf);
4681 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4683 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4684 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4685 Py_XINCREF(trueSelf);
4689 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4691 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4692 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4693 Py_XINCREF(trueSelf);
4697 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4699 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4700 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4701 Py_XINCREF(trueSelf);
4705 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4707 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4708 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4709 Py_XINCREF(trueSelf);
4713 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4715 return PyInt_FromLong(self->getNumberOfCompo());
4718 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4720 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4723 std::vector<int> multiVal;
4724 std::pair<int, std::pair<int,int> > slic;
4725 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4726 const int *pt=self->getConstPointer();
4727 int nbc=self->getNumberOfCompo();
4728 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4735 std::ostringstream oss;
4736 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4737 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4741 return PyInt_FromLong(pt[singleVal]);
4745 return PyInt_FromLong(pt[nbc+singleVal]);
4748 std::ostringstream oss;
4749 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4750 throw INTERP_KERNEL::Exception(oss.str().c_str());
4756 PyObject *t=PyTuple_New(multiVal.size());
4757 for(int j=0;j<(int)multiVal.size();j++)
4759 int cid=multiVal[j];
4762 std::ostringstream oss;
4763 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4764 throw INTERP_KERNEL::Exception(oss.str().c_str());
4766 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4772 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4773 PyObject *t=PyTuple_New(sz);
4774 for(int j=0;j<sz;j++)
4775 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4779 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4783 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4785 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4786 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4789 std::vector<int> multiValV;
4790 std::pair<int, std::pair<int,int> > slicV;
4791 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4792 int nbc=self->getNumberOfCompo();
4793 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4795 std::vector<int> multiVal;
4796 std::pair<int, std::pair<int,int> > slic;
4797 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4798 int *pt=self->getPointer();
4799 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4806 std::ostringstream oss;
4807 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4808 throw INTERP_KERNEL::Exception(oss.str().c_str());
4814 pt[singleVal]=singleValV;
4819 if(multiValV.size()!=1)
4821 std::ostringstream oss;
4822 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4823 throw INTERP_KERNEL::Exception(oss.str().c_str());
4825 pt[singleVal]=multiValV[0];
4830 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4834 throw INTERP_KERNEL::Exception(msg);
4843 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4847 std::ostringstream oss;
4848 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4849 throw INTERP_KERNEL::Exception(oss.str().c_str());
4857 if(multiVal.size()!=multiValV.size())
4859 std::ostringstream oss;
4860 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4861 throw INTERP_KERNEL::Exception(oss.str().c_str());
4863 for(int i=0;i<(int)multiVal.size();i++)
4865 int pos=multiVal[i];
4868 std::ostringstream oss;
4869 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4870 throw INTERP_KERNEL::Exception(oss.str().c_str());
4872 pt[multiVal[i]]=multiValV[i];
4878 const int *ptV=daIntTyyppV->getConstPointer();
4879 if(nbc>daIntTyyppV->getNumberOfCompo())
4881 std::ostringstream oss;
4882 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4883 throw INTERP_KERNEL::Exception(oss.str().c_str());
4885 std::copy(ptV,ptV+nbc,pt);
4889 throw INTERP_KERNEL::Exception(msg);
4894 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4899 for(int j=0;j<sz;j++)
4900 pt[slic.first+j*slic.second.second]=singleValV;
4905 if(sz!=(int)multiValV.size())
4907 std::ostringstream oss;
4908 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4909 throw INTERP_KERNEL::Exception(oss.str().c_str());
4911 for(int j=0;j<sz;j++)
4912 pt[slic.first+j*slic.second.second]=multiValV[j];
4917 const int *ptV=daIntTyyppV->getConstPointer();
4918 if(sz>daIntTyyppV->getNumberOfCompo())
4920 std::ostringstream oss;
4921 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4922 throw INTERP_KERNEL::Exception(oss.str().c_str());
4924 for(int j=0;j<sz;j++)
4925 pt[slic.first+j*slic.second.second]=ptV[j];
4929 throw INTERP_KERNEL::Exception(msg);
4933 throw INTERP_KERNEL::Exception(msg);
4939 class DataArrayChar : public DataArray
4942 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4943 int getHashCode() const throw(INTERP_KERNEL::Exception);
4944 bool empty() const throw(INTERP_KERNEL::Exception);
4945 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4946 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4947 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4948 char popBackSilent() throw(INTERP_KERNEL::Exception);
4949 void pack() const throw(INTERP_KERNEL::Exception);
4950 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4951 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4952 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4953 void reverse() throw(INTERP_KERNEL::Exception);
4954 void fillWithZero() throw(INTERP_KERNEL::Exception);
4955 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4956 std::string repr() const throw(INTERP_KERNEL::Exception);
4957 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4958 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4959 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4960 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4961 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4962 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4963 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4964 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4965 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4966 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4967 char front() const throw(INTERP_KERNEL::Exception);
4968 char back() const throw(INTERP_KERNEL::Exception);
4969 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4970 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4971 char *getPointer() throw(INTERP_KERNEL::Exception);
4972 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4973 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4974 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4975 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4976 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4977 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4978 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4979 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4980 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4981 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4982 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4985 int __len__() const throw(INTERP_KERNEL::Exception)
4987 if(self->isAllocated())
4989 return self->getNumberOfTuples();
4993 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4997 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5000 bool ret0=self->isEqualIfNotWhy(other,ret1);
5001 PyObject *ret=PyTuple_New(2);
5002 PyObject *ret0Py=ret0?Py_True:Py_False;
5004 PyTuple_SetItem(ret,0,ret0Py);
5005 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5009 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5012 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5013 if (!SWIG_IsOK(res1))
5016 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5017 if(size!=self->getNumberOfTuples())
5019 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5021 return self->renumber(tmp);
5025 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5027 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5028 da2->checkAllocated();
5029 int size=self->getNumberOfTuples();
5030 if(size!=self->getNumberOfTuples())
5032 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5034 return self->renumber(da2->getConstPointer());
5038 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5041 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5042 if (!SWIG_IsOK(res1))
5045 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5046 if(size!=self->getNumberOfTuples())
5048 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5050 return self->renumberR(tmp);
5054 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5056 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5057 da2->checkAllocated();
5058 int size=self->getNumberOfTuples();
5059 if(size!=self->getNumberOfTuples())
5061 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5063 return self->renumberR(da2->getConstPointer());
5067 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5070 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5071 if (!SWIG_IsOK(res1))
5074 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5075 if(size!=self->getNumberOfTuples())
5077 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5079 return self->renumberAndReduce(tmp,newNbOfTuple);
5083 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5085 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5086 da2->checkAllocated();
5087 int size=self->getNumberOfTuples();
5088 if(size!=self->getNumberOfTuples())
5090 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5092 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5096 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5098 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5099 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5100 return DataArrayChar::Aggregate(tmp);
5103 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5105 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5106 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5107 return DataArrayChar::Meld(tmp);
5112 class DataArrayByteIterator;
5114 class DataArrayByte : public DataArrayChar
5117 static DataArrayByte *New();
5118 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5119 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5120 char byteValue() const throw(INTERP_KERNEL::Exception);
5123 DataArrayByte() throw(INTERP_KERNEL::Exception)
5125 return DataArrayByte::New();
5128 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5130 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) !";
5131 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5135 if(PyInt_Check(nbOfTuples))
5137 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5139 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5142 if(PyInt_Check(nbOfComp))
5143 {//DataArrayByte.New([1,3,4,5],2,2)
5144 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5146 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5147 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5148 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5149 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5153 throw INTERP_KERNEL::Exception(msg);
5156 {//DataArrayByte.New([1,3,4],3)
5157 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5159 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5160 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5165 throw INTERP_KERNEL::Exception(msg);
5168 {// DataArrayByte.New([1,3,4])
5169 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5170 int tmpp1=-1,tmpp2=-1;
5171 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5172 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5176 else if(PyInt_Check(elt0))
5178 int nbOfTuples1=PyInt_AS_LONG(elt0);
5180 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5185 if(PyInt_Check(nbOfTuples))
5186 {//DataArrayByte.New(5,2)
5187 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5189 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5190 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5191 ret->alloc(nbOfTuples1,nbOfCompo);
5195 throw INTERP_KERNEL::Exception(msg);
5198 throw INTERP_KERNEL::Exception(msg);
5201 {//DataArrayByte.New(5)
5202 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5203 ret->alloc(nbOfTuples1,1);
5208 throw INTERP_KERNEL::Exception(msg);
5211 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5213 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5216 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5218 std::ostringstream oss;
5219 self->reprQuickOverview(oss);
5223 int __int__() const throw(INTERP_KERNEL::Exception)
5225 return (int) self->byteValue();
5228 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5230 return self->iterator();
5233 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5235 return (int)self->getIJ(tupleId,compoId);
5238 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5240 return (int)self->getIJSafe(tupleId,compoId);
5243 std::string __str__() const throw(INTERP_KERNEL::Exception)
5245 return self->repr();
5248 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5250 const char *vals=self->getConstPointer();
5251 int nbOfComp=self->getNumberOfComponents();
5252 int nbOfTuples=self->getNumberOfTuples();
5253 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5256 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5259 int ival=-1; std::vector<int> ivval;
5260 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5261 std::vector<char> vals(sz);
5262 std::copy(pt,pt+sz,vals.begin());
5263 return self->presenceOfTuple(vals);
5266 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5269 int ival=-1; std::vector<int> ivval;
5270 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5271 std::vector<char> vals2(sz);
5272 std::copy(pt,pt+sz,vals2.begin());
5273 return self->presenceOfValue(vals2);
5276 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5279 int ival=-1; std::vector<int> ivval;
5280 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5281 std::vector<char> vals2(sz);
5282 std::copy(pt,pt+sz,vals2.begin());
5283 return self->locateValue(vals2);
5286 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5289 int ival=-1; std::vector<int> ivval;
5290 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5291 std::vector<char> vals(sz);
5292 std::copy(pt,pt+sz,vals.begin());
5293 return self->locateTuple(vals);
5296 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5299 int ival=-1; std::vector<int> ivval;
5300 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5301 std::vector<char> vals(sz);
5302 std::copy(pt,pt+sz,vals.begin());
5303 return self->search(vals);
5306 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5308 int sz=self->getNumberOfComponents();
5309 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5310 self->getTuple(tupleId,tmp);
5311 PyObject *ret=PyTuple_New(sz);
5312 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5316 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5319 int r1=(int)self->getMaxValue(tmp);
5320 PyObject *ret=PyTuple_New(2);
5321 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5322 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5326 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5329 int r1=(int)self->getMinValue(tmp);
5330 PyObject *ret=PyTuple_New(2);
5331 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5332 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5336 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5338 int nbOfCompo=self->getNumberOfComponents();
5343 if(PyInt_Check(obj))
5345 int val=(int)PyInt_AS_LONG(obj);
5346 return self->locateValue(val);
5349 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5352 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5356 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5358 int nbOfCompo=self->getNumberOfComponents();
5365 if(PyInt_Check(obj))
5367 int val=(int)PyInt_AS_LONG(obj);
5368 return self->presenceOfValue(val);
5371 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5374 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5378 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5380 self->checkAllocated();
5381 const char msg[]="Unexpected situation in __setitem__ !";
5382 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5385 std::vector<int> v1;
5387 DataArrayIntTuple *dd1=0;
5388 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5390 std::vector<int> vt1,vc1;
5391 std::pair<int, std::pair<int,int> > pt1,pc1;
5392 DataArrayInt *dt1=0,*dc1=0;
5393 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5394 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5402 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5405 throw INTERP_KERNEL::Exception(msg);
5414 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5417 throw INTERP_KERNEL::Exception(msg);
5426 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5429 throw INTERP_KERNEL::Exception(msg);
5438 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5441 throw INTERP_KERNEL::Exception(msg);
5450 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5453 throw INTERP_KERNEL::Exception(msg);
5462 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5465 throw INTERP_KERNEL::Exception(msg);
5474 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5477 throw INTERP_KERNEL::Exception(msg);
5486 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5489 throw INTERP_KERNEL::Exception(msg);
5498 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5501 throw INTERP_KERNEL::Exception(msg);
5510 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5513 throw INTERP_KERNEL::Exception(msg);
5522 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5525 throw INTERP_KERNEL::Exception(msg);
5534 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5537 throw INTERP_KERNEL::Exception(msg);
5546 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5549 throw INTERP_KERNEL::Exception(msg);
5558 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5561 throw INTERP_KERNEL::Exception(msg);
5570 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5573 throw INTERP_KERNEL::Exception(msg);
5582 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5585 throw INTERP_KERNEL::Exception(msg);
5590 throw INTERP_KERNEL::Exception(msg);
5597 class DataArrayByteTuple;
5599 class DataArrayByteIterator
5602 DataArrayByteIterator(DataArrayByte *da);
5603 ~DataArrayByteIterator();
5606 class DataArrayByteTuple
5609 std::string repr() const throw(INTERP_KERNEL::Exception);
5610 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5613 std::string __str__() const throw(INTERP_KERNEL::Exception)
5615 return self->repr();
5618 char __int__() const throw(INTERP_KERNEL::Exception)
5620 return self->byteValue();
5623 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5625 return self->buildDAByte(1,self->getNumberOfCompo());
5630 class DataArrayAsciiCharIterator;
5632 class DataArrayAsciiChar : public DataArrayChar
5635 static DataArrayAsciiChar *New();
5636 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5637 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5638 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5641 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5643 return DataArrayAsciiChar::New();
5646 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5648 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) !";
5649 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5653 if(PyInt_Check(nbOfTuples))
5655 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5657 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5660 if(PyInt_Check(nbOfComp))
5661 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5662 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5664 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5665 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5666 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5667 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5671 throw INTERP_KERNEL::Exception(msg);
5674 {//DataArrayAsciiChar.New([1,3,4],3)
5675 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5677 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5678 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5682 else if(PyString_Check(nbOfTuples))
5684 if(PyString_Size(nbOfTuples)!=1)
5685 throw INTERP_KERNEL::Exception(msg);
5686 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5687 std::vector<std::string> tmp;
5688 if(fillStringVector(elt0,tmp))
5689 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5691 throw INTERP_KERNEL::Exception(msg);
5694 throw INTERP_KERNEL::Exception(msg);
5698 std::vector<std::string> tmmp;
5699 if(fillStringVector(elt0,tmmp))
5700 //DataArrayAsciiChar.New(["abc","de","fghi"])
5701 return DataArrayAsciiChar::New(tmmp,' ');
5704 // DataArrayAsciiChar.New([1,3,4])
5705 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5706 int tmpp1=-1,tmpp2=-1;
5707 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5708 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5713 else if(PyInt_Check(elt0))
5715 int nbOfTuples1=PyInt_AS_LONG(elt0);
5717 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5722 if(PyInt_Check(nbOfTuples))
5723 {//DataArrayAsciiChar.New(5,2)
5724 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5726 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5727 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5728 ret->alloc(nbOfTuples1,nbOfCompo);
5732 throw INTERP_KERNEL::Exception(msg);
5735 throw INTERP_KERNEL::Exception(msg);
5738 {//DataArrayAsciiChar.New(5)
5739 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5740 ret->alloc(nbOfTuples1,1);
5745 throw INTERP_KERNEL::Exception(msg);
5748 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5750 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5753 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5755 std::ostringstream oss;
5756 self->reprQuickOverview(oss);
5760 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5762 return self->iterator();
5765 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5767 char tmp[2]; tmp[1]='\0';
5768 tmp[0]=self->getIJ(tupleId,compoId);
5769 return std::string(tmp);
5772 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5774 char tmp[2]; tmp[1]='\0';
5775 tmp[0]=self->getIJSafe(tupleId,compoId);
5776 return std::string(tmp);
5779 std::string __str__() const throw(INTERP_KERNEL::Exception)
5781 return self->repr();
5784 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5786 const char *vals=self->getConstPointer();
5787 int nbOfComp=self->getNumberOfComponents();
5788 int nbOfTuples=self->getNumberOfTuples();
5789 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5792 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5794 if(PyString_Check(tupl))
5796 Py_ssize_t sz=PyString_Size(tupl);
5797 std::vector<char> vals(sz);
5798 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5799 return self->presenceOfTuple(vals);
5802 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5805 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5807 if(PyString_Check(vals))
5809 Py_ssize_t sz=PyString_Size(vals);
5810 std::vector<char> vals2(sz);
5811 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5812 return self->presenceOfValue(vals2);
5815 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5818 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5820 if(PyString_Check(vals))
5822 Py_ssize_t sz=PyString_Size(vals);
5823 std::vector<char> vals2(sz);
5824 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5825 return self->locateValue(vals2);
5828 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5831 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5833 if(PyString_Check(tupl))
5835 Py_ssize_t sz=PyString_Size(tupl);
5836 std::vector<char> vals(sz);
5837 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5838 return self->locateTuple(vals);
5841 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5844 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5846 if(PyString_Check(strOrListOfInt))
5848 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5849 std::vector<char> vals(sz);
5850 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5851 return self->search(vals);
5854 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5857 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5859 int sz=self->getNumberOfComponents();
5860 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5861 self->getTuple(tupleId,tmp);
5862 return PyString_FromString(tmp);
5865 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5868 char tmp2[2]; tmp2[1]='\0';
5869 tmp2[0]=self->getMaxValue(tmp);
5870 PyObject *ret=PyTuple_New(2);
5871 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5872 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5876 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5879 char tmp2[2]; tmp2[1]='\0';
5880 tmp2[0]=self->getMinValue(tmp);
5881 PyObject *ret=PyTuple_New(2);
5882 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5883 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5887 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5889 int nbOfCompo=self->getNumberOfComponents();
5894 if(PyString_Check(obj))
5896 Py_ssize_t sz=PyString_Size(obj);
5897 char *pt=PyString_AsString(obj);
5899 return self->locateValue(pt[0]);
5901 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5904 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5907 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5911 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5913 int nbOfCompo=self->getNumberOfComponents();
5920 if(PyString_Check(obj))
5922 Py_ssize_t sz=PyString_Size(obj);
5923 char *pt=PyString_AsString(obj);
5925 return self->presenceOfValue(pt[0]);
5927 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5930 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5933 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5937 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5940 std::vector<int> stdvecTyyppArr;
5941 std::pair<int, std::pair<int,int> > sTyyppArr;
5942 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5943 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5947 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5949 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5951 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5953 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5955 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5959 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5961 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.";
5963 std::vector<int> stdvecTyyppArr;
5964 std::pair<int, std::pair<int,int> > sTyyppArr;
5965 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5966 int nbOfCompo=self->getNumberOfComponents();
5967 int nbOfTuples=self->getNumberOfTuples();
5968 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5970 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5971 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5980 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5986 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5987 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5990 //value vector<string>
5993 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5994 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5997 //value DataArrayChar
6000 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6004 throw INTERP_KERNEL::Exception(msg);
6008 {//obj list-tuple[int]
6014 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6020 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6021 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6024 //value vector<string>
6027 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6028 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6031 //value DataArrayChar
6034 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6038 throw INTERP_KERNEL::Exception(msg);
6049 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6055 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6056 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6059 //value vector<string>
6062 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6063 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6066 //value DataArrayChar
6069 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6073 throw INTERP_KERNEL::Exception(msg);
6084 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6090 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6091 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6094 //value vector<string>
6097 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6098 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6101 //value DataArrayChar
6104 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6108 throw INTERP_KERNEL::Exception(msg);
6113 throw INTERP_KERNEL::Exception(msg);
6119 class DataArrayAsciiCharTuple;
6121 class DataArrayAsciiCharIterator
6124 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6125 ~DataArrayAsciiCharIterator();
6130 DataArrayAsciiCharTuple *ret=self->nextt();
6132 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6135 PyErr_SetString(PyExc_StopIteration,"No more data.");
6142 class DataArrayAsciiCharTuple
6145 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6146 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6149 std::string __str__() const throw(INTERP_KERNEL::Exception)
6151 return self->repr();
6154 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6156 return self->buildDAAsciiChar(1,self->getNumberOfCompo());