1 // Copyright (C) 2007-2015 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) ParaMEDMEM::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) ParaMEDMEM::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject ParaMEDMEM::DataArray::deepCpy;
46 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
47 %newobject ParaMEDMEM::DataArray::selectByTupleId;
48 %newobject ParaMEDMEM::DataArray::selectByTupleIdSafe;
49 %newobject ParaMEDMEM::DataArray::selectByTupleId2;
50 %newobject ParaMEDMEM::DataArray::Aggregate;
51 %newobject ParaMEDMEM::DataArrayInt::New;
52 %newobject ParaMEDMEM::DataArrayInt::__iter__;
53 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
54 %newobject ParaMEDMEM::DataArrayInt::performCpy;
55 %newobject ParaMEDMEM::DataArrayInt::substr;
56 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
57 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
58 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
59 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
60 %newobject ParaMEDMEM::DataArrayInt::renumber;
61 %newobject ParaMEDMEM::DataArrayInt::renumberR;
62 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
63 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
64 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
65 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
66 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
67 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
68 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
69 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
70 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualTuple;
71 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
72 %newobject ParaMEDMEM::DataArrayInt::negate;
73 %newobject ParaMEDMEM::DataArrayInt::computeAbs;
74 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
75 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
76 %newobject ParaMEDMEM::DataArrayInt::getIdsStrictlyNegative;
77 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
78 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
79 %newobject ParaMEDMEM::DataArrayInt::Meld;
80 %newobject ParaMEDMEM::DataArrayInt::Add;
81 %newobject ParaMEDMEM::DataArrayInt::Substract;
82 %newobject ParaMEDMEM::DataArrayInt::Multiply;
83 %newobject ParaMEDMEM::DataArrayInt::Divide;
84 %newobject ParaMEDMEM::DataArrayInt::Pow;
85 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
86 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
87 %newobject ParaMEDMEM::DataArrayInt::Range;
88 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
89 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
90 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
91 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
92 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
93 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
94 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
95 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
96 %newobject ParaMEDMEM::DataArrayInt::buildUniqueNotSorted;
97 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
98 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
99 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
100 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
101 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
102 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
103 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
104 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
105 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
106 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
107 %newobject ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation;
108 %newobject ParaMEDMEM::DataArrayInt::__neg__;
109 %newobject ParaMEDMEM::DataArrayInt::__add__;
110 %newobject ParaMEDMEM::DataArrayInt::__radd__;
111 %newobject ParaMEDMEM::DataArrayInt::__sub__;
112 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
113 %newobject ParaMEDMEM::DataArrayInt::__mul__;
114 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
115 %newobject ParaMEDMEM::DataArrayInt::__div__;
116 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
117 %newobject ParaMEDMEM::DataArrayInt::__mod__;
118 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
119 %newobject ParaMEDMEM::DataArrayInt::__pow__;
120 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
121 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
122 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
123 %newobject ParaMEDMEM::DataArrayChar::renumber;
124 %newobject ParaMEDMEM::DataArrayChar::renumberR;
125 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
126 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
127 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
128 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
129 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
130 %newobject ParaMEDMEM::DataArrayChar::Meld;
131 %newobject ParaMEDMEM::DataArrayByte::New;
132 %newobject ParaMEDMEM::DataArrayByte::__iter__;
133 %newobject ParaMEDMEM::DataArrayByte::performCpy;
134 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
135 %newobject ParaMEDMEM::DataArrayChar::substr;
136 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
137 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
138 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
139 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
140 %newobject ParaMEDMEM::DataArrayDouble::New;
141 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
142 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
143 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
144 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
145 %newobject ParaMEDMEM::DataArrayDouble::Meld;
146 %newobject ParaMEDMEM::DataArrayDouble::Dot;
147 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
148 %newobject ParaMEDMEM::DataArrayDouble::Add;
149 %newobject ParaMEDMEM::DataArrayDouble::Substract;
150 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
151 %newobject ParaMEDMEM::DataArrayDouble::Divide;
152 %newobject ParaMEDMEM::DataArrayDouble::Pow;
153 %newobject ParaMEDMEM::DataArrayDouble::substr;
154 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
155 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
156 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
157 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
158 %newobject ParaMEDMEM::DataArrayDouble::negate;
159 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
160 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
161 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
162 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
163 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
164 %newobject ParaMEDMEM::DataArrayDouble::determinant;
165 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
166 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
167 %newobject ParaMEDMEM::DataArrayDouble::inverse;
168 %newobject ParaMEDMEM::DataArrayDouble::trace;
169 %newobject ParaMEDMEM::DataArrayDouble::deviator;
170 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
171 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
172 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
173 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
174 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
175 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
176 %newobject ParaMEDMEM::DataArrayDouble::renumber;
177 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
178 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
179 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
180 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
181 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
182 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
183 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
184 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
185 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
186 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
187 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
188 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
189 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
190 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
191 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
192 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
193 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
194 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
195 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
197 %feature("unref") DataArray "$this->decrRef();"
198 %feature("unref") DataArrayDouble "$this->decrRef();"
199 %feature("unref") DataArrayInt "$this->decrRef();"
200 %feature("unref") DataArrayChar "$this->decrRef();"
201 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
202 %feature("unref") DataArrayByte "$this->decrRef();"
206 class DataArray : public RefCountObject, public TimeLabel
209 void setName(const std::string& name);
210 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
211 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
212 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
213 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
214 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
215 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
216 std::string getName() const;
217 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
218 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
219 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
220 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
221 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
222 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
223 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
224 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
225 int getNumberOfComponents() const;
226 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
227 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
228 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
229 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
230 virtual void desallocate() throw(INTERP_KERNEL::Exception);
231 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
232 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
233 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
234 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
235 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
236 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
237 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
238 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
239 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
240 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
241 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
242 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
243 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
244 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
245 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
246 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
247 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
248 void updateTime() const;
251 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
253 const std::vector<std::string>& comps=self->getInfoOnComponents();
254 PyObject *ret=PyList_New((int)comps.size());
255 for(int i=0;i<(int)comps.size();i++)
256 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
260 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
262 std::vector<int> tmp;
263 convertPyToNewIntArr3(li,tmp);
264 self->copyPartOfStringInfoFrom(other,tmp);
267 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
269 std::vector<int> tmp;
270 convertPyToNewIntArr3(li,tmp);
271 self->copyPartOfStringInfoFrom2(tmp,other);
274 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
277 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
278 if (!SWIG_IsOK(res1))
281 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
282 if(size!=self->getNumberOfTuples())
284 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
286 self->renumberInPlace(tmp);
290 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
292 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
293 da2->checkAllocated();
294 int size=self->getNumberOfTuples();
295 if(size!=self->getNumberOfTuples())
297 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
299 self->renumberInPlace(da2->getConstPointer());
303 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
306 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
307 if (!SWIG_IsOK(res1))
310 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
311 if(size!=self->getNumberOfTuples())
313 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
315 self->renumberInPlaceR(tmp);
319 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
321 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
322 da2->checkAllocated();
323 int size=self->getNumberOfTuples();
324 if(size!=self->getNumberOfTuples())
326 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
328 self->renumberInPlaceR(da2->getConstPointer());
332 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
333 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
335 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
336 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
337 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
338 DataArrayInt *tuplesSelecPtr2=0;
341 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
343 throw INTERP_KERNEL::Exception(msg);
345 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
348 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
350 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
351 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
354 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
356 std::vector<std::pair<int,int> > ranges;
357 convertPyToVectorPairInt(li,ranges);
358 return self->selectByTupleRanges(ranges);
361 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
364 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
365 if (!SWIG_IsOK(res1))
368 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
369 return self->selectByTupleId(tmp,tmp+size);
373 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
375 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
376 da2->checkAllocated();
377 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
381 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
384 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
385 if (!SWIG_IsOK(res1))
388 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
389 return self->selectByTupleIdSafe(tmp,tmp+size);
393 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
395 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
396 da2->checkAllocated();
397 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
401 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
403 std::vector<int> tmp;
404 convertPyToNewIntArr3(li,tmp);
405 DataArray *ret=self->keepSelectedComponents(tmp);
406 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
409 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
411 if(!PySlice_Check(slic))
412 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
413 Py_ssize_t strt=2,stp=2,step=2;
414 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
415 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
417 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
418 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
421 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
423 if(!PySlice_Check(slic))
424 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
425 Py_ssize_t strt=2,stp=2,step=2;
426 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
427 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
429 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
430 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
433 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
435 if(!PySlice_Check(slic))
436 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
437 Py_ssize_t strt=2,stp=2,step=2;
438 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
439 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
440 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
443 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
445 if(!PySlice_Check(slic))
446 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
447 Py_ssize_t strt=2,stp=2,step=2;
448 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
449 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
450 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
453 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
455 std::vector<const DataArray *> tmp;
456 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
457 return DataArray::Aggregate(tmp);
460 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
462 if(!PySlice_Check(slic))
463 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
464 Py_ssize_t strt=2,stp=2,step=2;
465 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
466 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
467 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
470 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
472 if(!PySlice_Check(slic))
473 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
474 Py_ssize_t strt=2,stp=2,step=2;
475 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
476 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
477 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
480 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
482 PyObject *ret(PyTuple_New(2));
483 std::string a0(self->getName());
484 const std::vector<std::string> &a1(self->getInfoOnComponents());
485 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
488 PyObject *ret1(PyList_New(sz));
489 for(int i=0;i<sz;i++)
490 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
491 PyTuple_SetItem(ret,1,ret1);
496 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
498 static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
499 if(!PyTuple_Check(inp))
500 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
501 int sz(PyTuple_Size(inp));
503 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
504 PyObject *a0(PyTuple_GetItem(inp,0));
505 if(!PyString_Check(a0))
506 throw INTERP_KERNEL::Exception(MSG);
507 PyObject *a1(PyTuple_GetItem(inp,1));
508 std::vector<std::string> a1cpp;
509 if(!fillStringVector(a1,a1cpp))
510 throw INTERP_KERNEL::Exception(MSG);
511 self->setName(PyString_AsString(a0));
512 self->setInfoOnComponents(a1cpp);
518 class DataArrayDoubleIterator;
520 class DataArrayDouble : public DataArray
523 static DataArrayDouble *New();
524 double doubleValue() const throw(INTERP_KERNEL::Exception);
525 bool empty() const throw(INTERP_KERNEL::Exception);
526 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
527 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
528 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
529 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
530 double popBackSilent() throw(INTERP_KERNEL::Exception);
531 void pack() const throw(INTERP_KERNEL::Exception);
532 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
533 void fillWithZero() throw(INTERP_KERNEL::Exception);
534 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
535 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
536 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
537 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
538 void reverse() throw(INTERP_KERNEL::Exception);
539 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
540 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
541 std::string repr() const throw(INTERP_KERNEL::Exception);
542 std::string reprZip() const throw(INTERP_KERNEL::Exception);
543 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
544 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
545 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
546 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
550 void transpose() throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
552 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
555 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
556 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
557 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
558 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
559 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
560 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
561 double front() const throw(INTERP_KERNEL::Exception);
562 double back() const throw(INTERP_KERNEL::Exception);
563 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
564 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
565 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
566 double *getPointer() throw(INTERP_KERNEL::Exception);
567 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
569 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
570 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
571 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
572 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
573 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
574 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
575 double getAverageValue() const throw(INTERP_KERNEL::Exception);
576 double norm2() const throw(INTERP_KERNEL::Exception);
577 double normMax() const throw(INTERP_KERNEL::Exception);
578 double normMin() const throw(INTERP_KERNEL::Exception);
579 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
580 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
581 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
582 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
583 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
584 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
585 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
586 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
587 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
588 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
590 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
591 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
595 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
596 void abs() throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
598 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
599 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
600 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
601 void applyPow(double val) throw(INTERP_KERNEL::Exception);
602 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
607 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
609 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
610 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
611 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
612 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
613 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
614 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
615 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
616 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
617 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
618 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
619 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
620 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
621 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
622 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
623 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
624 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
625 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
626 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
627 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
632 DataArrayDouble() throw(INTERP_KERNEL::Exception)
634 return DataArrayDouble::New();
637 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
639 const char *msgBase="ParaMEDMEM::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
640 std::string msg(msgBase);
642 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
645 if(PyList_Check(elt0) || PyTuple_Check(elt0))
649 if(PyInt_Check(nbOfTuples))
651 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
653 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
656 if(PyInt_Check(elt2))
657 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
658 int nbOfCompo=PyInt_AS_LONG(elt2);
660 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
661 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
662 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
663 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
667 throw INTERP_KERNEL::Exception(msg.c_str());
670 {//DataArrayDouble.New([1.,3.,4.],3)
671 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
673 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
674 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
679 throw INTERP_KERNEL::Exception(msg.c_str());
682 {// DataArrayDouble.New([1.,3.,4.])
683 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
684 int tmpp1=-1,tmpp2=-1;
685 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
686 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
690 else if(PyInt_Check(elt0))
692 int nbOfTuples1=PyInt_AS_LONG(elt0);
694 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
699 if(PyInt_Check(nbOfTuples))
700 {//DataArrayDouble.New(5,2)
701 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
703 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
704 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
705 ret->alloc(nbOfTuples1,nbOfCompo);
709 throw INTERP_KERNEL::Exception(msg.c_str());
712 throw INTERP_KERNEL::Exception(msg.c_str());
715 {//DataArrayDouble.New(5)
716 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
717 ret->alloc(nbOfTuples1,1);
722 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
723 {//DataArrayDouble.New(numpyArray)
724 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
728 throw INTERP_KERNEL::Exception(msg.c_str());
729 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
732 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
734 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
737 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
740 std::vector<double> bb;
742 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
743 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
744 self->pushBackValsSilent(tmp,tmp+nbTuples);
747 std::string __repr__() const throw(INTERP_KERNEL::Exception)
749 std::ostringstream oss;
750 self->reprQuickOverview(oss);
754 std::string __str__() const throw(INTERP_KERNEL::Exception)
756 return self->reprNotTooLong();
759 double __float__() const throw(INTERP_KERNEL::Exception)
761 return self->doubleValue();
764 int __len__() const throw(INTERP_KERNEL::Exception)
766 if(self->isAllocated())
768 return self->getNumberOfTuples();
772 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
776 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
778 return self->iterator();
781 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
783 const char *msg="ParaMEDMEM::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
784 if(PyList_Check(li) || PyTuple_Check(li))
788 if(PyInt_Check(nbOfTuples))
790 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
792 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
795 if(PyInt_Check(nbOfComp))
796 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
797 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
799 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
800 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
801 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
804 throw INTERP_KERNEL::Exception(msg);
807 {//DataArrayDouble.setValues([1.,3.,4.],3)
809 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
810 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
814 throw INTERP_KERNEL::Exception(msg);
817 {// DataArrayDouble.setValues([1.,3.,4.])
818 int tmpp1=-1,tmpp2=-1;
819 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
820 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
824 throw INTERP_KERNEL::Exception(msg);
827 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
829 const double *vals=self->getConstPointer();
830 return convertDblArrToPyList(vals,self->getNbOfElems());
834 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
836 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
840 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
843 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
844 PyObject *ret=PyTuple_New(2);
845 PyObject *ret0Py=ret0?Py_True:Py_False;
847 PyTuple_SetItem(ret,0,ret0Py);
848 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
852 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
854 const double *vals=self->getConstPointer();
855 int nbOfComp=self->getNumberOfComponents();
856 int nbOfTuples=self->getNumberOfTuples();
857 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
860 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
863 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
864 if (!SWIG_IsOK(res1))
867 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
868 if(size!=self->getNumberOfTuples())
870 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
872 return self->renumber(tmp);
876 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
878 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
879 da2->checkAllocated();
880 int size=self->getNumberOfTuples();
881 if(size!=self->getNumberOfTuples())
883 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
885 return self->renumber(da2->getConstPointer());
889 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
892 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
893 if (!SWIG_IsOK(res1))
896 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
897 if(size!=self->getNumberOfTuples())
899 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
901 return self->renumberR(tmp);
905 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
907 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
908 da2->checkAllocated();
909 int size=self->getNumberOfTuples();
910 if(size!=self->getNumberOfTuples())
912 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
914 return self->renumberR(da2->getConstPointer());
918 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
921 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
922 if (!SWIG_IsOK(res1))
925 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
926 if(size!=self->getNumberOfTuples())
928 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
930 return self->renumberAndReduce(tmp,newNbOfTuple);
934 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
936 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
937 da2->checkAllocated();
938 int size=self->getNumberOfTuples();
939 if(size!=self->getNumberOfTuples())
941 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
943 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
947 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
949 int thisTupleId,otherTupleId;
950 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
951 PyObject *ret=PyTuple_New(3);
952 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
953 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
954 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
958 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
961 double r1=self->getMaxValue(tmp);
962 PyObject *ret=PyTuple_New(2);
963 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
964 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
968 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
971 double r1=self->getMaxValue2(tmp);
972 PyObject *ret=PyTuple_New(2);
973 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
974 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
978 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
981 double r1=self->getMinValue(tmp);
982 PyObject *ret=PyTuple_New(2);
983 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
984 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
988 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
991 double r1=self->getMinValue2(tmp);
992 PyObject *ret=PyTuple_New(2);
993 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
994 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
998 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1000 int nbOfCompo=self->getNumberOfComponents();
1001 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1002 self->getMinMaxPerComponent(tmp);
1003 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1007 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1009 int sz=self->getNumberOfComponents();
1010 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1011 self->accumulate(tmp);
1012 return convertDblArrToPyList(tmp,sz);
1015 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1018 std::vector<int> val2;
1019 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1020 return self->accumulatePerChunck(bg,bg+sz);
1023 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1025 DataArrayInt *comm, *commIndex;
1026 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1027 PyObject *res = PyList_New(2);
1028 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1029 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1033 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1037 DataArrayDoubleTuple *aa;
1038 std::vector<double> bb;
1040 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1041 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1043 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1044 PyObject *ret=PyTuple_New(2);
1045 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1046 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1050 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1052 std::vector<int> tmp;
1053 convertPyToNewIntArr3(li,tmp);
1054 self->setSelectedComponents(a,tmp);
1057 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1059 int sz=self->getNumberOfComponents();
1060 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1061 self->getTuple(tupleId,tmp);
1062 return convertDblArrToPyList(tmp,sz);
1065 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1067 std::vector<const DataArrayDouble *> tmp;
1068 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1069 return DataArrayDouble::Aggregate(tmp);
1072 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1074 std::vector<const DataArrayDouble *> tmp;
1075 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1076 return DataArrayDouble::Meld(tmp);
1079 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1083 DataArrayDoubleTuple *aa;
1084 std::vector<double> bb;
1086 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1087 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1088 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1090 DataArrayInt *c=0,*cI=0;
1091 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1092 PyObject *ret=PyTuple_New(2);
1093 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1094 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1098 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1100 DataArrayInt *ret1=0;
1101 bool ret0=self->areIncludedInMe(other,prec,ret1);
1102 PyObject *ret=PyTuple_New(2);
1103 PyObject *ret0Py=ret0?Py_True:Py_False;
1105 PyTuple_SetItem(ret,0,ret0Py);
1106 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1110 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1112 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1113 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1114 self->checkAllocated();
1115 int nbOfTuples=self->getNumberOfTuples();
1116 int nbOfComponents=self->getNumberOfComponents();
1118 std::vector<int> vt1,vc1;
1119 std::pair<int, std::pair<int,int> > pt1,pc1;
1120 DataArrayInt *dt1=0,*dc1=0;
1122 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1123 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1127 if(nbOfComponents==1)
1128 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1129 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1131 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1133 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1135 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1137 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1140 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1141 std::vector<int> v2(1,ic1);
1142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1146 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1147 std::vector<int> v2(1,ic1);
1148 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1152 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1153 std::vector<int> v2(1,ic1);
1154 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1158 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1159 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1163 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1164 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1168 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1169 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1173 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1174 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1178 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1179 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1180 std::vector<int> v2(nbOfComp);
1181 for(int i=0;i<nbOfComp;i++)
1182 v2[i]=pc1.first+i*pc1.second.second;
1183 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1187 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1188 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1189 std::vector<int> v2(nbOfComp);
1190 for(int i=0;i<nbOfComp;i++)
1191 v2[i]=pc1.first+i*pc1.second.second;
1192 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1196 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1197 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1198 std::vector<int> v2(nbOfComp);
1199 for(int i=0;i<nbOfComp;i++)
1200 v2[i]=pc1.first+i*pc1.second.second;
1201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1205 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1206 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1207 std::vector<int> v2(nbOfComp);
1208 for(int i=0;i<nbOfComp;i++)
1209 v2[i]=pc1.first+i*pc1.second.second;
1210 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1213 throw INTERP_KERNEL::Exception(msg);
1217 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1219 self->checkAllocated();
1220 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1221 int nbOfTuples=self->getNumberOfTuples();
1222 int nbOfComponents=self->getNumberOfComponents();
1225 std::vector<double> v1;
1226 DataArrayDouble *d1=0;
1227 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1229 std::vector<int> vt1,vc1;
1230 std::pair<int, std::pair<int,int> > pt1,pc1;
1231 DataArrayInt *dt1=0,*dc1=0;
1232 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1233 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1241 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1244 tmp=DataArrayDouble::New();
1245 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1246 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1249 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1252 throw INTERP_KERNEL::Exception(msg);
1261 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1264 tmp=DataArrayDouble::New();
1265 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1266 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1269 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1272 throw INTERP_KERNEL::Exception(msg);
1281 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1284 tmp=DataArrayDouble::New();
1285 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1286 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1289 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1292 throw INTERP_KERNEL::Exception(msg);
1301 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1304 tmp=DataArrayDouble::New();
1305 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1306 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1309 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1312 throw INTERP_KERNEL::Exception(msg);
1321 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1324 tmp=DataArrayDouble::New();
1325 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1326 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1329 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1332 throw INTERP_KERNEL::Exception(msg);
1341 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1344 tmp=DataArrayDouble::New();
1345 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1346 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1349 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1352 throw INTERP_KERNEL::Exception(msg);
1361 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1364 tmp=DataArrayDouble::New();
1365 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1366 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1369 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1372 throw INTERP_KERNEL::Exception(msg);
1381 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1384 tmp=DataArrayDouble::New();
1385 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1386 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1389 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1392 throw INTERP_KERNEL::Exception(msg);
1401 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1404 tmp=DataArrayDouble::New();
1405 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1406 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1409 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1412 throw INTERP_KERNEL::Exception(msg);
1421 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1424 tmp=DataArrayDouble::New();
1425 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1426 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1429 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1432 throw INTERP_KERNEL::Exception(msg);
1441 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1444 tmp=DataArrayDouble::New();
1445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1446 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1449 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1452 throw INTERP_KERNEL::Exception(msg);
1461 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1464 tmp=DataArrayDouble::New();
1465 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1466 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1469 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1472 throw INTERP_KERNEL::Exception(msg);
1481 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1484 tmp=DataArrayDouble::New();
1485 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1486 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1489 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1492 throw INTERP_KERNEL::Exception(msg);
1501 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1504 tmp=DataArrayDouble::New();
1505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1506 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1509 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1512 throw INTERP_KERNEL::Exception(msg);
1521 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1524 tmp=DataArrayDouble::New();
1525 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1526 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1529 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1532 throw INTERP_KERNEL::Exception(msg);
1541 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1544 tmp=DataArrayDouble::New();
1545 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1546 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1549 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1552 throw INTERP_KERNEL::Exception(msg);
1557 throw INTERP_KERNEL::Exception(msg);
1562 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1564 return self->negate();
1567 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1569 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1572 DataArrayDoubleTuple *aa;
1573 std::vector<double> bb;
1576 #ifndef WITHOUT_AUTOFIELD
1578 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1580 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1583 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1584 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1586 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1589 throw INTERP_KERNEL::Exception(msg);
1593 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1598 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1599 ret->applyLin(1.,val);
1600 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1604 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1608 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1609 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1613 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1614 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1617 throw INTERP_KERNEL::Exception(msg);
1621 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1623 const char msg[]="Unexpected situation in __radd__ !";
1626 DataArrayDoubleTuple *aa;
1627 std::vector<double> bb;
1629 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1634 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1635 ret->applyLin(1.,val);
1640 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1641 return DataArrayDouble::Add(self,aaa);
1645 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1646 return DataArrayDouble::Add(self,aaa);
1649 throw INTERP_KERNEL::Exception(msg);
1653 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1655 const char msg[]="Unexpected situation in __iadd__ !";
1658 DataArrayDoubleTuple *aa;
1659 std::vector<double> bb;
1661 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1666 self->applyLin(1.,val);
1667 Py_XINCREF(trueSelf);
1673 Py_XINCREF(trueSelf);
1678 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1679 self->addEqual(aaa);
1680 Py_XINCREF(trueSelf);
1685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1686 self->addEqual(aaa);
1687 Py_XINCREF(trueSelf);
1691 throw INTERP_KERNEL::Exception(msg);
1695 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1697 const char msg[]="Unexpected situation in __sub__ !";
1700 DataArrayDoubleTuple *aa;
1701 std::vector<double> bb;
1704 #ifndef WITHOUT_AUTOFIELD
1706 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1708 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1711 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1712 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1714 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1717 throw INTERP_KERNEL::Exception(msg);
1721 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1726 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1727 ret->applyLin(1.,-val);
1728 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1732 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1736 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1737 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1741 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1745 throw INTERP_KERNEL::Exception(msg);
1749 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1751 const char msg[]="Unexpected situation in __rsub__ !";
1754 DataArrayDoubleTuple *aa;
1755 std::vector<double> bb;
1757 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1762 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1763 ret->applyLin(-1.,val);
1768 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1769 return DataArrayDouble::Substract(aaa,self);
1773 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1774 return DataArrayDouble::Substract(aaa,self);
1777 throw INTERP_KERNEL::Exception(msg);
1781 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1783 const char msg[]="Unexpected situation in __isub__ !";
1786 DataArrayDoubleTuple *aa;
1787 std::vector<double> bb;
1789 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1794 self->applyLin(1,-val);
1795 Py_XINCREF(trueSelf);
1800 self->substractEqual(a);
1801 Py_XINCREF(trueSelf);
1806 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1807 self->substractEqual(aaa);
1808 Py_XINCREF(trueSelf);
1813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1814 self->substractEqual(aaa);
1815 Py_XINCREF(trueSelf);
1819 throw INTERP_KERNEL::Exception(msg);
1823 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1825 const char msg[]="Unexpected situation in __mul__ !";
1828 DataArrayDoubleTuple *aa;
1829 std::vector<double> bb;
1832 #ifndef WITHOUT_AUTOFIELD
1834 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1836 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1839 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1840 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1842 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1845 throw INTERP_KERNEL::Exception(msg);
1849 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1855 ret->applyLin(val,0.);
1856 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1860 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1864 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1865 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1869 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1870 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1873 throw INTERP_KERNEL::Exception(msg);
1877 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1879 const char msg[]="Unexpected situation in __rmul__ !";
1882 DataArrayDoubleTuple *aa;
1883 std::vector<double> bb;
1885 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1890 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1891 ret->applyLin(val,0.);
1896 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1897 return DataArrayDouble::Multiply(self,aaa);
1901 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1902 return DataArrayDouble::Multiply(self,aaa);
1905 throw INTERP_KERNEL::Exception(msg);
1909 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1911 const char msg[]="Unexpected situation in __imul__ !";
1914 DataArrayDoubleTuple *aa;
1915 std::vector<double> bb;
1917 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1922 self->applyLin(val,0.);
1923 Py_XINCREF(trueSelf);
1928 self->multiplyEqual(a);
1929 Py_XINCREF(trueSelf);
1934 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1935 self->multiplyEqual(aaa);
1936 Py_XINCREF(trueSelf);
1941 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1942 self->multiplyEqual(aaa);
1943 Py_XINCREF(trueSelf);
1947 throw INTERP_KERNEL::Exception(msg);
1951 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1953 const char msg[]="Unexpected situation in __div__ !";
1956 DataArrayDoubleTuple *aa;
1957 std::vector<double> bb;
1960 #ifndef WITHOUT_AUTOFIELD
1962 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1964 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1967 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1968 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1970 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1973 throw INTERP_KERNEL::Exception(msg);
1977 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1983 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1984 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1985 ret->applyLin(1/val,0.);
1986 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1990 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1994 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1995 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1999 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2000 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2003 throw INTERP_KERNEL::Exception(msg);
2007 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2009 const char msg[]="Unexpected situation in __rdiv__ !";
2012 DataArrayDoubleTuple *aa;
2013 std::vector<double> bb;
2015 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2020 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2026 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2027 return DataArrayDouble::Divide(aaa,self);
2031 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2032 return DataArrayDouble::Divide(aaa,self);
2035 throw INTERP_KERNEL::Exception(msg);
2039 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2041 const char msg[]="Unexpected situation in __idiv__ !";
2044 DataArrayDoubleTuple *aa;
2045 std::vector<double> bb;
2047 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2053 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2054 self->applyLin(1./val,0.);
2055 Py_XINCREF(trueSelf);
2060 self->divideEqual(a);
2061 Py_XINCREF(trueSelf);
2066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2067 self->divideEqual(aaa);
2068 Py_XINCREF(trueSelf);
2073 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2074 self->divideEqual(aaa);
2075 Py_XINCREF(trueSelf);
2079 throw INTERP_KERNEL::Exception(msg);
2083 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2085 const char msg[]="Unexpected situation in __pow__ !";
2088 DataArrayDoubleTuple *aa;
2089 std::vector<double> bb;
2091 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2096 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2102 return DataArrayDouble::Pow(self,a);
2106 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2107 return DataArrayDouble::Pow(self,aaa);
2111 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2112 return DataArrayDouble::Pow(self,aaa);
2115 throw INTERP_KERNEL::Exception(msg);
2119 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2121 const char msg[]="Unexpected situation in __rpow__ !";
2124 DataArrayDoubleTuple *aa;
2125 std::vector<double> bb;
2127 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2132 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2133 ret->applyRPow(val);
2138 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2139 return DataArrayDouble::Pow(aaa,self);
2143 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2144 return DataArrayDouble::Pow(aaa,self);
2147 throw INTERP_KERNEL::Exception(msg);
2151 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2153 const char msg[]="Unexpected situation in __ipow__ !";
2156 DataArrayDoubleTuple *aa;
2157 std::vector<double> bb;
2159 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2164 self->applyPow(val);
2165 Py_XINCREF(trueSelf);
2171 Py_XINCREF(trueSelf);
2176 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2177 self->powEqual(aaa);
2178 Py_XINCREF(trueSelf);
2183 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2184 self->powEqual(aaa);
2185 Py_XINCREF(trueSelf);
2189 throw INTERP_KERNEL::Exception(msg);
2193 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2195 DataArrayInt *c=0,*cI=0;
2197 self->computeTupleIdsNearTuples(other,eps,c,cI);
2198 PyObject *ret=PyTuple_New(2);
2199 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2200 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2204 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2206 DataArrayInt *ret1=0;
2207 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2208 PyObject *ret=PyTuple_New(2);
2209 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2210 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2215 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2217 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2218 if(!PyTuple_Check(args))
2219 throw INTERP_KERNEL::Exception(MSG);
2220 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2221 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2222 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2224 PyObject *tmp0(PyTuple_New(1));
2225 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2226 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2228 Py_DECREF(selfMeth);
2229 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2230 int sz(PyTuple_Size(args));
2232 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2233 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2234 PyObject *zeNumpyRepr(0);
2235 PyObject *tmp1(PyInt_FromLong(0));
2236 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2238 PyObject *tmp3(PyTuple_New(1));
2239 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2240 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2244 Py_DECREF(initMeth);
2248 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2251 if(!self->isAllocated())
2252 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2253 PyObject *ret(PyTuple_New(1));
2254 PyObject *ret0(PyDict_New());
2255 PyObject *numpyArryObj(ParaMEDMEM_DataArrayDouble_toNumPyArray(self));
2256 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2257 PyObject *tmp1(PyInt_FromLong(0));
2258 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2259 PyTuple_SetItem(ret,0,ret0);
2263 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2269 class DataArrayDoubleTuple;
2271 class DataArrayDoubleIterator
2274 DataArrayDoubleIterator(DataArrayDouble *da);
2275 ~DataArrayDoubleIterator();
2280 DataArrayDoubleTuple *ret=self->nextt();
2282 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2285 PyErr_SetString(PyExc_StopIteration,"No more data.");
2292 class DataArrayDoubleTuple
2295 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2296 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2299 std::string __str__() const throw(INTERP_KERNEL::Exception)
2301 return self->repr();
2304 double __float__() const throw(INTERP_KERNEL::Exception)
2306 return self->doubleValue();
2309 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2311 return self->buildDADouble(1,self->getNumberOfCompo());
2314 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2316 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2317 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2318 Py_XINCREF(trueSelf);
2322 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2324 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2325 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2326 Py_XINCREF(trueSelf);
2330 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2332 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2333 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2334 Py_XINCREF(trueSelf);
2338 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2340 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2341 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2342 Py_XINCREF(trueSelf);
2346 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2348 return PyInt_FromLong(self->getNumberOfCompo());
2351 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2353 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2356 std::vector<int> multiVal;
2357 std::pair<int, std::pair<int,int> > slic;
2358 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2359 const double *pt=self->getConstPointer();
2360 int nbc=self->getNumberOfCompo();
2361 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2368 std::ostringstream oss;
2369 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2370 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2374 return PyFloat_FromDouble(pt[singleVal]);
2378 return PyFloat_FromDouble(pt[nbc+singleVal]);
2381 std::ostringstream oss;
2382 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2383 throw INTERP_KERNEL::Exception(oss.str().c_str());
2389 PyObject *t=PyTuple_New(multiVal.size());
2390 for(int j=0;j<(int)multiVal.size();j++)
2392 int cid=multiVal[j];
2395 std::ostringstream oss;
2396 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2397 throw INTERP_KERNEL::Exception(oss.str().c_str());
2399 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2405 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2406 PyObject *t=PyTuple_New(sz);
2407 for(int j=0;j<sz;j++)
2408 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2412 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2416 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2418 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2419 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2422 std::vector<double> multiValV;
2423 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2424 int nbc=self->getNumberOfCompo();
2425 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2427 std::vector<int> multiVal;
2428 std::pair<int, std::pair<int,int> > slic;
2429 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2430 double *pt=self->getPointer();
2431 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2438 std::ostringstream oss;
2439 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2440 throw INTERP_KERNEL::Exception(oss.str().c_str());
2446 pt[singleVal]=singleValV;
2451 if(multiValV.size()!=1)
2453 std::ostringstream oss;
2454 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2455 throw INTERP_KERNEL::Exception(oss.str().c_str());
2457 pt[singleVal]=multiValV[0];
2462 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2466 throw INTERP_KERNEL::Exception(msg);
2475 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2479 std::ostringstream oss;
2480 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2481 throw INTERP_KERNEL::Exception(oss.str().c_str());
2489 if(multiVal.size()!=multiValV.size())
2491 std::ostringstream oss;
2492 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2493 throw INTERP_KERNEL::Exception(oss.str().c_str());
2495 for(int i=0;i<(int)multiVal.size();i++)
2497 int pos=multiVal[i];
2500 std::ostringstream oss;
2501 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2502 throw INTERP_KERNEL::Exception(oss.str().c_str());
2504 pt[multiVal[i]]=multiValV[i];
2510 const double *ptV=daIntTyyppV->getConstPointer();
2511 if(nbc>daIntTyyppV->getNumberOfCompo())
2513 std::ostringstream oss;
2514 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2515 throw INTERP_KERNEL::Exception(oss.str().c_str());
2517 std::copy(ptV,ptV+nbc,pt);
2521 throw INTERP_KERNEL::Exception(msg);
2526 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2531 for(int j=0;j<sz;j++)
2532 pt[slic.first+j*slic.second.second]=singleValV;
2537 if(sz!=(int)multiValV.size())
2539 std::ostringstream oss;
2540 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2541 throw INTERP_KERNEL::Exception(oss.str().c_str());
2543 for(int j=0;j<sz;j++)
2544 pt[slic.first+j*slic.second.second]=multiValV[j];
2549 const double *ptV=daIntTyyppV->getConstPointer();
2550 if(sz>daIntTyyppV->getNumberOfCompo())
2552 std::ostringstream oss;
2553 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2554 throw INTERP_KERNEL::Exception(oss.str().c_str());
2556 for(int j=0;j<sz;j++)
2557 pt[slic.first+j*slic.second.second]=ptV[j];
2561 throw INTERP_KERNEL::Exception(msg);
2565 throw INTERP_KERNEL::Exception(msg);
2571 class DataArrayIntIterator;
2573 class DataArrayInt : public DataArray
2576 static DataArrayInt *New();
2577 int intValue() const throw(INTERP_KERNEL::Exception);
2578 int getHashCode() const throw(INTERP_KERNEL::Exception);
2579 bool empty() const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2581 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2582 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2583 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2584 int popBackSilent() throw(INTERP_KERNEL::Exception);
2585 void pack() const throw(INTERP_KERNEL::Exception);
2586 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2587 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2588 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2589 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2591 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2592 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2593 void reverse() throw(INTERP_KERNEL::Exception);
2594 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2595 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2596 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2597 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2598 void fillWithZero() throw(INTERP_KERNEL::Exception);
2599 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2600 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2601 void replaceOneValByInThis(int valToBeReplaced, int replacedBy) throw(INTERP_KERNEL::Exception);
2602 std::string repr() const throw(INTERP_KERNEL::Exception);
2603 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2604 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2605 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2606 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2607 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2608 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2609 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2610 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2611 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2612 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2613 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2614 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2615 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2616 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2617 void transpose() throw(INTERP_KERNEL::Exception);
2618 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2619 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2620 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2621 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2622 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2623 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2624 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2625 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2626 int front() const throw(INTERP_KERNEL::Exception);
2627 int back() const throw(INTERP_KERNEL::Exception);
2628 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2629 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2630 int *getPointer() throw(INTERP_KERNEL::Exception);
2631 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2632 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2633 const int *begin() const throw(INTERP_KERNEL::Exception);
2634 const int *end() const throw(INTERP_KERNEL::Exception);
2635 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2636 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2637 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2638 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2639 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2640 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2641 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2642 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2643 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2644 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2645 int count(int value) const throw(INTERP_KERNEL::Exception);
2646 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2647 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2648 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2649 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2650 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2651 void abs() throw(INTERP_KERNEL::Exception);
2652 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2653 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2654 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2655 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2656 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2657 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2658 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2659 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2660 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2661 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2662 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2663 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2664 DataArrayInt *getIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2665 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2666 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2667 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2668 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2669 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2670 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2671 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2672 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2673 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2675 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2677 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2678 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2679 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2680 void computeOffsets() throw(INTERP_KERNEL::Exception);
2681 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2682 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2683 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2684 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2685 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2686 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2688 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2689 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2690 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2691 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2692 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2693 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2694 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2695 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2696 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2697 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2698 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2699 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2701 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2704 DataArrayInt() throw(INTERP_KERNEL::Exception)
2706 return DataArrayInt::New();
2709 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2711 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)";
2712 std::string msg(msgBase);
2714 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2717 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2721 if(PyInt_Check(nbOfTuples))
2723 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2725 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2728 if(PyInt_Check(nbOfComp))
2729 {//DataArrayInt.New([1,3,4,5],2,2)
2730 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2732 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2733 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2734 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2735 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2739 throw INTERP_KERNEL::Exception(msg.c_str());
2742 {//DataArrayInt.New([1,3,4],3)
2743 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2745 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2746 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2751 throw INTERP_KERNEL::Exception(msg.c_str());
2754 {// DataArrayInt.New([1,3,4])
2755 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2756 int tmpp1=-1,tmpp2=-1;
2757 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2758 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2762 else if(PyInt_Check(elt0))
2764 int nbOfTuples1=PyInt_AS_LONG(elt0);
2766 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2771 if(PyInt_Check(nbOfTuples))
2772 {//DataArrayInt.New(5,2)
2773 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2775 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2776 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2777 ret->alloc(nbOfTuples1,nbOfCompo);
2781 throw INTERP_KERNEL::Exception(msg.c_str());
2784 throw INTERP_KERNEL::Exception(msg.c_str());
2787 {//DataArrayInt.New(5)
2788 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2789 ret->alloc(nbOfTuples1,1);
2794 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2795 {//DataArrayInt.New(numpyArray)
2796 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2800 throw INTERP_KERNEL::Exception(msg.c_str());
2801 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2804 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2806 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2809 std::string __str__() const throw(INTERP_KERNEL::Exception)
2811 return self->reprNotTooLong();
2814 int __len__() const throw(INTERP_KERNEL::Exception)
2816 if(self->isAllocated())
2818 return self->getNumberOfTuples();
2822 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2826 int __int__() const throw(INTERP_KERNEL::Exception)
2828 return self->intValue();
2831 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2833 return self->iterator();
2836 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2838 int sz=self->getNumberOfComponents();
2839 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2840 self->accumulate(tmp);
2841 return convertIntArrToPyList(tmp,sz);
2844 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2847 std::vector<int> val2;
2848 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2849 return self->accumulatePerChunck(bg,bg+sz);
2852 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2855 std::vector<int> val2;
2856 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2857 return self->getIdsEqualTuple(bg,bg+sz);
2860 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2862 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2863 PyObject *ret=PyList_New(slcs.size());
2864 for(std::size_t i=0;i<slcs.size();i++)
2865 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2869 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2871 if(!PySlice_Check(slic))
2872 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2873 Py_ssize_t strt=2,stp=2,step=2;
2874 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2875 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2876 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2877 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 !");
2878 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2881 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2884 self->getMinMaxValues(a,b);
2885 PyObject *ret=PyTuple_New(2);
2886 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2887 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2891 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2893 int newNbOfTuples=-1;
2894 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2895 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2896 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2897 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2898 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2899 PyObject *ret=PyTuple_New(2);
2900 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2901 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2905 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2907 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
2908 int szArr,sw,iTypppArr;
2909 std::vector<int> stdvecTyyppArr;
2910 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2911 int *pt(ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2912 ret->useArray(pt,true,ParaMEDMEM::C_DEALLOC,szArr,1);
2916 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2918 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 !";
2919 if(PyList_Check(li) || PyTuple_Check(li))
2923 if(PyInt_Check(nbOfTuples))
2925 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2927 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2930 if(PyInt_Check(nbOfComp))
2931 {//DataArrayInt.setValues([1,3,4,5],2,2)
2932 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2934 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2935 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2936 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2939 throw INTERP_KERNEL::Exception(msg);
2942 {//DataArrayInt.setValues([1,3,4],3)
2944 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2945 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2949 throw INTERP_KERNEL::Exception(msg);
2952 {// DataArrayInt.setValues([1,3,4])
2953 int tmpp1=-1,tmpp2=-1;
2954 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2955 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2959 throw INTERP_KERNEL::Exception(msg);
2962 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2964 const int *vals=self->getConstPointer();
2965 return convertIntArrToPyList(vals,self->getNbOfElems());
2969 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2971 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2975 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2978 bool ret0=self->isEqualIfNotWhy(other,ret1);
2979 PyObject *ret=PyTuple_New(2);
2980 PyObject *ret0Py=ret0?Py_True:Py_False;
2982 PyTuple_SetItem(ret,0,ret0Py);
2983 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2987 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2989 const int *vals=self->getConstPointer();
2990 int nbOfComp=self->getNumberOfComponents();
2991 int nbOfTuples=self->getNumberOfTuples();
2992 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2995 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2997 std::vector<const DataArrayInt *> groups;
2998 std::vector< std::vector<int> > fidsOfGroups;
2999 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
3000 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3001 PyObject *ret = PyList_New(2);
3002 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3003 int sz=fidsOfGroups.size();
3004 PyObject *ret1 = PyList_New(sz);
3005 for(int i=0;i<sz;i++)
3006 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3007 PyList_SetItem(ret,1,ret1);
3011 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3014 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3015 if (!SWIG_IsOK(res1))
3018 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3019 self->transformWithIndArr(tmp,tmp+size);
3023 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3024 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3028 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3032 std::vector<int> multiVal;
3033 std::pair<int, std::pair<int,int> > slic;
3034 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3035 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3039 return self->getIdsEqualList(&singleVal,&singleVal+1);
3041 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3043 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3045 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3049 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3053 std::vector<int> multiVal;
3054 std::pair<int, std::pair<int,int> > slic;
3055 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3056 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3060 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
3062 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3064 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3066 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3070 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3072 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3074 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3075 if (!SWIG_IsOK(res1))
3078 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3079 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3083 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3085 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3086 da2->checkAllocated();
3087 int size=self->getNumberOfTuples();
3088 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
3090 PyObject *ret = PyList_New(3);
3091 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3092 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3093 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3097 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3100 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3101 if (!SWIG_IsOK(res1))
3104 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3105 return self->transformWithIndArrR(tmp,tmp+size);
3109 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3110 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3114 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3117 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3118 if (!SWIG_IsOK(res1))
3121 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3122 if(size!=self->getNumberOfTuples())
3124 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3126 return self->renumberAndReduce(tmp,newNbOfTuple);
3130 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3132 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3133 da2->checkAllocated();
3134 int size=self->getNumberOfTuples();
3135 if(size!=self->getNumberOfTuples())
3137 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3139 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3143 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3146 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3147 if (!SWIG_IsOK(res1))
3150 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3151 if(size!=self->getNumberOfTuples())
3153 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3155 return self->renumber(tmp);
3159 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3161 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3162 da2->checkAllocated();
3163 int size=self->getNumberOfTuples();
3164 if(size!=self->getNumberOfTuples())
3166 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3168 return self->renumber(da2->getConstPointer());
3172 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3175 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3176 if (!SWIG_IsOK(res1))
3179 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3180 if(size!=self->getNumberOfTuples())
3182 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3184 return self->renumberR(tmp);
3188 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3190 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3191 da2->checkAllocated();
3192 int size=self->getNumberOfTuples();
3193 if(size!=self->getNumberOfTuples())
3195 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3197 return self->renumberR(da2->getConstPointer());
3201 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3203 std::vector<int> tmp;
3204 convertPyToNewIntArr3(li,tmp);
3205 self->setSelectedComponents(a,tmp);
3208 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3210 int sz=self->getNumberOfComponents();
3211 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3212 self->getTuple(tupleId,tmp);
3213 return convertIntArrToPyList(tmp,sz);
3216 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3218 DataArrayInt *arr=0;
3219 DataArrayInt *arrI=0;
3220 self->changeSurjectiveFormat(targetNb,arr,arrI);
3221 PyObject *res = PyList_New(2);
3222 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3223 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3227 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3229 std::vector<const DataArrayInt *> tmp;
3230 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3231 return DataArrayInt::Meld(tmp);
3234 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3236 std::vector<const DataArrayInt *> tmp;
3237 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3238 return DataArrayInt::Aggregate(tmp);
3241 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3243 std::vector<const DataArrayInt *> tmp;
3244 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3245 return DataArrayInt::AggregateIndexes(tmp);
3248 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3250 std::vector<const DataArrayInt *> tmp;
3251 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3252 return DataArrayInt::BuildUnion(tmp);
3255 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3257 std::vector<const DataArrayInt *> tmp;
3258 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3259 return DataArrayInt::BuildIntersection(tmp);
3262 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3265 int r1=self->getMaxValue(tmp);
3266 PyObject *ret=PyTuple_New(2);
3267 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3268 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3272 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3275 int r1=self->getMinValue(tmp);
3276 PyObject *ret=PyTuple_New(2);
3277 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3278 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3282 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3284 int nbOfCompo=self->getNumberOfComponents();
3289 if(PyInt_Check(obj))
3291 int val=(int)PyInt_AS_LONG(obj);
3292 return self->locateValue(val);
3295 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3299 std::vector<int> arr;
3300 convertPyToNewIntArr3(obj,arr);
3301 return self->locateTuple(arr);
3306 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3308 int nbOfCompo=self->getNumberOfComponents();
3315 if(PyInt_Check(obj))
3317 int val=(int)PyInt_AS_LONG(obj);
3318 return self->presenceOfValue(val);
3321 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3325 std::vector<int> arr;
3326 convertPyToNewIntArr3(obj,arr);
3327 return self->presenceOfTuple(arr);
3332 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3334 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3335 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3336 self->checkAllocated();
3337 int nbOfTuples=self->getNumberOfTuples();
3338 int nbOfComponents=self->getNumberOfComponents();
3340 std::vector<int> vt1,vc1;
3341 std::pair<int, std::pair<int,int> > pt1,pc1;
3342 DataArrayInt *dt1=0,*dc1=0;
3344 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3345 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3350 if(nbOfComponents==1)
3351 return PyInt_FromLong(self->getIJSafe(it1,0));
3352 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3355 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3357 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3359 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3361 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3364 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3365 std::vector<int> v2(1,ic1);
3366 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3370 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3371 std::vector<int> v2(1,ic1);
3372 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3376 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3377 std::vector<int> v2(1,ic1);
3378 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3382 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3383 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3387 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3388 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3392 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3393 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3397 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3398 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3402 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3403 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3404 std::vector<int> v2(nbOfComp);
3405 for(int i=0;i<nbOfComp;i++)
3406 v2[i]=pc1.first+i*pc1.second.second;
3407 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3411 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3412 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3413 std::vector<int> v2(nbOfComp);
3414 for(int i=0;i<nbOfComp;i++)
3415 v2[i]=pc1.first+i*pc1.second.second;
3416 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3420 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3421 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3422 std::vector<int> v2(nbOfComp);
3423 for(int i=0;i<nbOfComp;i++)
3424 v2[i]=pc1.first+i*pc1.second.second;
3425 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3429 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3430 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3431 std::vector<int> v2(nbOfComp);
3432 for(int i=0;i<nbOfComp;i++)
3433 v2[i]=pc1.first+i*pc1.second.second;
3434 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3437 throw INTERP_KERNEL::Exception(msg);
3441 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3443 self->checkAllocated();
3444 const char msg[]="Unexpected situation in __setitem__ !";
3445 int nbOfTuples=self->getNumberOfTuples();
3446 int nbOfComponents=self->getNumberOfComponents();
3449 std::vector<int> v1;
3451 DataArrayIntTuple *dd1=0;
3452 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3454 std::vector<int> vt1,vc1;
3455 std::pair<int, std::pair<int,int> > pt1,pc1;
3456 DataArrayInt *dt1=0,*dc1=0;
3457 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3458 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3466 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3469 tmp=DataArrayInt::New();
3470 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3471 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3474 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3477 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3478 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3481 throw INTERP_KERNEL::Exception(msg);
3490 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3493 tmp=DataArrayInt::New();
3494 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3495 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3498 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3501 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3502 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3505 throw INTERP_KERNEL::Exception(msg);
3514 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3517 tmp=DataArrayInt::New();
3518 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3519 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3522 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3525 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3526 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3529 throw INTERP_KERNEL::Exception(msg);
3538 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3541 tmp=DataArrayInt::New();
3542 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3543 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3546 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3549 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3550 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3553 throw INTERP_KERNEL::Exception(msg);
3562 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3565 tmp=DataArrayInt::New();
3566 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3567 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3570 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3573 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3574 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3577 throw INTERP_KERNEL::Exception(msg);
3586 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3589 tmp=DataArrayInt::New();
3590 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3591 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3594 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3597 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3598 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3601 throw INTERP_KERNEL::Exception(msg);
3610 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3613 tmp=DataArrayInt::New();
3614 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3615 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3618 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3621 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3622 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3625 throw INTERP_KERNEL::Exception(msg);
3634 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3637 tmp=DataArrayInt::New();
3638 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3639 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3642 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3645 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3646 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3649 throw INTERP_KERNEL::Exception(msg);
3658 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3661 tmp=DataArrayInt::New();
3662 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3663 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3666 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3669 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3670 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3673 throw INTERP_KERNEL::Exception(msg);
3682 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3685 tmp=DataArrayInt::New();
3686 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3687 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3690 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3693 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3694 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3697 throw INTERP_KERNEL::Exception(msg);
3706 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3709 tmp=DataArrayInt::New();
3710 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3711 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3714 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3717 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3718 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3721 throw INTERP_KERNEL::Exception(msg);
3730 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3733 tmp=DataArrayInt::New();
3734 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3735 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3738 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3741 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3742 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3745 throw INTERP_KERNEL::Exception(msg);
3754 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3757 tmp=DataArrayInt::New();
3758 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3759 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3762 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3765 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3766 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3769 throw INTERP_KERNEL::Exception(msg);
3778 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3781 tmp=DataArrayInt::New();
3782 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3783 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3786 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3789 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3790 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3793 throw INTERP_KERNEL::Exception(msg);
3802 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3805 tmp=DataArrayInt::New();
3806 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3807 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3810 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3813 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3814 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3817 throw INTERP_KERNEL::Exception(msg);
3826 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3829 tmp=DataArrayInt::New();
3830 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3831 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3834 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3837 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3838 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3841 throw INTERP_KERNEL::Exception(msg);
3846 throw INTERP_KERNEL::Exception(msg);
3851 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3853 return self->negate();
3856 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3858 const char msg[]="Unexpected situation in __add__ !";
3861 std::vector<int> aa;
3862 DataArrayIntTuple *aaa;
3864 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3869 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3870 ret->applyLin(1,val);
3875 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3876 return DataArrayInt::Add(self,aaaa);
3880 return DataArrayInt::Add(self,a);
3884 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3885 return DataArrayInt::Add(self,aaaa);
3888 throw INTERP_KERNEL::Exception(msg);
3892 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3894 const char msg[]="Unexpected situation in __radd__ !";
3897 std::vector<int> aa;
3898 DataArrayIntTuple *aaa;
3900 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3905 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3906 ret->applyLin(1,val);
3911 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3912 return DataArrayInt::Add(self,aaaa);
3916 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3917 return DataArrayInt::Add(self,aaaa);
3920 throw INTERP_KERNEL::Exception(msg);
3924 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3926 const char msg[]="Unexpected situation in __iadd__ !";
3929 std::vector<int> aa;
3930 DataArrayIntTuple *aaa;
3932 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3937 self->applyLin(1,val);
3938 Py_XINCREF(trueSelf);
3943 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3945 Py_XINCREF(trueSelf);
3951 Py_XINCREF(trueSelf);
3956 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3957 self->addEqual(aaaa);
3958 Py_XINCREF(trueSelf);
3962 throw INTERP_KERNEL::Exception(msg);
3966 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3968 const char msg[]="Unexpected situation in __sub__ !";
3971 std::vector<int> aa;
3972 DataArrayIntTuple *aaa;
3974 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3979 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3980 ret->applyLin(1,-val);
3985 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3986 return DataArrayInt::Substract(self,aaaa);
3990 return DataArrayInt::Substract(self,a);
3994 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3995 return DataArrayInt::Substract(self,aaaa);
3998 throw INTERP_KERNEL::Exception(msg);
4002 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4004 const char msg[]="Unexpected situation in __rsub__ !";
4007 std::vector<int> aa;
4008 DataArrayIntTuple *aaa;
4010 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4015 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4016 ret->applyLin(-1,val);
4021 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4022 return DataArrayInt::Substract(aaaa,self);
4026 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4027 return DataArrayInt::Substract(aaaa,self);
4030 throw INTERP_KERNEL::Exception(msg);
4034 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4036 const char msg[]="Unexpected situation in __isub__ !";
4039 std::vector<int> aa;
4040 DataArrayIntTuple *aaa;
4042 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4047 self->applyLin(1,-val);
4048 Py_XINCREF(trueSelf);
4053 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4054 self->substractEqual(bb);
4055 Py_XINCREF(trueSelf);
4060 self->substractEqual(a);
4061 Py_XINCREF(trueSelf);
4066 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4067 self->substractEqual(aaaa);
4068 Py_XINCREF(trueSelf);
4072 throw INTERP_KERNEL::Exception(msg);
4076 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4078 const char msg[]="Unexpected situation in __mul__ !";
4081 std::vector<int> aa;
4082 DataArrayIntTuple *aaa;
4084 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4089 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4090 ret->applyLin(val,0);
4095 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4096 return DataArrayInt::Multiply(self,aaaa);
4100 return DataArrayInt::Multiply(self,a);
4104 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4105 return DataArrayInt::Multiply(self,aaaa);
4108 throw INTERP_KERNEL::Exception(msg);
4112 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4114 const char msg[]="Unexpected situation in __rmul__ !";
4117 std::vector<int> aa;
4118 DataArrayIntTuple *aaa;
4120 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4125 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4126 ret->applyLin(val,0);
4131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4132 return DataArrayInt::Multiply(self,aaaa);
4136 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4137 return DataArrayInt::Multiply(self,aaaa);
4140 throw INTERP_KERNEL::Exception(msg);
4144 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4146 const char msg[]="Unexpected situation in __imul__ !";
4149 std::vector<int> aa;
4150 DataArrayIntTuple *aaa;
4152 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4157 self->applyLin(val,0);
4158 Py_XINCREF(trueSelf);
4163 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4164 self->multiplyEqual(bb);
4165 Py_XINCREF(trueSelf);
4170 self->multiplyEqual(a);
4171 Py_XINCREF(trueSelf);
4176 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4177 self->multiplyEqual(aaaa);
4178 Py_XINCREF(trueSelf);
4182 throw INTERP_KERNEL::Exception(msg);
4186 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4188 const char msg[]="Unexpected situation in __div__ !";
4191 std::vector<int> aa;
4192 DataArrayIntTuple *aaa;
4194 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4199 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4200 ret->applyDivideBy(val);
4205 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4206 return DataArrayInt::Divide(self,aaaa);
4210 return DataArrayInt::Divide(self,a);
4214 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4215 return DataArrayInt::Divide(self,aaaa);
4218 throw INTERP_KERNEL::Exception(msg);
4222 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4224 const char msg[]="Unexpected situation in __rdiv__ !";
4227 std::vector<int> aa;
4228 DataArrayIntTuple *aaa;
4230 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4235 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4241 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4242 return DataArrayInt::Divide(aaaa,self);
4246 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4247 return DataArrayInt::Divide(aaaa,self);
4250 throw INTERP_KERNEL::Exception(msg);
4254 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4256 const char msg[]="Unexpected situation in __idiv__ !";
4259 std::vector<int> aa;
4260 DataArrayIntTuple *aaa;
4262 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4267 self->applyDivideBy(val);
4268 Py_XINCREF(trueSelf);
4273 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4274 self->divideEqual(bb);
4275 Py_XINCREF(trueSelf);
4280 self->divideEqual(a);
4281 Py_XINCREF(trueSelf);
4286 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4287 self->divideEqual(aaaa);
4288 Py_XINCREF(trueSelf);
4292 throw INTERP_KERNEL::Exception(msg);
4296 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4298 const char msg[]="Unexpected situation in __mod__ !";
4301 std::vector<int> aa;
4302 DataArrayIntTuple *aaa;
4304 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4309 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4310 ret->applyModulus(val);
4315 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4316 return DataArrayInt::Modulus(self,aaaa);
4320 return DataArrayInt::Modulus(self,a);
4324 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4325 return DataArrayInt::Modulus(self,aaaa);
4328 throw INTERP_KERNEL::Exception(msg);
4332 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4334 const char msg[]="Unexpected situation in __rmod__ !";
4337 std::vector<int> aa;
4338 DataArrayIntTuple *aaa;
4340 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4345 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4346 ret->applyRModulus(val);
4351 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4352 return DataArrayInt::Modulus(aaaa,self);
4356 return DataArrayInt::Modulus(a,self);
4360 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4361 return DataArrayInt::Modulus(aaaa,self);
4364 throw INTERP_KERNEL::Exception(msg);
4368 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4370 const char msg[]="Unexpected situation in __imod__ !";
4373 std::vector<int> aa;
4374 DataArrayIntTuple *aaa;
4376 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4381 self->applyModulus(val);
4382 Py_XINCREF(trueSelf);
4387 self->modulusEqual(a);
4388 Py_XINCREF(trueSelf);
4393 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4394 self->modulusEqual(aaaa);
4395 Py_XINCREF(trueSelf);
4399 throw INTERP_KERNEL::Exception(msg);
4403 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4405 const char msg[]="Unexpected situation in __pow__ !";
4408 std::vector<int> aa;
4409 DataArrayIntTuple *aaa;
4411 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4416 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4422 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4423 return DataArrayInt::Pow(self,aaaa);
4427 return DataArrayInt::Pow(self,a);
4431 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4432 return DataArrayInt::Pow(self,aaaa);
4435 throw INTERP_KERNEL::Exception(msg);
4439 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4441 const char msg[]="Unexpected situation in __rpow__ !";
4444 std::vector<int> aa;
4445 DataArrayIntTuple *aaa;
4447 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4452 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4453 ret->applyRPow(val);
4458 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4459 return DataArrayInt::Pow(aaaa,self);
4463 return DataArrayInt::Pow(a,self);
4467 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4468 return DataArrayInt::Pow(aaaa,self);
4471 throw INTERP_KERNEL::Exception(msg);
4475 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4477 const char msg[]="Unexpected situation in __ipow__ !";
4480 std::vector<int> aa;
4481 DataArrayIntTuple *aaa;
4483 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4488 self->applyPow(val);
4489 Py_XINCREF(trueSelf);
4495 Py_XINCREF(trueSelf);
4500 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4501 self->powEqual(aaaa);
4502 Py_XINCREF(trueSelf);
4506 throw INTERP_KERNEL::Exception(msg);
4510 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4512 std::ostringstream oss;
4513 self->reprQuickOverview(oss);
4517 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4519 int szArr,sw,iTypppArr;
4520 std::vector<int> stdvecTyyppArr;
4521 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4522 self->pushBackValsSilent(tmp,tmp+szArr);
4525 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4527 std::vector<int> ret1;
4528 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4529 std::size_t sz=ret0.size();
4530 PyObject *pyRet=PyTuple_New(2);
4531 PyObject *pyRet0=PyList_New((int)sz);
4532 PyObject *pyRet1=PyList_New((int)sz);
4533 for(std::size_t i=0;i<sz;i++)
4535 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4536 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4538 PyTuple_SetItem(pyRet,0,pyRet0);
4539 PyTuple_SetItem(pyRet,1,pyRet1);
4543 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4545 DataArrayInt *ret0=0,*ret1=0;
4546 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4547 PyObject *pyRet=PyTuple_New(2);
4548 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4549 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4553 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4556 bool ret(self->isRange(a,b,c));
4557 PyObject *pyRet=PyTuple_New(2);
4558 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4560 PyTuple_SetItem(pyRet,0,ret0Py);
4562 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4568 PyTuple_SetItem(pyRet,1,ret1Py);
4573 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4575 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4576 if(!PyTuple_Check(args))
4577 throw INTERP_KERNEL::Exception(MSG);
4578 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4579 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4580 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4582 PyObject *tmp0(PyTuple_New(1));
4583 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4584 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4586 Py_DECREF(selfMeth);
4587 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4588 int sz(PyTuple_Size(args));
4590 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4591 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4592 PyObject *zeNumpyRepr(0);
4593 PyObject *tmp1(PyInt_FromLong(0));
4594 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4596 PyObject *tmp3(PyTuple_New(1));
4597 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4598 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4602 Py_DECREF(initMeth);
4606 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4609 if(!self->isAllocated())
4610 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4611 PyObject *ret(PyTuple_New(1));
4612 PyObject *ret0(PyDict_New());
4613 PyObject *numpyArryObj(ParaMEDMEM_DataArrayInt_toNumPyArray(self));
4614 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4615 PyObject *tmp1(PyInt_FromLong(0));
4616 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4617 PyTuple_SetItem(ret,0,ret0);
4621 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4627 class DataArrayIntTuple;
4629 class DataArrayIntIterator
4632 DataArrayIntIterator(DataArrayInt *da);
4633 ~DataArrayIntIterator();
4638 DataArrayIntTuple *ret=self->nextt();
4640 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4643 PyErr_SetString(PyExc_StopIteration,"No more data.");
4650 class DataArrayIntTuple
4653 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4654 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4657 std::string __str__() const throw(INTERP_KERNEL::Exception)
4659 return self->repr();
4662 int __int__() const throw(INTERP_KERNEL::Exception)
4664 return self->intValue();
4667 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4669 return self->buildDAInt(1,self->getNumberOfCompo());
4672 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4674 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4675 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4676 Py_XINCREF(trueSelf);
4680 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4682 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4683 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4684 Py_XINCREF(trueSelf);
4688 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4690 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4691 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4692 Py_XINCREF(trueSelf);
4696 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4698 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4699 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4700 Py_XINCREF(trueSelf);
4704 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4706 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4707 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4708 Py_XINCREF(trueSelf);
4712 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4714 return PyInt_FromLong(self->getNumberOfCompo());
4717 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4719 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4722 std::vector<int> multiVal;
4723 std::pair<int, std::pair<int,int> > slic;
4724 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4725 const int *pt=self->getConstPointer();
4726 int nbc=self->getNumberOfCompo();
4727 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4734 std::ostringstream oss;
4735 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4736 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4740 return PyInt_FromLong(pt[singleVal]);
4744 return PyInt_FromLong(pt[nbc+singleVal]);
4747 std::ostringstream oss;
4748 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4749 throw INTERP_KERNEL::Exception(oss.str().c_str());
4755 PyObject *t=PyTuple_New(multiVal.size());
4756 for(int j=0;j<(int)multiVal.size();j++)
4758 int cid=multiVal[j];
4761 std::ostringstream oss;
4762 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4763 throw INTERP_KERNEL::Exception(oss.str().c_str());
4765 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4771 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4772 PyObject *t=PyTuple_New(sz);
4773 for(int j=0;j<sz;j++)
4774 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4778 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4782 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4784 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4785 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4788 std::vector<int> multiValV;
4789 std::pair<int, std::pair<int,int> > slicV;
4790 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4791 int nbc=self->getNumberOfCompo();
4792 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4794 std::vector<int> multiVal;
4795 std::pair<int, std::pair<int,int> > slic;
4796 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4797 int *pt=self->getPointer();
4798 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4805 std::ostringstream oss;
4806 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4807 throw INTERP_KERNEL::Exception(oss.str().c_str());
4813 pt[singleVal]=singleValV;
4818 if(multiValV.size()!=1)
4820 std::ostringstream oss;
4821 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4822 throw INTERP_KERNEL::Exception(oss.str().c_str());
4824 pt[singleVal]=multiValV[0];
4829 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4833 throw INTERP_KERNEL::Exception(msg);
4842 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4846 std::ostringstream oss;
4847 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4848 throw INTERP_KERNEL::Exception(oss.str().c_str());
4856 if(multiVal.size()!=multiValV.size())
4858 std::ostringstream oss;
4859 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4860 throw INTERP_KERNEL::Exception(oss.str().c_str());
4862 for(int i=0;i<(int)multiVal.size();i++)
4864 int pos=multiVal[i];
4867 std::ostringstream oss;
4868 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4869 throw INTERP_KERNEL::Exception(oss.str().c_str());
4871 pt[multiVal[i]]=multiValV[i];
4877 const int *ptV=daIntTyyppV->getConstPointer();
4878 if(nbc>daIntTyyppV->getNumberOfCompo())
4880 std::ostringstream oss;
4881 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4882 throw INTERP_KERNEL::Exception(oss.str().c_str());
4884 std::copy(ptV,ptV+nbc,pt);
4888 throw INTERP_KERNEL::Exception(msg);
4893 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4898 for(int j=0;j<sz;j++)
4899 pt[slic.first+j*slic.second.second]=singleValV;
4904 if(sz!=(int)multiValV.size())
4906 std::ostringstream oss;
4907 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4908 throw INTERP_KERNEL::Exception(oss.str().c_str());
4910 for(int j=0;j<sz;j++)
4911 pt[slic.first+j*slic.second.second]=multiValV[j];
4916 const int *ptV=daIntTyyppV->getConstPointer();
4917 if(sz>daIntTyyppV->getNumberOfCompo())
4919 std::ostringstream oss;
4920 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4921 throw INTERP_KERNEL::Exception(oss.str().c_str());
4923 for(int j=0;j<sz;j++)
4924 pt[slic.first+j*slic.second.second]=ptV[j];
4928 throw INTERP_KERNEL::Exception(msg);
4932 throw INTERP_KERNEL::Exception(msg);
4938 class DataArrayChar : public DataArray
4941 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4942 int getHashCode() const throw(INTERP_KERNEL::Exception);
4943 bool empty() const throw(INTERP_KERNEL::Exception);
4944 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4945 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4946 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4947 char popBackSilent() throw(INTERP_KERNEL::Exception);
4948 void pack() const throw(INTERP_KERNEL::Exception);
4949 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4950 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4951 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4952 void reverse() throw(INTERP_KERNEL::Exception);
4953 void fillWithZero() throw(INTERP_KERNEL::Exception);
4954 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4955 std::string repr() const throw(INTERP_KERNEL::Exception);
4956 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4957 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4958 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4959 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4960 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4961 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4962 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4963 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4964 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4965 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4966 char front() const throw(INTERP_KERNEL::Exception);
4967 char back() const throw(INTERP_KERNEL::Exception);
4968 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4969 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4970 char *getPointer() throw(INTERP_KERNEL::Exception);
4971 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4972 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4973 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4974 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4975 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4976 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4977 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4978 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4979 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4980 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4981 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4984 int __len__() const throw(INTERP_KERNEL::Exception)
4986 if(self->isAllocated())
4988 return self->getNumberOfTuples();
4992 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4996 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4999 bool ret0=self->isEqualIfNotWhy(other,ret1);
5000 PyObject *ret=PyTuple_New(2);
5001 PyObject *ret0Py=ret0?Py_True:Py_False;
5003 PyTuple_SetItem(ret,0,ret0Py);
5004 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5008 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5011 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5012 if (!SWIG_IsOK(res1))
5015 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5016 if(size!=self->getNumberOfTuples())
5018 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5020 return self->renumber(tmp);
5024 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5026 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5027 da2->checkAllocated();
5028 int size=self->getNumberOfTuples();
5029 if(size!=self->getNumberOfTuples())
5031 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5033 return self->renumber(da2->getConstPointer());
5037 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5040 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5041 if (!SWIG_IsOK(res1))
5044 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5045 if(size!=self->getNumberOfTuples())
5047 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5049 return self->renumberR(tmp);
5053 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5055 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5056 da2->checkAllocated();
5057 int size=self->getNumberOfTuples();
5058 if(size!=self->getNumberOfTuples())
5060 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5062 return self->renumberR(da2->getConstPointer());
5066 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5069 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5070 if (!SWIG_IsOK(res1))
5073 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5074 if(size!=self->getNumberOfTuples())
5076 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5078 return self->renumberAndReduce(tmp,newNbOfTuple);
5082 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5084 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5085 da2->checkAllocated();
5086 int size=self->getNumberOfTuples();
5087 if(size!=self->getNumberOfTuples())
5089 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5091 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5095 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5097 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5098 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5099 return DataArrayChar::Aggregate(tmp);
5102 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5104 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5105 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5106 return DataArrayChar::Meld(tmp);
5111 class DataArrayByteIterator;
5113 class DataArrayByte : public DataArrayChar
5116 static DataArrayByte *New();
5117 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5118 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5119 char byteValue() const throw(INTERP_KERNEL::Exception);
5122 DataArrayByte() throw(INTERP_KERNEL::Exception)
5124 return DataArrayByte::New();
5127 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5129 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) !";
5130 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5134 if(PyInt_Check(nbOfTuples))
5136 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5138 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5141 if(PyInt_Check(nbOfComp))
5142 {//DataArrayByte.New([1,3,4,5],2,2)
5143 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5145 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5146 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5147 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5148 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5152 throw INTERP_KERNEL::Exception(msg);
5155 {//DataArrayByte.New([1,3,4],3)
5156 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5158 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5159 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5164 throw INTERP_KERNEL::Exception(msg);
5167 {// DataArrayByte.New([1,3,4])
5168 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5169 int tmpp1=-1,tmpp2=-1;
5170 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5171 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5175 else if(PyInt_Check(elt0))
5177 int nbOfTuples1=PyInt_AS_LONG(elt0);
5179 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5184 if(PyInt_Check(nbOfTuples))
5185 {//DataArrayByte.New(5,2)
5186 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5188 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5189 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5190 ret->alloc(nbOfTuples1,nbOfCompo);
5194 throw INTERP_KERNEL::Exception(msg);
5197 throw INTERP_KERNEL::Exception(msg);
5200 {//DataArrayByte.New(5)
5201 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5202 ret->alloc(nbOfTuples1,1);
5207 throw INTERP_KERNEL::Exception(msg);
5210 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5212 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5215 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5217 std::ostringstream oss;
5218 self->reprQuickOverview(oss);
5222 int __int__() const throw(INTERP_KERNEL::Exception)
5224 return (int) self->byteValue();
5227 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5229 return self->iterator();
5232 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5234 return (int)self->getIJ(tupleId,compoId);
5237 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5239 return (int)self->getIJSafe(tupleId,compoId);
5242 std::string __str__() const throw(INTERP_KERNEL::Exception)
5244 return self->repr();
5247 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5249 const char *vals=self->getConstPointer();
5250 int nbOfComp=self->getNumberOfComponents();
5251 int nbOfTuples=self->getNumberOfTuples();
5252 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5255 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5258 int ival=-1; std::vector<int> ivval;
5259 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5260 std::vector<char> vals(sz);
5261 std::copy(pt,pt+sz,vals.begin());
5262 return self->presenceOfTuple(vals);
5265 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5268 int ival=-1; std::vector<int> ivval;
5269 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5270 std::vector<char> vals2(sz);
5271 std::copy(pt,pt+sz,vals2.begin());
5272 return self->presenceOfValue(vals2);
5275 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5278 int ival=-1; std::vector<int> ivval;
5279 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5280 std::vector<char> vals2(sz);
5281 std::copy(pt,pt+sz,vals2.begin());
5282 return self->locateValue(vals2);
5285 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5288 int ival=-1; std::vector<int> ivval;
5289 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5290 std::vector<char> vals(sz);
5291 std::copy(pt,pt+sz,vals.begin());
5292 return self->locateTuple(vals);
5295 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5298 int ival=-1; std::vector<int> ivval;
5299 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5300 std::vector<char> vals(sz);
5301 std::copy(pt,pt+sz,vals.begin());
5302 return self->search(vals);
5305 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5307 int sz=self->getNumberOfComponents();
5308 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5309 self->getTuple(tupleId,tmp);
5310 PyObject *ret=PyTuple_New(sz);
5311 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5315 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5318 int r1=(int)self->getMaxValue(tmp);
5319 PyObject *ret=PyTuple_New(2);
5320 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5321 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5325 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5328 int r1=(int)self->getMinValue(tmp);
5329 PyObject *ret=PyTuple_New(2);
5330 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5331 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5335 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5337 int nbOfCompo=self->getNumberOfComponents();
5342 if(PyInt_Check(obj))
5344 int val=(int)PyInt_AS_LONG(obj);
5345 return self->locateValue(val);
5348 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5351 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5355 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5357 int nbOfCompo=self->getNumberOfComponents();
5364 if(PyInt_Check(obj))
5366 int val=(int)PyInt_AS_LONG(obj);
5367 return self->presenceOfValue(val);
5370 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5373 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5377 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5379 self->checkAllocated();
5380 const char msg[]="Unexpected situation in __setitem__ !";
5381 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5384 std::vector<int> v1;
5386 DataArrayIntTuple *dd1=0;
5387 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5389 std::vector<int> vt1,vc1;
5390 std::pair<int, std::pair<int,int> > pt1,pc1;
5391 DataArrayInt *dt1=0,*dc1=0;
5392 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5393 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5401 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5404 throw INTERP_KERNEL::Exception(msg);
5413 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5416 throw INTERP_KERNEL::Exception(msg);
5425 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5428 throw INTERP_KERNEL::Exception(msg);
5437 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5440 throw INTERP_KERNEL::Exception(msg);
5449 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5452 throw INTERP_KERNEL::Exception(msg);
5461 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5464 throw INTERP_KERNEL::Exception(msg);
5473 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5476 throw INTERP_KERNEL::Exception(msg);
5485 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5488 throw INTERP_KERNEL::Exception(msg);
5497 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5500 throw INTERP_KERNEL::Exception(msg);
5509 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5512 throw INTERP_KERNEL::Exception(msg);
5521 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5524 throw INTERP_KERNEL::Exception(msg);
5533 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5536 throw INTERP_KERNEL::Exception(msg);
5545 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5548 throw INTERP_KERNEL::Exception(msg);
5557 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5560 throw INTERP_KERNEL::Exception(msg);
5569 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5572 throw INTERP_KERNEL::Exception(msg);
5581 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5584 throw INTERP_KERNEL::Exception(msg);
5589 throw INTERP_KERNEL::Exception(msg);
5596 class DataArrayByteTuple;
5598 class DataArrayByteIterator
5601 DataArrayByteIterator(DataArrayByte *da);
5602 ~DataArrayByteIterator();
5605 class DataArrayByteTuple
5608 std::string repr() const throw(INTERP_KERNEL::Exception);
5609 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5612 std::string __str__() const throw(INTERP_KERNEL::Exception)
5614 return self->repr();
5617 char __int__() const throw(INTERP_KERNEL::Exception)
5619 return self->byteValue();
5622 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5624 return self->buildDAByte(1,self->getNumberOfCompo());
5629 class DataArrayAsciiCharIterator;
5631 class DataArrayAsciiChar : public DataArrayChar
5634 static DataArrayAsciiChar *New();
5635 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5636 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5637 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5640 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5642 return DataArrayAsciiChar::New();
5645 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5647 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) !";
5648 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5652 if(PyInt_Check(nbOfTuples))
5654 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5656 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5659 if(PyInt_Check(nbOfComp))
5660 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5661 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5663 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5664 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5665 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5666 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5670 throw INTERP_KERNEL::Exception(msg);
5673 {//DataArrayAsciiChar.New([1,3,4],3)
5674 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5676 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5677 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5681 else if(PyString_Check(nbOfTuples))
5683 if(PyString_Size(nbOfTuples)!=1)
5684 throw INTERP_KERNEL::Exception(msg);
5685 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5686 std::vector<std::string> tmp;
5687 if(fillStringVector(elt0,tmp))
5688 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5690 throw INTERP_KERNEL::Exception(msg);
5693 throw INTERP_KERNEL::Exception(msg);
5697 std::vector<std::string> tmmp;
5698 if(fillStringVector(elt0,tmmp))
5699 //DataArrayAsciiChar.New(["abc","de","fghi"])
5700 return DataArrayAsciiChar::New(tmmp,' ');
5703 // DataArrayAsciiChar.New([1,3,4])
5704 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5705 int tmpp1=-1,tmpp2=-1;
5706 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5707 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5712 else if(PyInt_Check(elt0))
5714 int nbOfTuples1=PyInt_AS_LONG(elt0);
5716 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5721 if(PyInt_Check(nbOfTuples))
5722 {//DataArrayAsciiChar.New(5,2)
5723 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5725 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5726 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5727 ret->alloc(nbOfTuples1,nbOfCompo);
5731 throw INTERP_KERNEL::Exception(msg);
5734 throw INTERP_KERNEL::Exception(msg);
5737 {//DataArrayAsciiChar.New(5)
5738 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5739 ret->alloc(nbOfTuples1,1);
5744 throw INTERP_KERNEL::Exception(msg);
5747 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5749 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5752 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5754 std::ostringstream oss;
5755 self->reprQuickOverview(oss);
5759 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5761 return self->iterator();
5764 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5766 char tmp[2]; tmp[1]='\0';
5767 tmp[0]=self->getIJ(tupleId,compoId);
5768 return std::string(tmp);
5771 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5773 char tmp[2]; tmp[1]='\0';
5774 tmp[0]=self->getIJSafe(tupleId,compoId);
5775 return std::string(tmp);
5778 std::string __str__() const throw(INTERP_KERNEL::Exception)
5780 return self->repr();
5783 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5785 const char *vals=self->getConstPointer();
5786 int nbOfComp=self->getNumberOfComponents();
5787 int nbOfTuples=self->getNumberOfTuples();
5788 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5791 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5793 if(PyString_Check(tupl))
5795 Py_ssize_t sz=PyString_Size(tupl);
5796 std::vector<char> vals(sz);
5797 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5798 return self->presenceOfTuple(vals);
5801 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5804 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5806 if(PyString_Check(vals))
5808 Py_ssize_t sz=PyString_Size(vals);
5809 std::vector<char> vals2(sz);
5810 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5811 return self->presenceOfValue(vals2);
5814 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5817 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5819 if(PyString_Check(vals))
5821 Py_ssize_t sz=PyString_Size(vals);
5822 std::vector<char> vals2(sz);
5823 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5824 return self->locateValue(vals2);
5827 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5830 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5832 if(PyString_Check(tupl))
5834 Py_ssize_t sz=PyString_Size(tupl);
5835 std::vector<char> vals(sz);
5836 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5837 return self->locateTuple(vals);
5840 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5843 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5845 if(PyString_Check(strOrListOfInt))
5847 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5848 std::vector<char> vals(sz);
5849 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5850 return self->search(vals);
5853 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5856 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5858 int sz=self->getNumberOfComponents();
5859 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5860 self->getTuple(tupleId,tmp);
5861 return PyString_FromString(tmp);
5864 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5867 char tmp2[2]; tmp2[1]='\0';
5868 tmp2[0]=self->getMaxValue(tmp);
5869 PyObject *ret=PyTuple_New(2);
5870 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5871 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5875 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5878 char tmp2[2]; tmp2[1]='\0';
5879 tmp2[0]=self->getMinValue(tmp);
5880 PyObject *ret=PyTuple_New(2);
5881 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5882 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5886 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5888 int nbOfCompo=self->getNumberOfComponents();
5893 if(PyString_Check(obj))
5895 Py_ssize_t sz=PyString_Size(obj);
5896 char *pt=PyString_AsString(obj);
5898 return self->locateValue(pt[0]);
5900 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5903 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5906 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5910 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5912 int nbOfCompo=self->getNumberOfComponents();
5919 if(PyString_Check(obj))
5921 Py_ssize_t sz=PyString_Size(obj);
5922 char *pt=PyString_AsString(obj);
5924 return self->presenceOfValue(pt[0]);
5926 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5929 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5932 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5936 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5939 std::vector<int> stdvecTyyppArr;
5940 std::pair<int, std::pair<int,int> > sTyyppArr;
5941 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5942 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5946 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5948 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5950 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5952 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5954 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5958 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5960 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.";
5962 std::vector<int> stdvecTyyppArr;
5963 std::pair<int, std::pair<int,int> > sTyyppArr;
5964 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5965 int nbOfCompo=self->getNumberOfComponents();
5966 int nbOfTuples=self->getNumberOfTuples();
5967 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5969 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5970 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5979 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5985 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5986 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5989 //value vector<string>
5992 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5993 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5996 //value DataArrayChar
5999 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6003 throw INTERP_KERNEL::Exception(msg);
6007 {//obj list-tuple[int]
6013 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6019 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6020 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6023 //value vector<string>
6026 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6027 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6030 //value DataArrayChar
6033 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6037 throw INTERP_KERNEL::Exception(msg);
6048 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6054 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6055 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6058 //value vector<string>
6061 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6062 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6065 //value DataArrayChar
6068 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6072 throw INTERP_KERNEL::Exception(msg);
6083 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6089 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6090 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6093 //value vector<string>
6096 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6097 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6100 //value DataArrayChar
6103 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6107 throw INTERP_KERNEL::Exception(msg);
6112 throw INTERP_KERNEL::Exception(msg);
6118 class DataArrayAsciiCharTuple;
6120 class DataArrayAsciiCharIterator
6123 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6124 ~DataArrayAsciiCharIterator();
6129 DataArrayAsciiCharTuple *ret=self->nextt();
6131 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6134 PyErr_SetString(PyExc_StopIteration,"No more data.");
6141 class DataArrayAsciiCharTuple
6144 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6145 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6148 std::string __str__() const throw(INTERP_KERNEL::Exception)
6150 return self->repr();
6153 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6155 return self->buildDAAsciiChar(1,self->getNumberOfCompo());