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 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
544 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
545 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
546 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
549 void transpose() throw(INTERP_KERNEL::Exception);
550 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
551 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
554 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
555 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
556 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
557 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
558 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
559 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
560 double front() const throw(INTERP_KERNEL::Exception);
561 double back() const throw(INTERP_KERNEL::Exception);
562 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
563 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
564 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
565 double *getPointer() throw(INTERP_KERNEL::Exception);
566 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
567 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
568 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
569 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
570 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
571 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
572 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
573 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
574 double getAverageValue() const throw(INTERP_KERNEL::Exception);
575 double norm2() const throw(INTERP_KERNEL::Exception);
576 double normMax() const throw(INTERP_KERNEL::Exception);
577 double normMin() const throw(INTERP_KERNEL::Exception);
578 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
579 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
580 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
581 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
582 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
583 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
584 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
585 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
586 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
587 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
588 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
590 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
591 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
594 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
595 void abs() throw(INTERP_KERNEL::Exception);
596 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
597 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
598 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
599 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
600 void applyPow(double val) throw(INTERP_KERNEL::Exception);
601 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
606 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
609 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
610 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
611 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
612 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
613 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
614 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
615 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
616 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
617 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
618 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
619 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
620 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
621 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
622 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
623 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
624 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
625 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
626 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
627 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
628 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
631 DataArrayDouble() throw(INTERP_KERNEL::Exception)
633 return DataArrayDouble::New();
636 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
638 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)";
639 std::string msg(msgBase);
641 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
644 if(PyList_Check(elt0) || PyTuple_Check(elt0))
648 if(PyInt_Check(nbOfTuples))
650 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
652 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
655 if(PyInt_Check(elt2))
656 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
657 int nbOfCompo=PyInt_AS_LONG(elt2);
659 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
660 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
661 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
662 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
666 throw INTERP_KERNEL::Exception(msg.c_str());
669 {//DataArrayDouble.New([1.,3.,4.],3)
670 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
672 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
673 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
678 throw INTERP_KERNEL::Exception(msg.c_str());
681 {// DataArrayDouble.New([1.,3.,4.])
682 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
683 int tmpp1=-1,tmpp2=-1;
684 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
685 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
689 else if(PyInt_Check(elt0))
691 int nbOfTuples1=PyInt_AS_LONG(elt0);
693 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
698 if(PyInt_Check(nbOfTuples))
699 {//DataArrayDouble.New(5,2)
700 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
702 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
703 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
704 ret->alloc(nbOfTuples1,nbOfCompo);
708 throw INTERP_KERNEL::Exception(msg.c_str());
711 throw INTERP_KERNEL::Exception(msg.c_str());
714 {//DataArrayDouble.New(5)
715 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
716 ret->alloc(nbOfTuples1,1);
721 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
722 {//DataArrayDouble.New(numpyArray)
723 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
727 throw INTERP_KERNEL::Exception(msg.c_str());
728 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
731 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
733 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
736 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
739 std::vector<double> bb;
741 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
742 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
743 self->pushBackValsSilent(tmp,tmp+nbTuples);
746 std::string __repr__() const throw(INTERP_KERNEL::Exception)
748 std::ostringstream oss;
749 self->reprQuickOverview(oss);
753 std::string __str__() const throw(INTERP_KERNEL::Exception)
758 double __float__() const throw(INTERP_KERNEL::Exception)
760 return self->doubleValue();
763 int __len__() const throw(INTERP_KERNEL::Exception)
765 if(self->isAllocated())
767 return self->getNumberOfTuples();
771 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
775 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
777 return self->iterator();
780 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
782 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 !";
783 if(PyList_Check(li) || PyTuple_Check(li))
787 if(PyInt_Check(nbOfTuples))
789 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
791 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
794 if(PyInt_Check(nbOfComp))
795 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
796 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
798 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
799 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
800 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
803 throw INTERP_KERNEL::Exception(msg);
806 {//DataArrayDouble.setValues([1.,3.,4.],3)
808 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
809 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
813 throw INTERP_KERNEL::Exception(msg);
816 {// DataArrayDouble.setValues([1.,3.,4.])
817 int tmpp1=-1,tmpp2=-1;
818 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
819 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
823 throw INTERP_KERNEL::Exception(msg);
826 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
828 const double *vals=self->getConstPointer();
829 return convertDblArrToPyList(vals,self->getNbOfElems());
833 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
835 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
839 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
842 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
843 PyObject *ret=PyTuple_New(2);
844 PyObject *ret0Py=ret0?Py_True:Py_False;
846 PyTuple_SetItem(ret,0,ret0Py);
847 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
851 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
853 const double *vals=self->getConstPointer();
854 int nbOfComp=self->getNumberOfComponents();
855 int nbOfTuples=self->getNumberOfTuples();
856 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
859 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
862 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
863 if (!SWIG_IsOK(res1))
866 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
867 if(size!=self->getNumberOfTuples())
869 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
871 return self->renumber(tmp);
875 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
877 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
878 da2->checkAllocated();
879 int size=self->getNumberOfTuples();
880 if(size!=self->getNumberOfTuples())
882 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
884 return self->renumber(da2->getConstPointer());
888 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
891 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
892 if (!SWIG_IsOK(res1))
895 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
896 if(size!=self->getNumberOfTuples())
898 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
900 return self->renumberR(tmp);
904 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
906 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
907 da2->checkAllocated();
908 int size=self->getNumberOfTuples();
909 if(size!=self->getNumberOfTuples())
911 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
913 return self->renumberR(da2->getConstPointer());
917 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
920 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
921 if (!SWIG_IsOK(res1))
924 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
925 if(size!=self->getNumberOfTuples())
927 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
929 return self->renumberAndReduce(tmp,newNbOfTuple);
933 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
935 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
936 da2->checkAllocated();
937 int size=self->getNumberOfTuples();
938 if(size!=self->getNumberOfTuples())
940 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
942 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
946 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
948 int thisTupleId,otherTupleId;
949 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
950 PyObject *ret=PyTuple_New(3);
951 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
952 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
953 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
957 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
960 double r1=self->getMaxValue(tmp);
961 PyObject *ret=PyTuple_New(2);
962 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
963 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
967 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
970 double r1=self->getMaxValue2(tmp);
971 PyObject *ret=PyTuple_New(2);
972 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
973 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
977 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
980 double r1=self->getMinValue(tmp);
981 PyObject *ret=PyTuple_New(2);
982 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
983 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
987 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
990 double r1=self->getMinValue2(tmp);
991 PyObject *ret=PyTuple_New(2);
992 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
993 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
997 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
999 int nbOfCompo=self->getNumberOfComponents();
1000 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1001 self->getMinMaxPerComponent(tmp);
1002 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1006 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1008 int sz=self->getNumberOfComponents();
1009 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1010 self->accumulate(tmp);
1011 return convertDblArrToPyList(tmp,sz);
1014 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1017 std::vector<int> val2;
1018 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1019 return self->accumulatePerChunck(bg,bg+sz);
1022 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1024 DataArrayInt *comm, *commIndex;
1025 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1026 PyObject *res = PyList_New(2);
1027 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1028 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1032 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1036 DataArrayDoubleTuple *aa;
1037 std::vector<double> bb;
1039 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1040 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1042 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1043 PyObject *ret=PyTuple_New(2);
1044 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1045 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1049 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1051 std::vector<int> tmp;
1052 convertPyToNewIntArr3(li,tmp);
1053 self->setSelectedComponents(a,tmp);
1056 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1058 int sz=self->getNumberOfComponents();
1059 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1060 self->getTuple(tupleId,tmp);
1061 return convertDblArrToPyList(tmp,sz);
1064 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1066 std::vector<const DataArrayDouble *> tmp;
1067 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1068 return DataArrayDouble::Aggregate(tmp);
1071 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1073 std::vector<const DataArrayDouble *> tmp;
1074 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1075 return DataArrayDouble::Meld(tmp);
1078 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1082 DataArrayDoubleTuple *aa;
1083 std::vector<double> bb;
1085 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1086 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1087 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1088 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1089 DataArrayInt *c=0,*cI=0;
1090 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1091 PyObject *ret=PyTuple_New(2);
1092 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1093 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1097 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1099 DataArrayInt *ret1=0;
1100 bool ret0=self->areIncludedInMe(other,prec,ret1);
1101 PyObject *ret=PyTuple_New(2);
1102 PyObject *ret0Py=ret0?Py_True:Py_False;
1104 PyTuple_SetItem(ret,0,ret0Py);
1105 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1109 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1111 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1112 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1113 self->checkAllocated();
1114 int nbOfTuples=self->getNumberOfTuples();
1115 int nbOfComponents=self->getNumberOfComponents();
1117 std::vector<int> vt1,vc1;
1118 std::pair<int, std::pair<int,int> > pt1,pc1;
1119 DataArrayInt *dt1=0,*dc1=0;
1121 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1122 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1126 if(nbOfComponents==1)
1127 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1128 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1130 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1132 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1134 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1136 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1139 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1140 std::vector<int> v2(1,ic1);
1141 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1145 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1146 std::vector<int> v2(1,ic1);
1147 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1151 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1152 std::vector<int> v2(1,ic1);
1153 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1157 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1158 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1162 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1163 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1167 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1168 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1172 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1173 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1177 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1178 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1179 std::vector<int> v2(nbOfComp);
1180 for(int i=0;i<nbOfComp;i++)
1181 v2[i]=pc1.first+i*pc1.second.second;
1182 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1186 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1187 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1188 std::vector<int> v2(nbOfComp);
1189 for(int i=0;i<nbOfComp;i++)
1190 v2[i]=pc1.first+i*pc1.second.second;
1191 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1195 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1196 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1197 std::vector<int> v2(nbOfComp);
1198 for(int i=0;i<nbOfComp;i++)
1199 v2[i]=pc1.first+i*pc1.second.second;
1200 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1204 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1205 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1206 std::vector<int> v2(nbOfComp);
1207 for(int i=0;i<nbOfComp;i++)
1208 v2[i]=pc1.first+i*pc1.second.second;
1209 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1212 throw INTERP_KERNEL::Exception(msg);
1216 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1218 self->checkAllocated();
1219 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1220 int nbOfTuples=self->getNumberOfTuples();
1221 int nbOfComponents=self->getNumberOfComponents();
1224 std::vector<double> v1;
1225 DataArrayDouble *d1=0;
1226 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1228 std::vector<int> vt1,vc1;
1229 std::pair<int, std::pair<int,int> > pt1,pc1;
1230 DataArrayInt *dt1=0,*dc1=0;
1231 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1232 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1240 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1243 tmp=DataArrayDouble::New();
1244 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1245 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1248 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1251 throw INTERP_KERNEL::Exception(msg);
1260 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1263 tmp=DataArrayDouble::New();
1264 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1265 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1268 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1271 throw INTERP_KERNEL::Exception(msg);
1280 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1283 tmp=DataArrayDouble::New();
1284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1285 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1288 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1291 throw INTERP_KERNEL::Exception(msg);
1300 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1303 tmp=DataArrayDouble::New();
1304 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1305 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1308 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1311 throw INTERP_KERNEL::Exception(msg);
1320 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1323 tmp=DataArrayDouble::New();
1324 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1325 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1328 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1331 throw INTERP_KERNEL::Exception(msg);
1340 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1343 tmp=DataArrayDouble::New();
1344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1345 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1348 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1351 throw INTERP_KERNEL::Exception(msg);
1360 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1363 tmp=DataArrayDouble::New();
1364 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1365 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1368 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1371 throw INTERP_KERNEL::Exception(msg);
1380 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1383 tmp=DataArrayDouble::New();
1384 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1385 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1388 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1391 throw INTERP_KERNEL::Exception(msg);
1400 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1403 tmp=DataArrayDouble::New();
1404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1405 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1408 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1411 throw INTERP_KERNEL::Exception(msg);
1420 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1423 tmp=DataArrayDouble::New();
1424 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1425 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1428 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1431 throw INTERP_KERNEL::Exception(msg);
1440 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1443 tmp=DataArrayDouble::New();
1444 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1445 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1448 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1451 throw INTERP_KERNEL::Exception(msg);
1460 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1463 tmp=DataArrayDouble::New();
1464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1465 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1468 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1471 throw INTERP_KERNEL::Exception(msg);
1480 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1483 tmp=DataArrayDouble::New();
1484 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1485 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1488 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1491 throw INTERP_KERNEL::Exception(msg);
1500 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1503 tmp=DataArrayDouble::New();
1504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1505 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1508 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1511 throw INTERP_KERNEL::Exception(msg);
1520 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1523 tmp=DataArrayDouble::New();
1524 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1525 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1528 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1531 throw INTERP_KERNEL::Exception(msg);
1540 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1543 tmp=DataArrayDouble::New();
1544 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1545 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1548 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1551 throw INTERP_KERNEL::Exception(msg);
1556 throw INTERP_KERNEL::Exception(msg);
1561 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1563 return self->negate();
1566 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1568 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1571 DataArrayDoubleTuple *aa;
1572 std::vector<double> bb;
1575 #ifndef WITHOUT_AUTOFIELD
1577 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1579 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1582 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1583 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1585 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1588 throw INTERP_KERNEL::Exception(msg);
1592 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1597 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1598 ret->applyLin(1.,val);
1599 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1603 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1607 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1608 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1612 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1613 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1616 throw INTERP_KERNEL::Exception(msg);
1620 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1622 const char msg[]="Unexpected situation in __radd__ !";
1625 DataArrayDoubleTuple *aa;
1626 std::vector<double> bb;
1628 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1633 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1634 ret->applyLin(1.,val);
1639 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1640 return DataArrayDouble::Add(self,aaa);
1644 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1645 return DataArrayDouble::Add(self,aaa);
1648 throw INTERP_KERNEL::Exception(msg);
1652 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1654 const char msg[]="Unexpected situation in __iadd__ !";
1657 DataArrayDoubleTuple *aa;
1658 std::vector<double> bb;
1660 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1665 self->applyLin(1.,val);
1666 Py_XINCREF(trueSelf);
1672 Py_XINCREF(trueSelf);
1677 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1678 self->addEqual(aaa);
1679 Py_XINCREF(trueSelf);
1684 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1685 self->addEqual(aaa);
1686 Py_XINCREF(trueSelf);
1690 throw INTERP_KERNEL::Exception(msg);
1694 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1696 const char msg[]="Unexpected situation in __sub__ !";
1699 DataArrayDoubleTuple *aa;
1700 std::vector<double> bb;
1703 #ifndef WITHOUT_AUTOFIELD
1705 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1707 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1710 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1711 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1713 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1716 throw INTERP_KERNEL::Exception(msg);
1720 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1725 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1726 ret->applyLin(1.,-val);
1727 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1731 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1735 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1736 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1740 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1741 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1744 throw INTERP_KERNEL::Exception(msg);
1748 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1750 const char msg[]="Unexpected situation in __rsub__ !";
1753 DataArrayDoubleTuple *aa;
1754 std::vector<double> bb;
1756 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1761 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1762 ret->applyLin(-1.,val);
1767 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1768 return DataArrayDouble::Substract(aaa,self);
1772 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1773 return DataArrayDouble::Substract(aaa,self);
1776 throw INTERP_KERNEL::Exception(msg);
1780 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1782 const char msg[]="Unexpected situation in __isub__ !";
1785 DataArrayDoubleTuple *aa;
1786 std::vector<double> bb;
1788 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1793 self->applyLin(1,-val);
1794 Py_XINCREF(trueSelf);
1799 self->substractEqual(a);
1800 Py_XINCREF(trueSelf);
1805 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1806 self->substractEqual(aaa);
1807 Py_XINCREF(trueSelf);
1812 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1813 self->substractEqual(aaa);
1814 Py_XINCREF(trueSelf);
1818 throw INTERP_KERNEL::Exception(msg);
1822 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1824 const char msg[]="Unexpected situation in __mul__ !";
1827 DataArrayDoubleTuple *aa;
1828 std::vector<double> bb;
1831 #ifndef WITHOUT_AUTOFIELD
1833 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1835 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1838 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1839 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1841 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1844 throw INTERP_KERNEL::Exception(msg);
1848 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1853 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1854 ret->applyLin(val,0.);
1855 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1859 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1863 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1864 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1868 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1869 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1872 throw INTERP_KERNEL::Exception(msg);
1876 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1878 const char msg[]="Unexpected situation in __rmul__ !";
1881 DataArrayDoubleTuple *aa;
1882 std::vector<double> bb;
1884 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1890 ret->applyLin(val,0.);
1895 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1896 return DataArrayDouble::Multiply(self,aaa);
1900 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1901 return DataArrayDouble::Multiply(self,aaa);
1904 throw INTERP_KERNEL::Exception(msg);
1908 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1910 const char msg[]="Unexpected situation in __imul__ !";
1913 DataArrayDoubleTuple *aa;
1914 std::vector<double> bb;
1916 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1921 self->applyLin(val,0.);
1922 Py_XINCREF(trueSelf);
1927 self->multiplyEqual(a);
1928 Py_XINCREF(trueSelf);
1933 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1934 self->multiplyEqual(aaa);
1935 Py_XINCREF(trueSelf);
1940 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1941 self->multiplyEqual(aaa);
1942 Py_XINCREF(trueSelf);
1946 throw INTERP_KERNEL::Exception(msg);
1950 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1952 const char msg[]="Unexpected situation in __div__ !";
1955 DataArrayDoubleTuple *aa;
1956 std::vector<double> bb;
1959 #ifndef WITHOUT_AUTOFIELD
1961 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1963 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1966 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1967 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1969 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1972 throw INTERP_KERNEL::Exception(msg);
1976 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1982 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1983 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1984 ret->applyLin(1/val,0.);
1985 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1989 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1993 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1994 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1998 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1999 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2002 throw INTERP_KERNEL::Exception(msg);
2006 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2008 const char msg[]="Unexpected situation in __rdiv__ !";
2011 DataArrayDoubleTuple *aa;
2012 std::vector<double> bb;
2014 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2019 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2025 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2026 return DataArrayDouble::Divide(aaa,self);
2030 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2031 return DataArrayDouble::Divide(aaa,self);
2034 throw INTERP_KERNEL::Exception(msg);
2038 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2040 const char msg[]="Unexpected situation in __idiv__ !";
2043 DataArrayDoubleTuple *aa;
2044 std::vector<double> bb;
2046 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2052 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2053 self->applyLin(1./val,0.);
2054 Py_XINCREF(trueSelf);
2059 self->divideEqual(a);
2060 Py_XINCREF(trueSelf);
2065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2066 self->divideEqual(aaa);
2067 Py_XINCREF(trueSelf);
2072 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2073 self->divideEqual(aaa);
2074 Py_XINCREF(trueSelf);
2078 throw INTERP_KERNEL::Exception(msg);
2082 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2084 const char msg[]="Unexpected situation in __pow__ !";
2087 DataArrayDoubleTuple *aa;
2088 std::vector<double> bb;
2090 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2095 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2101 return DataArrayDouble::Pow(self,a);
2105 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2106 return DataArrayDouble::Pow(self,aaa);
2110 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2111 return DataArrayDouble::Pow(self,aaa);
2114 throw INTERP_KERNEL::Exception(msg);
2118 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2120 const char msg[]="Unexpected situation in __rpow__ !";
2123 DataArrayDoubleTuple *aa;
2124 std::vector<double> bb;
2126 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2131 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2132 ret->applyRPow(val);
2137 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2138 return DataArrayDouble::Pow(aaa,self);
2142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2143 return DataArrayDouble::Pow(aaa,self);
2146 throw INTERP_KERNEL::Exception(msg);
2150 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2152 const char msg[]="Unexpected situation in __ipow__ !";
2155 DataArrayDoubleTuple *aa;
2156 std::vector<double> bb;
2158 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2163 self->applyPow(val);
2164 Py_XINCREF(trueSelf);
2170 Py_XINCREF(trueSelf);
2175 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2176 self->powEqual(aaa);
2177 Py_XINCREF(trueSelf);
2182 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2183 self->powEqual(aaa);
2184 Py_XINCREF(trueSelf);
2188 throw INTERP_KERNEL::Exception(msg);
2192 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2194 DataArrayInt *c=0,*cI=0;
2196 self->computeTupleIdsNearTuples(other,eps,c,cI);
2197 PyObject *ret=PyTuple_New(2);
2198 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2199 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2203 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2205 DataArrayInt *ret1=0;
2206 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2207 PyObject *ret=PyTuple_New(2);
2208 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2209 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2216 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2217 if(!PyTuple_Check(args))
2218 throw INTERP_KERNEL::Exception(MSG);
2219 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2220 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2221 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2223 PyObject *tmp0(PyTuple_New(1));
2224 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2225 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2227 Py_DECREF(selfMeth);
2228 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2229 int sz(PyTuple_Size(args));
2231 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2232 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2233 PyObject *zeNumpyRepr(0);
2234 PyObject *tmp1(PyInt_FromLong(0));
2235 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2237 PyObject *tmp3(PyTuple_New(1));
2238 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2239 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2243 Py_DECREF(initMeth);
2247 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2250 if(!self->isAllocated())
2251 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2252 PyObject *ret(PyTuple_New(1));
2253 PyObject *ret0(PyDict_New());
2254 PyObject *numpyArryObj(ParaMEDMEM_DataArrayDouble_toNumPyArray(self));
2255 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2256 PyObject *tmp1(PyInt_FromLong(0));
2257 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2258 PyTuple_SetItem(ret,0,ret0);
2262 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2268 class DataArrayDoubleTuple;
2270 class DataArrayDoubleIterator
2273 DataArrayDoubleIterator(DataArrayDouble *da);
2274 ~DataArrayDoubleIterator();
2279 DataArrayDoubleTuple *ret=self->nextt();
2281 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2284 PyErr_SetString(PyExc_StopIteration,"No more data.");
2291 class DataArrayDoubleTuple
2294 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2295 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2298 std::string __str__() const throw(INTERP_KERNEL::Exception)
2300 return self->repr();
2303 double __float__() const throw(INTERP_KERNEL::Exception)
2305 return self->doubleValue();
2308 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2310 return self->buildDADouble(1,self->getNumberOfCompo());
2313 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2315 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2316 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2317 Py_XINCREF(trueSelf);
2321 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2323 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2324 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2325 Py_XINCREF(trueSelf);
2329 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2331 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2332 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2333 Py_XINCREF(trueSelf);
2337 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2339 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2340 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2341 Py_XINCREF(trueSelf);
2345 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2347 return PyInt_FromLong(self->getNumberOfCompo());
2350 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2352 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2355 std::vector<int> multiVal;
2356 std::pair<int, std::pair<int,int> > slic;
2357 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2358 const double *pt=self->getConstPointer();
2359 int nbc=self->getNumberOfCompo();
2360 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2367 std::ostringstream oss;
2368 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2369 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2373 return PyFloat_FromDouble(pt[singleVal]);
2377 return PyFloat_FromDouble(pt[nbc+singleVal]);
2380 std::ostringstream oss;
2381 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2382 throw INTERP_KERNEL::Exception(oss.str().c_str());
2388 PyObject *t=PyTuple_New(multiVal.size());
2389 for(int j=0;j<(int)multiVal.size();j++)
2391 int cid=multiVal[j];
2394 std::ostringstream oss;
2395 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2396 throw INTERP_KERNEL::Exception(oss.str().c_str());
2398 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2404 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2405 PyObject *t=PyTuple_New(sz);
2406 for(int j=0;j<sz;j++)
2407 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2411 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2415 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2417 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2418 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2421 std::vector<double> multiValV;
2422 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2423 int nbc=self->getNumberOfCompo();
2424 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2426 std::vector<int> multiVal;
2427 std::pair<int, std::pair<int,int> > slic;
2428 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2429 double *pt=self->getPointer();
2430 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2437 std::ostringstream oss;
2438 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2439 throw INTERP_KERNEL::Exception(oss.str().c_str());
2445 pt[singleVal]=singleValV;
2450 if(multiValV.size()!=1)
2452 std::ostringstream oss;
2453 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2454 throw INTERP_KERNEL::Exception(oss.str().c_str());
2456 pt[singleVal]=multiValV[0];
2461 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2465 throw INTERP_KERNEL::Exception(msg);
2474 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2478 std::ostringstream oss;
2479 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2480 throw INTERP_KERNEL::Exception(oss.str().c_str());
2488 if(multiVal.size()!=multiValV.size())
2490 std::ostringstream oss;
2491 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2492 throw INTERP_KERNEL::Exception(oss.str().c_str());
2494 for(int i=0;i<(int)multiVal.size();i++)
2496 int pos=multiVal[i];
2499 std::ostringstream oss;
2500 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2501 throw INTERP_KERNEL::Exception(oss.str().c_str());
2503 pt[multiVal[i]]=multiValV[i];
2509 const double *ptV=daIntTyyppV->getConstPointer();
2510 if(nbc>daIntTyyppV->getNumberOfCompo())
2512 std::ostringstream oss;
2513 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2514 throw INTERP_KERNEL::Exception(oss.str().c_str());
2516 std::copy(ptV,ptV+nbc,pt);
2520 throw INTERP_KERNEL::Exception(msg);
2525 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2530 for(int j=0;j<sz;j++)
2531 pt[slic.first+j*slic.second.second]=singleValV;
2536 if(sz!=(int)multiValV.size())
2538 std::ostringstream oss;
2539 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2540 throw INTERP_KERNEL::Exception(oss.str().c_str());
2542 for(int j=0;j<sz;j++)
2543 pt[slic.first+j*slic.second.second]=multiValV[j];
2548 const double *ptV=daIntTyyppV->getConstPointer();
2549 if(sz>daIntTyyppV->getNumberOfCompo())
2551 std::ostringstream oss;
2552 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2553 throw INTERP_KERNEL::Exception(oss.str().c_str());
2555 for(int j=0;j<sz;j++)
2556 pt[slic.first+j*slic.second.second]=ptV[j];
2560 throw INTERP_KERNEL::Exception(msg);
2564 throw INTERP_KERNEL::Exception(msg);
2570 class DataArrayIntIterator;
2572 class DataArrayInt : public DataArray
2575 static DataArrayInt *New();
2576 int intValue() const throw(INTERP_KERNEL::Exception);
2577 int getHashCode() const throw(INTERP_KERNEL::Exception);
2578 bool empty() const throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2580 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2581 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2582 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2583 int popBackSilent() throw(INTERP_KERNEL::Exception);
2584 void pack() const throw(INTERP_KERNEL::Exception);
2585 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2586 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2587 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2588 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2589 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2591 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2592 void reverse() throw(INTERP_KERNEL::Exception);
2593 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2594 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2595 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2596 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2597 void fillWithZero() throw(INTERP_KERNEL::Exception);
2598 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2599 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2600 void replaceOneValByInThis(int valToBeReplaced, int replacedBy) throw(INTERP_KERNEL::Exception);
2601 std::string repr() const throw(INTERP_KERNEL::Exception);
2602 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2603 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2604 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2605 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2606 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2607 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2608 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2609 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2610 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2611 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2612 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2613 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2614 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2615 void transpose() throw(INTERP_KERNEL::Exception);
2616 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2617 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2618 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2619 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2620 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2621 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2622 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2623 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2624 int front() const throw(INTERP_KERNEL::Exception);
2625 int back() const throw(INTERP_KERNEL::Exception);
2626 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2627 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2628 int *getPointer() throw(INTERP_KERNEL::Exception);
2629 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2630 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2631 const int *begin() const throw(INTERP_KERNEL::Exception);
2632 const int *end() const throw(INTERP_KERNEL::Exception);
2633 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2634 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2635 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2636 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2637 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2638 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2639 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2640 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2641 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2642 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2643 int count(int value) const throw(INTERP_KERNEL::Exception);
2644 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2645 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2646 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2647 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2648 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2649 void abs() throw(INTERP_KERNEL::Exception);
2650 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2651 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2652 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2653 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2654 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2655 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2656 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2657 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2658 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2659 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2660 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2661 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2662 DataArrayInt *getIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2663 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2664 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2665 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2666 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2667 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2668 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2669 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2670 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2671 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2672 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2673 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2675 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2677 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2678 void computeOffsets() throw(INTERP_KERNEL::Exception);
2679 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2680 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2681 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2682 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2683 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2684 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2685 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2686 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2687 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2688 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2689 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2690 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2691 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2692 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2693 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2694 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2695 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2696 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2697 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2699 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2702 DataArrayInt() throw(INTERP_KERNEL::Exception)
2704 return DataArrayInt::New();
2707 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2709 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)";
2710 std::string msg(msgBase);
2712 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2715 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2719 if(PyInt_Check(nbOfTuples))
2721 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2723 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2726 if(PyInt_Check(nbOfComp))
2727 {//DataArrayInt.New([1,3,4,5],2,2)
2728 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2730 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2731 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2732 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2733 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2737 throw INTERP_KERNEL::Exception(msg.c_str());
2740 {//DataArrayInt.New([1,3,4],3)
2741 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2743 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2744 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2749 throw INTERP_KERNEL::Exception(msg.c_str());
2752 {// DataArrayInt.New([1,3,4])
2753 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2754 int tmpp1=-1,tmpp2=-1;
2755 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2756 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2760 else if(PyInt_Check(elt0))
2762 int nbOfTuples1=PyInt_AS_LONG(elt0);
2764 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2769 if(PyInt_Check(nbOfTuples))
2770 {//DataArrayInt.New(5,2)
2771 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2773 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2774 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2775 ret->alloc(nbOfTuples1,nbOfCompo);
2779 throw INTERP_KERNEL::Exception(msg.c_str());
2782 throw INTERP_KERNEL::Exception(msg.c_str());
2785 {//DataArrayInt.New(5)
2786 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2787 ret->alloc(nbOfTuples1,1);
2792 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2793 {//DataArrayInt.New(numpyArray)
2794 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2798 throw INTERP_KERNEL::Exception(msg.c_str());
2799 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2802 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2804 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2807 std::string __str__() const throw(INTERP_KERNEL::Exception)
2809 return self->repr();
2812 int __len__() const throw(INTERP_KERNEL::Exception)
2814 if(self->isAllocated())
2816 return self->getNumberOfTuples();
2820 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2824 int __int__() const throw(INTERP_KERNEL::Exception)
2826 return self->intValue();
2829 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2831 return self->iterator();
2834 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2836 int sz=self->getNumberOfComponents();
2837 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2838 self->accumulate(tmp);
2839 return convertIntArrToPyList(tmp,sz);
2842 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2845 std::vector<int> val2;
2846 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2847 return self->accumulatePerChunck(bg,bg+sz);
2850 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2853 std::vector<int> val2;
2854 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2855 return self->getIdsEqualTuple(bg,bg+sz);
2858 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2860 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2861 PyObject *ret=PyList_New(slcs.size());
2862 for(std::size_t i=0;i<slcs.size();i++)
2863 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2867 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2869 if(!PySlice_Check(slic))
2870 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2871 Py_ssize_t strt=2,stp=2,step=2;
2872 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2873 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2874 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2875 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 !");
2876 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2879 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2882 self->getMinMaxValues(a,b);
2883 PyObject *ret=PyTuple_New(2);
2884 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2885 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2889 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2891 int newNbOfTuples=-1;
2892 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2893 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2894 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2895 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2896 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2897 PyObject *ret=PyTuple_New(2);
2898 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2899 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2903 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2905 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
2906 int szArr,sw,iTypppArr;
2907 std::vector<int> stdvecTyyppArr;
2908 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2909 int *pt(ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2910 ret->useArray(pt,true,ParaMEDMEM::C_DEALLOC,szArr,1);
2914 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2916 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 !";
2917 if(PyList_Check(li) || PyTuple_Check(li))
2921 if(PyInt_Check(nbOfTuples))
2923 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2925 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2928 if(PyInt_Check(nbOfComp))
2929 {//DataArrayInt.setValues([1,3,4,5],2,2)
2930 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2932 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2933 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2934 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2937 throw INTERP_KERNEL::Exception(msg);
2940 {//DataArrayInt.setValues([1,3,4],3)
2942 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2943 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2947 throw INTERP_KERNEL::Exception(msg);
2950 {// DataArrayInt.setValues([1,3,4])
2951 int tmpp1=-1,tmpp2=-1;
2952 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2953 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2957 throw INTERP_KERNEL::Exception(msg);
2960 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2962 const int *vals=self->getConstPointer();
2963 return convertIntArrToPyList(vals,self->getNbOfElems());
2967 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2969 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2973 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2976 bool ret0=self->isEqualIfNotWhy(other,ret1);
2977 PyObject *ret=PyTuple_New(2);
2978 PyObject *ret0Py=ret0?Py_True:Py_False;
2980 PyTuple_SetItem(ret,0,ret0Py);
2981 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2985 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2987 const int *vals=self->getConstPointer();
2988 int nbOfComp=self->getNumberOfComponents();
2989 int nbOfTuples=self->getNumberOfTuples();
2990 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2993 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2995 std::vector<const DataArrayInt *> groups;
2996 std::vector< std::vector<int> > fidsOfGroups;
2997 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2998 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2999 PyObject *ret = PyList_New(2);
3000 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3001 int sz=fidsOfGroups.size();
3002 PyObject *ret1 = PyList_New(sz);
3003 for(int i=0;i<sz;i++)
3004 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3005 PyList_SetItem(ret,1,ret1);
3009 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3012 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3013 if (!SWIG_IsOK(res1))
3016 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3017 self->transformWithIndArr(tmp,tmp+size);
3021 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3022 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3026 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3030 std::vector<int> multiVal;
3031 std::pair<int, std::pair<int,int> > slic;
3032 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3033 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3037 return self->getIdsEqualList(&singleVal,&singleVal+1);
3039 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3041 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3043 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3047 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3051 std::vector<int> multiVal;
3052 std::pair<int, std::pair<int,int> > slic;
3053 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3054 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3058 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
3060 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3062 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3064 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3068 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3070 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3072 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3073 if (!SWIG_IsOK(res1))
3076 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3077 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3081 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3083 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3084 da2->checkAllocated();
3085 int size=self->getNumberOfTuples();
3086 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
3088 PyObject *ret = PyList_New(3);
3089 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3090 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3091 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3095 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3098 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3099 if (!SWIG_IsOK(res1))
3102 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3103 return self->transformWithIndArrR(tmp,tmp+size);
3107 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3108 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3112 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3115 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3116 if (!SWIG_IsOK(res1))
3119 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3120 if(size!=self->getNumberOfTuples())
3122 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3124 return self->renumberAndReduce(tmp,newNbOfTuple);
3128 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3130 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3131 da2->checkAllocated();
3132 int size=self->getNumberOfTuples();
3133 if(size!=self->getNumberOfTuples())
3135 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3137 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3141 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3144 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3145 if (!SWIG_IsOK(res1))
3148 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3149 if(size!=self->getNumberOfTuples())
3151 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3153 return self->renumber(tmp);
3157 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3159 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3160 da2->checkAllocated();
3161 int size=self->getNumberOfTuples();
3162 if(size!=self->getNumberOfTuples())
3164 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3166 return self->renumber(da2->getConstPointer());
3170 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3173 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3174 if (!SWIG_IsOK(res1))
3177 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3178 if(size!=self->getNumberOfTuples())
3180 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3182 return self->renumberR(tmp);
3186 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3188 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3189 da2->checkAllocated();
3190 int size=self->getNumberOfTuples();
3191 if(size!=self->getNumberOfTuples())
3193 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3195 return self->renumberR(da2->getConstPointer());
3199 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3201 std::vector<int> tmp;
3202 convertPyToNewIntArr3(li,tmp);
3203 self->setSelectedComponents(a,tmp);
3206 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3208 int sz=self->getNumberOfComponents();
3209 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3210 self->getTuple(tupleId,tmp);
3211 return convertIntArrToPyList(tmp,sz);
3214 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3216 DataArrayInt *arr=0;
3217 DataArrayInt *arrI=0;
3218 self->changeSurjectiveFormat(targetNb,arr,arrI);
3219 PyObject *res = PyList_New(2);
3220 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3221 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3225 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3227 std::vector<const DataArrayInt *> tmp;
3228 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3229 return DataArrayInt::Meld(tmp);
3232 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3234 std::vector<const DataArrayInt *> tmp;
3235 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3236 return DataArrayInt::Aggregate(tmp);
3239 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3241 std::vector<const DataArrayInt *> tmp;
3242 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3243 return DataArrayInt::AggregateIndexes(tmp);
3246 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3248 std::vector<const DataArrayInt *> tmp;
3249 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3250 return DataArrayInt::BuildUnion(tmp);
3253 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3255 std::vector<const DataArrayInt *> tmp;
3256 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3257 return DataArrayInt::BuildIntersection(tmp);
3260 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3263 int r1=self->getMaxValue(tmp);
3264 PyObject *ret=PyTuple_New(2);
3265 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3266 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3270 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3273 int r1=self->getMinValue(tmp);
3274 PyObject *ret=PyTuple_New(2);
3275 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3276 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3280 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3282 int nbOfCompo=self->getNumberOfComponents();
3287 if(PyInt_Check(obj))
3289 int val=(int)PyInt_AS_LONG(obj);
3290 return self->locateValue(val);
3293 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3297 std::vector<int> arr;
3298 convertPyToNewIntArr3(obj,arr);
3299 return self->locateTuple(arr);
3304 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3306 int nbOfCompo=self->getNumberOfComponents();
3313 if(PyInt_Check(obj))
3315 int val=(int)PyInt_AS_LONG(obj);
3316 return self->presenceOfValue(val);
3319 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3323 std::vector<int> arr;
3324 convertPyToNewIntArr3(obj,arr);
3325 return self->presenceOfTuple(arr);
3330 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3332 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3333 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3334 self->checkAllocated();
3335 int nbOfTuples=self->getNumberOfTuples();
3336 int nbOfComponents=self->getNumberOfComponents();
3338 std::vector<int> vt1,vc1;
3339 std::pair<int, std::pair<int,int> > pt1,pc1;
3340 DataArrayInt *dt1=0,*dc1=0;
3342 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3343 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3348 if(nbOfComponents==1)
3349 return PyInt_FromLong(self->getIJSafe(it1,0));
3350 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3353 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3355 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3357 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3359 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3362 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3363 std::vector<int> v2(1,ic1);
3364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3368 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3369 std::vector<int> v2(1,ic1);
3370 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3374 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3375 std::vector<int> v2(1,ic1);
3376 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3380 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3381 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3385 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3386 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3390 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3391 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3395 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3396 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3400 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3401 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3402 std::vector<int> v2(nbOfComp);
3403 for(int i=0;i<nbOfComp;i++)
3404 v2[i]=pc1.first+i*pc1.second.second;
3405 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3409 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3410 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3411 std::vector<int> v2(nbOfComp);
3412 for(int i=0;i<nbOfComp;i++)
3413 v2[i]=pc1.first+i*pc1.second.second;
3414 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3418 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3419 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3420 std::vector<int> v2(nbOfComp);
3421 for(int i=0;i<nbOfComp;i++)
3422 v2[i]=pc1.first+i*pc1.second.second;
3423 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3427 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3428 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3429 std::vector<int> v2(nbOfComp);
3430 for(int i=0;i<nbOfComp;i++)
3431 v2[i]=pc1.first+i*pc1.second.second;
3432 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3435 throw INTERP_KERNEL::Exception(msg);
3439 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3441 self->checkAllocated();
3442 const char msg[]="Unexpected situation in __setitem__ !";
3443 int nbOfTuples=self->getNumberOfTuples();
3444 int nbOfComponents=self->getNumberOfComponents();
3447 std::vector<int> v1;
3449 DataArrayIntTuple *dd1=0;
3450 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3452 std::vector<int> vt1,vc1;
3453 std::pair<int, std::pair<int,int> > pt1,pc1;
3454 DataArrayInt *dt1=0,*dc1=0;
3455 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3456 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3464 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3467 tmp=DataArrayInt::New();
3468 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3469 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3472 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3475 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3476 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3479 throw INTERP_KERNEL::Exception(msg);
3488 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3491 tmp=DataArrayInt::New();
3492 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3493 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3496 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3499 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3500 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3503 throw INTERP_KERNEL::Exception(msg);
3512 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3515 tmp=DataArrayInt::New();
3516 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3517 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3520 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3523 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3524 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3527 throw INTERP_KERNEL::Exception(msg);
3536 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3539 tmp=DataArrayInt::New();
3540 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3541 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3544 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3547 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3548 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3551 throw INTERP_KERNEL::Exception(msg);
3560 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3563 tmp=DataArrayInt::New();
3564 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3565 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3568 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3571 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3572 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3575 throw INTERP_KERNEL::Exception(msg);
3584 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3587 tmp=DataArrayInt::New();
3588 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3589 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3592 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3595 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3596 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3599 throw INTERP_KERNEL::Exception(msg);
3608 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3611 tmp=DataArrayInt::New();
3612 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3613 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3616 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3619 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3620 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3623 throw INTERP_KERNEL::Exception(msg);
3632 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3635 tmp=DataArrayInt::New();
3636 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3637 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3640 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3643 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3644 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3647 throw INTERP_KERNEL::Exception(msg);
3656 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3659 tmp=DataArrayInt::New();
3660 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3661 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3664 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3667 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3668 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3671 throw INTERP_KERNEL::Exception(msg);
3680 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3683 tmp=DataArrayInt::New();
3684 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3685 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3688 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3691 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3692 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3695 throw INTERP_KERNEL::Exception(msg);
3704 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3707 tmp=DataArrayInt::New();
3708 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3709 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3712 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3715 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3716 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3719 throw INTERP_KERNEL::Exception(msg);
3728 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3731 tmp=DataArrayInt::New();
3732 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3733 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3736 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3739 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3740 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3743 throw INTERP_KERNEL::Exception(msg);
3752 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3755 tmp=DataArrayInt::New();
3756 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3757 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3760 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3763 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3764 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3767 throw INTERP_KERNEL::Exception(msg);
3776 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3779 tmp=DataArrayInt::New();
3780 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3781 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3784 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3787 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3788 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3791 throw INTERP_KERNEL::Exception(msg);
3800 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3803 tmp=DataArrayInt::New();
3804 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3805 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3808 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3811 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3812 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3815 throw INTERP_KERNEL::Exception(msg);
3824 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3827 tmp=DataArrayInt::New();
3828 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3829 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3832 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3835 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3836 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3839 throw INTERP_KERNEL::Exception(msg);
3844 throw INTERP_KERNEL::Exception(msg);
3849 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3851 return self->negate();
3854 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3856 const char msg[]="Unexpected situation in __add__ !";
3859 std::vector<int> aa;
3860 DataArrayIntTuple *aaa;
3862 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3867 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3868 ret->applyLin(1,val);
3873 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3874 return DataArrayInt::Add(self,aaaa);
3878 return DataArrayInt::Add(self,a);
3882 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3883 return DataArrayInt::Add(self,aaaa);
3886 throw INTERP_KERNEL::Exception(msg);
3890 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3892 const char msg[]="Unexpected situation in __radd__ !";
3895 std::vector<int> aa;
3896 DataArrayIntTuple *aaa;
3898 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3903 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3904 ret->applyLin(1,val);
3909 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3910 return DataArrayInt::Add(self,aaaa);
3914 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3915 return DataArrayInt::Add(self,aaaa);
3918 throw INTERP_KERNEL::Exception(msg);
3922 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3924 const char msg[]="Unexpected situation in __iadd__ !";
3927 std::vector<int> aa;
3928 DataArrayIntTuple *aaa;
3930 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3935 self->applyLin(1,val);
3936 Py_XINCREF(trueSelf);
3941 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3943 Py_XINCREF(trueSelf);
3949 Py_XINCREF(trueSelf);
3954 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3955 self->addEqual(aaaa);
3956 Py_XINCREF(trueSelf);
3960 throw INTERP_KERNEL::Exception(msg);
3964 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3966 const char msg[]="Unexpected situation in __sub__ !";
3969 std::vector<int> aa;
3970 DataArrayIntTuple *aaa;
3972 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3977 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3978 ret->applyLin(1,-val);
3983 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3984 return DataArrayInt::Substract(self,aaaa);
3988 return DataArrayInt::Substract(self,a);
3992 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3993 return DataArrayInt::Substract(self,aaaa);
3996 throw INTERP_KERNEL::Exception(msg);
4000 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4002 const char msg[]="Unexpected situation in __rsub__ !";
4005 std::vector<int> aa;
4006 DataArrayIntTuple *aaa;
4008 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4013 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4014 ret->applyLin(-1,val);
4019 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4020 return DataArrayInt::Substract(aaaa,self);
4024 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4025 return DataArrayInt::Substract(aaaa,self);
4028 throw INTERP_KERNEL::Exception(msg);
4032 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4034 const char msg[]="Unexpected situation in __isub__ !";
4037 std::vector<int> aa;
4038 DataArrayIntTuple *aaa;
4040 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4045 self->applyLin(1,-val);
4046 Py_XINCREF(trueSelf);
4051 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4052 self->substractEqual(bb);
4053 Py_XINCREF(trueSelf);
4058 self->substractEqual(a);
4059 Py_XINCREF(trueSelf);
4064 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4065 self->substractEqual(aaaa);
4066 Py_XINCREF(trueSelf);
4070 throw INTERP_KERNEL::Exception(msg);
4074 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4076 const char msg[]="Unexpected situation in __mul__ !";
4079 std::vector<int> aa;
4080 DataArrayIntTuple *aaa;
4082 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4087 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4088 ret->applyLin(val,0);
4093 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4094 return DataArrayInt::Multiply(self,aaaa);
4098 return DataArrayInt::Multiply(self,a);
4102 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4103 return DataArrayInt::Multiply(self,aaaa);
4106 throw INTERP_KERNEL::Exception(msg);
4110 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4112 const char msg[]="Unexpected situation in __rmul__ !";
4115 std::vector<int> aa;
4116 DataArrayIntTuple *aaa;
4118 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4123 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4124 ret->applyLin(val,0);
4129 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4130 return DataArrayInt::Multiply(self,aaaa);
4134 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4135 return DataArrayInt::Multiply(self,aaaa);
4138 throw INTERP_KERNEL::Exception(msg);
4142 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4144 const char msg[]="Unexpected situation in __imul__ !";
4147 std::vector<int> aa;
4148 DataArrayIntTuple *aaa;
4150 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4155 self->applyLin(val,0);
4156 Py_XINCREF(trueSelf);
4161 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4162 self->multiplyEqual(bb);
4163 Py_XINCREF(trueSelf);
4168 self->multiplyEqual(a);
4169 Py_XINCREF(trueSelf);
4174 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4175 self->multiplyEqual(aaaa);
4176 Py_XINCREF(trueSelf);
4180 throw INTERP_KERNEL::Exception(msg);
4184 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4186 const char msg[]="Unexpected situation in __div__ !";
4189 std::vector<int> aa;
4190 DataArrayIntTuple *aaa;
4192 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4197 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4198 ret->applyDivideBy(val);
4203 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4204 return DataArrayInt::Divide(self,aaaa);
4208 return DataArrayInt::Divide(self,a);
4212 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4213 return DataArrayInt::Divide(self,aaaa);
4216 throw INTERP_KERNEL::Exception(msg);
4220 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4222 const char msg[]="Unexpected situation in __rdiv__ !";
4225 std::vector<int> aa;
4226 DataArrayIntTuple *aaa;
4228 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4233 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4239 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4240 return DataArrayInt::Divide(aaaa,self);
4244 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4245 return DataArrayInt::Divide(aaaa,self);
4248 throw INTERP_KERNEL::Exception(msg);
4252 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4254 const char msg[]="Unexpected situation in __idiv__ !";
4257 std::vector<int> aa;
4258 DataArrayIntTuple *aaa;
4260 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4265 self->applyDivideBy(val);
4266 Py_XINCREF(trueSelf);
4271 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4272 self->divideEqual(bb);
4273 Py_XINCREF(trueSelf);
4278 self->divideEqual(a);
4279 Py_XINCREF(trueSelf);
4284 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4285 self->divideEqual(aaaa);
4286 Py_XINCREF(trueSelf);
4290 throw INTERP_KERNEL::Exception(msg);
4294 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4296 const char msg[]="Unexpected situation in __mod__ !";
4299 std::vector<int> aa;
4300 DataArrayIntTuple *aaa;
4302 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4307 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4308 ret->applyModulus(val);
4313 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4314 return DataArrayInt::Modulus(self,aaaa);
4318 return DataArrayInt::Modulus(self,a);
4322 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4323 return DataArrayInt::Modulus(self,aaaa);
4326 throw INTERP_KERNEL::Exception(msg);
4330 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4332 const char msg[]="Unexpected situation in __rmod__ !";
4335 std::vector<int> aa;
4336 DataArrayIntTuple *aaa;
4338 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4343 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4344 ret->applyRModulus(val);
4349 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4350 return DataArrayInt::Modulus(aaaa,self);
4354 return DataArrayInt::Modulus(a,self);
4358 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4359 return DataArrayInt::Modulus(aaaa,self);
4362 throw INTERP_KERNEL::Exception(msg);
4366 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4368 const char msg[]="Unexpected situation in __imod__ !";
4371 std::vector<int> aa;
4372 DataArrayIntTuple *aaa;
4374 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4379 self->applyModulus(val);
4380 Py_XINCREF(trueSelf);
4385 self->modulusEqual(a);
4386 Py_XINCREF(trueSelf);
4391 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4392 self->modulusEqual(aaaa);
4393 Py_XINCREF(trueSelf);
4397 throw INTERP_KERNEL::Exception(msg);
4401 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4403 const char msg[]="Unexpected situation in __pow__ !";
4406 std::vector<int> aa;
4407 DataArrayIntTuple *aaa;
4409 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4414 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4420 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4421 return DataArrayInt::Pow(self,aaaa);
4425 return DataArrayInt::Pow(self,a);
4429 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4430 return DataArrayInt::Pow(self,aaaa);
4433 throw INTERP_KERNEL::Exception(msg);
4437 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4439 const char msg[]="Unexpected situation in __rpow__ !";
4442 std::vector<int> aa;
4443 DataArrayIntTuple *aaa;
4445 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4450 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4451 ret->applyRPow(val);
4456 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4457 return DataArrayInt::Pow(aaaa,self);
4461 return DataArrayInt::Pow(a,self);
4465 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4466 return DataArrayInt::Pow(aaaa,self);
4469 throw INTERP_KERNEL::Exception(msg);
4473 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4475 const char msg[]="Unexpected situation in __ipow__ !";
4478 std::vector<int> aa;
4479 DataArrayIntTuple *aaa;
4481 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4486 self->applyPow(val);
4487 Py_XINCREF(trueSelf);
4493 Py_XINCREF(trueSelf);
4498 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4499 self->powEqual(aaaa);
4500 Py_XINCREF(trueSelf);
4504 throw INTERP_KERNEL::Exception(msg);
4508 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4510 std::ostringstream oss;
4511 self->reprQuickOverview(oss);
4515 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4517 int szArr,sw,iTypppArr;
4518 std::vector<int> stdvecTyyppArr;
4519 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4520 self->pushBackValsSilent(tmp,tmp+szArr);
4523 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4525 std::vector<int> ret1;
4526 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4527 std::size_t sz=ret0.size();
4528 PyObject *pyRet=PyTuple_New(2);
4529 PyObject *pyRet0=PyList_New((int)sz);
4530 PyObject *pyRet1=PyList_New((int)sz);
4531 for(std::size_t i=0;i<sz;i++)
4533 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4534 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4536 PyTuple_SetItem(pyRet,0,pyRet0);
4537 PyTuple_SetItem(pyRet,1,pyRet1);
4541 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4543 DataArrayInt *ret0=0,*ret1=0;
4544 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4545 PyObject *pyRet=PyTuple_New(2);
4546 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4547 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4551 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4554 bool ret(self->isRange(a,b,c));
4555 PyObject *pyRet=PyTuple_New(2);
4556 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4558 PyTuple_SetItem(pyRet,0,ret0Py);
4560 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4566 PyTuple_SetItem(pyRet,1,ret1Py);
4571 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4573 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4574 if(!PyTuple_Check(args))
4575 throw INTERP_KERNEL::Exception(MSG);
4576 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4577 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4578 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4580 PyObject *tmp0(PyTuple_New(1));
4581 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4582 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4584 Py_DECREF(selfMeth);
4585 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4586 int sz(PyTuple_Size(args));
4588 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4589 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4590 PyObject *zeNumpyRepr(0);
4591 PyObject *tmp1(PyInt_FromLong(0));
4592 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4594 PyObject *tmp3(PyTuple_New(1));
4595 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4596 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4600 Py_DECREF(initMeth);
4604 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4607 if(!self->isAllocated())
4608 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4609 PyObject *ret(PyTuple_New(1));
4610 PyObject *ret0(PyDict_New());
4611 PyObject *numpyArryObj(ParaMEDMEM_DataArrayInt_toNumPyArray(self));
4612 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4613 PyObject *tmp1(PyInt_FromLong(0));
4614 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4615 PyTuple_SetItem(ret,0,ret0);
4619 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4625 class DataArrayIntTuple;
4627 class DataArrayIntIterator
4630 DataArrayIntIterator(DataArrayInt *da);
4631 ~DataArrayIntIterator();
4636 DataArrayIntTuple *ret=self->nextt();
4638 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4641 PyErr_SetString(PyExc_StopIteration,"No more data.");
4648 class DataArrayIntTuple
4651 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4652 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4655 std::string __str__() const throw(INTERP_KERNEL::Exception)
4657 return self->repr();
4660 int __int__() const throw(INTERP_KERNEL::Exception)
4662 return self->intValue();
4665 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4667 return self->buildDAInt(1,self->getNumberOfCompo());
4670 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4672 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4673 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4674 Py_XINCREF(trueSelf);
4678 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4680 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4681 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4682 Py_XINCREF(trueSelf);
4686 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4689 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4690 Py_XINCREF(trueSelf);
4694 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4696 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4697 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4698 Py_XINCREF(trueSelf);
4702 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4704 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4705 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4706 Py_XINCREF(trueSelf);
4710 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4712 return PyInt_FromLong(self->getNumberOfCompo());
4715 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4717 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4720 std::vector<int> multiVal;
4721 std::pair<int, std::pair<int,int> > slic;
4722 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4723 const int *pt=self->getConstPointer();
4724 int nbc=self->getNumberOfCompo();
4725 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4732 std::ostringstream oss;
4733 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4734 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4738 return PyInt_FromLong(pt[singleVal]);
4742 return PyInt_FromLong(pt[nbc+singleVal]);
4745 std::ostringstream oss;
4746 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4747 throw INTERP_KERNEL::Exception(oss.str().c_str());
4753 PyObject *t=PyTuple_New(multiVal.size());
4754 for(int j=0;j<(int)multiVal.size();j++)
4756 int cid=multiVal[j];
4759 std::ostringstream oss;
4760 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4761 throw INTERP_KERNEL::Exception(oss.str().c_str());
4763 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4769 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4770 PyObject *t=PyTuple_New(sz);
4771 for(int j=0;j<sz;j++)
4772 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4776 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4780 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4782 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4783 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4786 std::vector<int> multiValV;
4787 std::pair<int, std::pair<int,int> > slicV;
4788 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4789 int nbc=self->getNumberOfCompo();
4790 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4792 std::vector<int> multiVal;
4793 std::pair<int, std::pair<int,int> > slic;
4794 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4795 int *pt=self->getPointer();
4796 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4803 std::ostringstream oss;
4804 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4805 throw INTERP_KERNEL::Exception(oss.str().c_str());
4811 pt[singleVal]=singleValV;
4816 if(multiValV.size()!=1)
4818 std::ostringstream oss;
4819 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4820 throw INTERP_KERNEL::Exception(oss.str().c_str());
4822 pt[singleVal]=multiValV[0];
4827 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4831 throw INTERP_KERNEL::Exception(msg);
4840 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4844 std::ostringstream oss;
4845 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4846 throw INTERP_KERNEL::Exception(oss.str().c_str());
4854 if(multiVal.size()!=multiValV.size())
4856 std::ostringstream oss;
4857 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4858 throw INTERP_KERNEL::Exception(oss.str().c_str());
4860 for(int i=0;i<(int)multiVal.size();i++)
4862 int pos=multiVal[i];
4865 std::ostringstream oss;
4866 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4867 throw INTERP_KERNEL::Exception(oss.str().c_str());
4869 pt[multiVal[i]]=multiValV[i];
4875 const int *ptV=daIntTyyppV->getConstPointer();
4876 if(nbc>daIntTyyppV->getNumberOfCompo())
4878 std::ostringstream oss;
4879 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4880 throw INTERP_KERNEL::Exception(oss.str().c_str());
4882 std::copy(ptV,ptV+nbc,pt);
4886 throw INTERP_KERNEL::Exception(msg);
4891 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4896 for(int j=0;j<sz;j++)
4897 pt[slic.first+j*slic.second.second]=singleValV;
4902 if(sz!=(int)multiValV.size())
4904 std::ostringstream oss;
4905 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4906 throw INTERP_KERNEL::Exception(oss.str().c_str());
4908 for(int j=0;j<sz;j++)
4909 pt[slic.first+j*slic.second.second]=multiValV[j];
4914 const int *ptV=daIntTyyppV->getConstPointer();
4915 if(sz>daIntTyyppV->getNumberOfCompo())
4917 std::ostringstream oss;
4918 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4919 throw INTERP_KERNEL::Exception(oss.str().c_str());
4921 for(int j=0;j<sz;j++)
4922 pt[slic.first+j*slic.second.second]=ptV[j];
4926 throw INTERP_KERNEL::Exception(msg);
4930 throw INTERP_KERNEL::Exception(msg);
4936 class DataArrayChar : public DataArray
4939 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4940 int getHashCode() const throw(INTERP_KERNEL::Exception);
4941 bool empty() const throw(INTERP_KERNEL::Exception);
4942 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4943 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4944 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4945 char popBackSilent() throw(INTERP_KERNEL::Exception);
4946 void pack() const throw(INTERP_KERNEL::Exception);
4947 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4948 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4949 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4950 void reverse() throw(INTERP_KERNEL::Exception);
4951 void fillWithZero() throw(INTERP_KERNEL::Exception);
4952 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4953 std::string repr() const throw(INTERP_KERNEL::Exception);
4954 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4955 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4956 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4957 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4958 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4959 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4960 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4961 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4962 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4963 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4964 char front() const throw(INTERP_KERNEL::Exception);
4965 char back() const throw(INTERP_KERNEL::Exception);
4966 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4967 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4968 char *getPointer() throw(INTERP_KERNEL::Exception);
4969 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4970 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4971 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4972 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4973 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4974 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4975 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4976 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4977 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4978 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4979 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4982 int __len__() const throw(INTERP_KERNEL::Exception)
4984 if(self->isAllocated())
4986 return self->getNumberOfTuples();
4990 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4994 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4997 bool ret0=self->isEqualIfNotWhy(other,ret1);
4998 PyObject *ret=PyTuple_New(2);
4999 PyObject *ret0Py=ret0?Py_True:Py_False;
5001 PyTuple_SetItem(ret,0,ret0Py);
5002 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5006 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5009 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5010 if (!SWIG_IsOK(res1))
5013 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5014 if(size!=self->getNumberOfTuples())
5016 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5018 return self->renumber(tmp);
5022 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5024 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5025 da2->checkAllocated();
5026 int size=self->getNumberOfTuples();
5027 if(size!=self->getNumberOfTuples())
5029 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5031 return self->renumber(da2->getConstPointer());
5035 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5038 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5039 if (!SWIG_IsOK(res1))
5042 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5043 if(size!=self->getNumberOfTuples())
5045 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5047 return self->renumberR(tmp);
5051 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5053 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5054 da2->checkAllocated();
5055 int size=self->getNumberOfTuples();
5056 if(size!=self->getNumberOfTuples())
5058 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5060 return self->renumberR(da2->getConstPointer());
5064 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5067 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5068 if (!SWIG_IsOK(res1))
5071 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5072 if(size!=self->getNumberOfTuples())
5074 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5076 return self->renumberAndReduce(tmp,newNbOfTuple);
5080 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5082 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5083 da2->checkAllocated();
5084 int size=self->getNumberOfTuples();
5085 if(size!=self->getNumberOfTuples())
5087 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5089 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5093 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5095 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5096 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5097 return DataArrayChar::Aggregate(tmp);
5100 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5102 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5103 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5104 return DataArrayChar::Meld(tmp);
5109 class DataArrayByteIterator;
5111 class DataArrayByte : public DataArrayChar
5114 static DataArrayByte *New();
5115 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5116 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5117 char byteValue() const throw(INTERP_KERNEL::Exception);
5120 DataArrayByte() throw(INTERP_KERNEL::Exception)
5122 return DataArrayByte::New();
5125 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5127 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) !";
5128 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5132 if(PyInt_Check(nbOfTuples))
5134 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5136 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5139 if(PyInt_Check(nbOfComp))
5140 {//DataArrayByte.New([1,3,4,5],2,2)
5141 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5143 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5144 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5145 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5146 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5150 throw INTERP_KERNEL::Exception(msg);
5153 {//DataArrayByte.New([1,3,4],3)
5154 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5156 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5157 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5162 throw INTERP_KERNEL::Exception(msg);
5165 {// DataArrayByte.New([1,3,4])
5166 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5167 int tmpp1=-1,tmpp2=-1;
5168 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5169 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5173 else if(PyInt_Check(elt0))
5175 int nbOfTuples1=PyInt_AS_LONG(elt0);
5177 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5182 if(PyInt_Check(nbOfTuples))
5183 {//DataArrayByte.New(5,2)
5184 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5186 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5187 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5188 ret->alloc(nbOfTuples1,nbOfCompo);
5192 throw INTERP_KERNEL::Exception(msg);
5195 throw INTERP_KERNEL::Exception(msg);
5198 {//DataArrayByte.New(5)
5199 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5200 ret->alloc(nbOfTuples1,1);
5205 throw INTERP_KERNEL::Exception(msg);
5208 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5210 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5213 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5215 std::ostringstream oss;
5216 self->reprQuickOverview(oss);
5220 int __int__() const throw(INTERP_KERNEL::Exception)
5222 return (int) self->byteValue();
5225 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5227 return self->iterator();
5230 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5232 return (int)self->getIJ(tupleId,compoId);
5235 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5237 return (int)self->getIJSafe(tupleId,compoId);
5240 std::string __str__() const throw(INTERP_KERNEL::Exception)
5242 return self->repr();
5245 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5247 const char *vals=self->getConstPointer();
5248 int nbOfComp=self->getNumberOfComponents();
5249 int nbOfTuples=self->getNumberOfTuples();
5250 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5253 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5256 int ival=-1; std::vector<int> ivval;
5257 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5258 std::vector<char> vals(sz);
5259 std::copy(pt,pt+sz,vals.begin());
5260 return self->presenceOfTuple(vals);
5263 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5266 int ival=-1; std::vector<int> ivval;
5267 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5268 std::vector<char> vals2(sz);
5269 std::copy(pt,pt+sz,vals2.begin());
5270 return self->presenceOfValue(vals2);
5273 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5276 int ival=-1; std::vector<int> ivval;
5277 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5278 std::vector<char> vals2(sz);
5279 std::copy(pt,pt+sz,vals2.begin());
5280 return self->locateValue(vals2);
5283 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5286 int ival=-1; std::vector<int> ivval;
5287 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5288 std::vector<char> vals(sz);
5289 std::copy(pt,pt+sz,vals.begin());
5290 return self->locateTuple(vals);
5293 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5296 int ival=-1; std::vector<int> ivval;
5297 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5298 std::vector<char> vals(sz);
5299 std::copy(pt,pt+sz,vals.begin());
5300 return self->search(vals);
5303 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5305 int sz=self->getNumberOfComponents();
5306 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5307 self->getTuple(tupleId,tmp);
5308 PyObject *ret=PyTuple_New(sz);
5309 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5313 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5316 int r1=(int)self->getMaxValue(tmp);
5317 PyObject *ret=PyTuple_New(2);
5318 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5319 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5323 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5326 int r1=(int)self->getMinValue(tmp);
5327 PyObject *ret=PyTuple_New(2);
5328 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5329 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5333 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5335 int nbOfCompo=self->getNumberOfComponents();
5340 if(PyInt_Check(obj))
5342 int val=(int)PyInt_AS_LONG(obj);
5343 return self->locateValue(val);
5346 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5349 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5353 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5355 int nbOfCompo=self->getNumberOfComponents();
5362 if(PyInt_Check(obj))
5364 int val=(int)PyInt_AS_LONG(obj);
5365 return self->presenceOfValue(val);
5368 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5371 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5375 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5377 self->checkAllocated();
5378 const char msg[]="Unexpected situation in __setitem__ !";
5379 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5382 std::vector<int> v1;
5384 DataArrayIntTuple *dd1=0;
5385 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5387 std::vector<int> vt1,vc1;
5388 std::pair<int, std::pair<int,int> > pt1,pc1;
5389 DataArrayInt *dt1=0,*dc1=0;
5390 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5391 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5399 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5402 throw INTERP_KERNEL::Exception(msg);
5411 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5414 throw INTERP_KERNEL::Exception(msg);
5423 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5426 throw INTERP_KERNEL::Exception(msg);
5435 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5438 throw INTERP_KERNEL::Exception(msg);
5447 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5450 throw INTERP_KERNEL::Exception(msg);
5459 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5462 throw INTERP_KERNEL::Exception(msg);
5471 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5474 throw INTERP_KERNEL::Exception(msg);
5483 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5486 throw INTERP_KERNEL::Exception(msg);
5495 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5498 throw INTERP_KERNEL::Exception(msg);
5507 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5510 throw INTERP_KERNEL::Exception(msg);
5519 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5522 throw INTERP_KERNEL::Exception(msg);
5531 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5534 throw INTERP_KERNEL::Exception(msg);
5543 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5546 throw INTERP_KERNEL::Exception(msg);
5555 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5558 throw INTERP_KERNEL::Exception(msg);
5567 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5570 throw INTERP_KERNEL::Exception(msg);
5579 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5582 throw INTERP_KERNEL::Exception(msg);
5587 throw INTERP_KERNEL::Exception(msg);
5594 class DataArrayByteTuple;
5596 class DataArrayByteIterator
5599 DataArrayByteIterator(DataArrayByte *da);
5600 ~DataArrayByteIterator();
5603 class DataArrayByteTuple
5606 std::string repr() const throw(INTERP_KERNEL::Exception);
5607 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5610 std::string __str__() const throw(INTERP_KERNEL::Exception)
5612 return self->repr();
5615 char __int__() const throw(INTERP_KERNEL::Exception)
5617 return self->byteValue();
5620 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5622 return self->buildDAByte(1,self->getNumberOfCompo());
5627 class DataArrayAsciiCharIterator;
5629 class DataArrayAsciiChar : public DataArrayChar
5632 static DataArrayAsciiChar *New();
5633 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5634 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5635 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5638 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5640 return DataArrayAsciiChar::New();
5643 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5645 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) !";
5646 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5650 if(PyInt_Check(nbOfTuples))
5652 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5654 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5657 if(PyInt_Check(nbOfComp))
5658 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5659 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5661 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5662 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5663 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5664 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5668 throw INTERP_KERNEL::Exception(msg);
5671 {//DataArrayAsciiChar.New([1,3,4],3)
5672 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5674 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5675 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5679 else if(PyString_Check(nbOfTuples))
5681 if(PyString_Size(nbOfTuples)!=1)
5682 throw INTERP_KERNEL::Exception(msg);
5683 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5684 std::vector<std::string> tmp;
5685 if(fillStringVector(elt0,tmp))
5686 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5688 throw INTERP_KERNEL::Exception(msg);
5691 throw INTERP_KERNEL::Exception(msg);
5695 std::vector<std::string> tmmp;
5696 if(fillStringVector(elt0,tmmp))
5697 //DataArrayAsciiChar.New(["abc","de","fghi"])
5698 return DataArrayAsciiChar::New(tmmp,' ');
5701 // DataArrayAsciiChar.New([1,3,4])
5702 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5703 int tmpp1=-1,tmpp2=-1;
5704 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5705 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5710 else if(PyInt_Check(elt0))
5712 int nbOfTuples1=PyInt_AS_LONG(elt0);
5714 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5719 if(PyInt_Check(nbOfTuples))
5720 {//DataArrayAsciiChar.New(5,2)
5721 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5723 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5724 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5725 ret->alloc(nbOfTuples1,nbOfCompo);
5729 throw INTERP_KERNEL::Exception(msg);
5732 throw INTERP_KERNEL::Exception(msg);
5735 {//DataArrayAsciiChar.New(5)
5736 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5737 ret->alloc(nbOfTuples1,1);
5742 throw INTERP_KERNEL::Exception(msg);
5745 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5747 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5750 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5752 std::ostringstream oss;
5753 self->reprQuickOverview(oss);
5757 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5759 return self->iterator();
5762 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5764 char tmp[2]; tmp[1]='\0';
5765 tmp[0]=self->getIJ(tupleId,compoId);
5766 return std::string(tmp);
5769 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5771 char tmp[2]; tmp[1]='\0';
5772 tmp[0]=self->getIJSafe(tupleId,compoId);
5773 return std::string(tmp);
5776 std::string __str__() const throw(INTERP_KERNEL::Exception)
5778 return self->repr();
5781 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5783 const char *vals=self->getConstPointer();
5784 int nbOfComp=self->getNumberOfComponents();
5785 int nbOfTuples=self->getNumberOfTuples();
5786 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5789 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5791 if(PyString_Check(tupl))
5793 Py_ssize_t sz=PyString_Size(tupl);
5794 std::vector<char> vals(sz);
5795 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5796 return self->presenceOfTuple(vals);
5799 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5802 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5804 if(PyString_Check(vals))
5806 Py_ssize_t sz=PyString_Size(vals);
5807 std::vector<char> vals2(sz);
5808 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5809 return self->presenceOfValue(vals2);
5812 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5815 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5817 if(PyString_Check(vals))
5819 Py_ssize_t sz=PyString_Size(vals);
5820 std::vector<char> vals2(sz);
5821 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5822 return self->locateValue(vals2);
5825 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5828 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5830 if(PyString_Check(tupl))
5832 Py_ssize_t sz=PyString_Size(tupl);
5833 std::vector<char> vals(sz);
5834 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5835 return self->locateTuple(vals);
5838 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5841 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5843 if(PyString_Check(strOrListOfInt))
5845 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5846 std::vector<char> vals(sz);
5847 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5848 return self->search(vals);
5851 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5854 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5856 int sz=self->getNumberOfComponents();
5857 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5858 self->getTuple(tupleId,tmp);
5859 return PyString_FromString(tmp);
5862 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5865 char tmp2[2]; tmp2[1]='\0';
5866 tmp2[0]=self->getMaxValue(tmp);
5867 PyObject *ret=PyTuple_New(2);
5868 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5869 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5873 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5876 char tmp2[2]; tmp2[1]='\0';
5877 tmp2[0]=self->getMinValue(tmp);
5878 PyObject *ret=PyTuple_New(2);
5879 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5880 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5884 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5886 int nbOfCompo=self->getNumberOfComponents();
5891 if(PyString_Check(obj))
5893 Py_ssize_t sz=PyString_Size(obj);
5894 char *pt=PyString_AsString(obj);
5896 return self->locateValue(pt[0]);
5898 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5901 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5904 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5908 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5910 int nbOfCompo=self->getNumberOfComponents();
5917 if(PyString_Check(obj))
5919 Py_ssize_t sz=PyString_Size(obj);
5920 char *pt=PyString_AsString(obj);
5922 return self->presenceOfValue(pt[0]);
5924 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5927 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5930 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5934 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5937 std::vector<int> stdvecTyyppArr;
5938 std::pair<int, std::pair<int,int> > sTyyppArr;
5939 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5940 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5944 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5946 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5948 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5950 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5952 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5956 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5958 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.";
5960 std::vector<int> stdvecTyyppArr;
5961 std::pair<int, std::pair<int,int> > sTyyppArr;
5962 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5963 int nbOfCompo=self->getNumberOfComponents();
5964 int nbOfTuples=self->getNumberOfTuples();
5965 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5967 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5968 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5977 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5983 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5984 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5987 //value vector<string>
5990 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5991 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5994 //value DataArrayChar
5997 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6001 throw INTERP_KERNEL::Exception(msg);
6005 {//obj list-tuple[int]
6011 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6017 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6018 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6021 //value vector<string>
6024 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6025 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6028 //value DataArrayChar
6031 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6035 throw INTERP_KERNEL::Exception(msg);
6046 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6052 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6053 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6056 //value vector<string>
6059 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6060 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6063 //value DataArrayChar
6066 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6070 throw INTERP_KERNEL::Exception(msg);
6081 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6087 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6088 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6091 //value vector<string>
6094 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6095 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6098 //value DataArrayChar
6101 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6105 throw INTERP_KERNEL::Exception(msg);
6110 throw INTERP_KERNEL::Exception(msg);
6116 class DataArrayAsciiCharTuple;
6118 class DataArrayAsciiCharIterator
6121 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6122 ~DataArrayAsciiCharIterator();
6127 DataArrayAsciiCharTuple *ret=self->nextt();
6129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6132 PyErr_SetString(PyExc_StopIteration,"No more data.");
6139 class DataArrayAsciiCharTuple
6142 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6143 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6146 std::string __str__() const throw(INTERP_KERNEL::Exception)
6148 return self->repr();
6151 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6153 return self->buildDAAsciiChar(1,self->getNumberOfCompo());