1 // Copyright (C) 2007-2016 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) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::selectByTupleRanges;
47 %newobject MEDCoupling::DataArray::selectByTupleId;
48 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
50 %newobject MEDCoupling::DataArray::Aggregate;
51 %newobject MEDCoupling::DataArrayInt::New;
52 %newobject MEDCoupling::DataArrayInt::__iter__;
53 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
54 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
55 %newobject MEDCoupling::DataArrayInt::subArray;
56 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
57 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
58 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
59 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
60 %newobject MEDCoupling::DataArrayInt::renumber;
61 %newobject MEDCoupling::DataArrayInt::renumberR;
62 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
63 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
64 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
65 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
66 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
67 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
68 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
69 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
70 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
71 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
72 %newobject MEDCoupling::DataArrayInt::negate;
73 %newobject MEDCoupling::DataArrayInt::computeAbs;
74 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
75 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
76 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
77 %newobject MEDCoupling::DataArrayInt::Aggregate;
78 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
79 %newobject MEDCoupling::DataArrayInt::Meld;
80 %newobject MEDCoupling::DataArrayInt::Add;
81 %newobject MEDCoupling::DataArrayInt::Substract;
82 %newobject MEDCoupling::DataArrayInt::Multiply;
83 %newobject MEDCoupling::DataArrayInt::Divide;
84 %newobject MEDCoupling::DataArrayInt::Pow;
85 %newobject MEDCoupling::DataArrayInt::BuildUnion;
86 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
87 %newobject MEDCoupling::DataArrayInt::Range;
88 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
89 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
90 %newobject MEDCoupling::DataArrayInt::buildComplement;
91 %newobject MEDCoupling::DataArrayInt::buildUnion;
92 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
93 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
94 %newobject MEDCoupling::DataArrayInt::buildIntersection;
95 %newobject MEDCoupling::DataArrayInt::buildUnique;
96 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
97 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
98 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
99 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
100 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
101 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
102 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
103 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
104 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
105 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
106 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
107 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
108 %newobject MEDCoupling::DataArrayInt::__neg__;
109 %newobject MEDCoupling::DataArrayInt::__add__;
110 %newobject MEDCoupling::DataArrayInt::__radd__;
111 %newobject MEDCoupling::DataArrayInt::__sub__;
112 %newobject MEDCoupling::DataArrayInt::__rsub__;
113 %newobject MEDCoupling::DataArrayInt::__mul__;
114 %newobject MEDCoupling::DataArrayInt::__rmul__;
115 %newobject MEDCoupling::DataArrayInt::__div__;
116 %newobject MEDCoupling::DataArrayInt::__rdiv__;
117 %newobject MEDCoupling::DataArrayInt::__mod__;
118 %newobject MEDCoupling::DataArrayInt::__rmod__;
119 %newobject MEDCoupling::DataArrayInt::__pow__;
120 %newobject MEDCoupling::DataArrayInt::__rpow__;
121 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
122 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
123 %newobject MEDCoupling::DataArrayChar::renumber;
124 %newobject MEDCoupling::DataArrayChar::renumberR;
125 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
126 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
127 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
128 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
129 %newobject MEDCoupling::DataArrayChar::Aggregate;
130 %newobject MEDCoupling::DataArrayChar::Meld;
131 %newobject MEDCoupling::DataArrayByte::New;
132 %newobject MEDCoupling::DataArrayByte::__iter__;
133 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
134 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
135 %newobject MEDCoupling::DataArrayChar::subArray;
136 %newobject MEDCoupling::DataArrayAsciiChar::New;
137 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
138 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
139 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
140 %newobject MEDCoupling::DataArrayDouble::New;
141 %newobject MEDCoupling::DataArrayDouble::__iter__;
142 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
143 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
144 %newobject MEDCoupling::DataArrayDouble::Aggregate;
145 %newobject MEDCoupling::DataArrayDouble::Meld;
146 %newobject MEDCoupling::DataArrayDouble::Dot;
147 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
148 %newobject MEDCoupling::DataArrayDouble::Add;
149 %newobject MEDCoupling::DataArrayDouble::Substract;
150 %newobject MEDCoupling::DataArrayDouble::Multiply;
151 %newobject MEDCoupling::DataArrayDouble::Divide;
152 %newobject MEDCoupling::DataArrayDouble::Pow;
153 %newobject MEDCoupling::DataArrayDouble::subArray;
154 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
155 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
156 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
157 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
158 %newobject MEDCoupling::DataArrayDouble::negate;
159 %newobject MEDCoupling::DataArrayDouble::computeAbs;
160 %newobject MEDCoupling::DataArrayDouble::applyFunc;
161 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
162 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
163 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
164 %newobject MEDCoupling::DataArrayDouble::determinant;
165 %newobject MEDCoupling::DataArrayDouble::eigenValues;
166 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
167 %newobject MEDCoupling::DataArrayDouble::inverse;
168 %newobject MEDCoupling::DataArrayDouble::trace;
169 %newobject MEDCoupling::DataArrayDouble::deviator;
170 %newobject MEDCoupling::DataArrayDouble::magnitude;
171 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
172 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
173 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
174 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
175 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
176 %newobject MEDCoupling::DataArrayDouble::renumber;
177 %newobject MEDCoupling::DataArrayDouble::renumberR;
178 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
179 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
180 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
181 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
182 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
183 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
184 %newobject MEDCoupling::DataArrayDouble::cartesianize;
185 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
186 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
187 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
188 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
189 %newobject MEDCoupling::DataArrayDouble::__neg__;
190 %newobject MEDCoupling::DataArrayDouble::__radd__;
191 %newobject MEDCoupling::DataArrayDouble::__rsub__;
192 %newobject MEDCoupling::DataArrayDouble::__rmul__;
193 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
194 %newobject MEDCoupling::DataArrayDouble::__pow__;
195 %newobject MEDCoupling::DataArrayDouble::__rpow__;
196 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
198 %feature("unref") DataArray "$this->decrRef();"
199 %feature("unref") DataArrayDouble "$this->decrRef();"
200 %feature("unref") DataArrayInt "$this->decrRef();"
201 %feature("unref") DataArrayChar "$this->decrRef();"
202 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
203 %feature("unref") DataArrayByte "$this->decrRef();"
205 namespace MEDCoupling
212 } MEDCouplingAxisType;
214 class DataArray : public RefCountObject, public TimeLabel
217 void setName(const std::string& name);
218 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
219 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
220 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
221 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
222 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
223 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
224 std::string getName() const;
225 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
226 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
227 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
228 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
229 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
230 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
231 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
232 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
233 int getNumberOfComponents() const;
234 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
235 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
236 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
237 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
238 virtual void desallocate() throw(INTERP_KERNEL::Exception);
239 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
240 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
241 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
242 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
243 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
244 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
245 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
246 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
247 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
248 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
249 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
250 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
251 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
252 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
253 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
254 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
255 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
256 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
257 void updateTime() const;
260 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
262 const std::vector<std::string>& comps=self->getInfoOnComponents();
263 PyObject *ret=PyList_New((int)comps.size());
264 for(int i=0;i<(int)comps.size();i++)
265 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
269 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
271 std::vector<int> tmp;
272 convertPyToNewIntArr3(li,tmp);
273 self->copyPartOfStringInfoFrom(other,tmp);
276 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
278 std::vector<int> tmp;
279 convertPyToNewIntArr3(li,tmp);
280 self->copyPartOfStringInfoFrom2(tmp,other);
283 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
286 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
287 if (!SWIG_IsOK(res1))
290 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
291 if(size!=self->getNumberOfTuples())
293 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
295 self->renumberInPlace(tmp);
299 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
301 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
302 da2->checkAllocated();
303 int size=self->getNumberOfTuples();
304 if(size!=self->getNumberOfTuples())
306 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
308 self->renumberInPlace(da2->getConstPointer());
312 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
315 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
316 if (!SWIG_IsOK(res1))
319 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
320 if(size!=self->getNumberOfTuples())
322 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
324 self->renumberInPlaceR(tmp);
328 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
330 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
331 da2->checkAllocated();
332 int size=self->getNumberOfTuples();
333 if(size!=self->getNumberOfTuples())
335 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
337 self->renumberInPlaceR(da2->getConstPointer());
341 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
342 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
344 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
345 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
346 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
347 DataArrayInt *tuplesSelecPtr2=0;
350 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
352 throw INTERP_KERNEL::Exception(msg);
354 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
357 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
359 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
360 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
363 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
365 std::vector<std::pair<int,int> > ranges;
366 convertPyToVectorPairInt(li,ranges);
367 return self->selectByTupleRanges(ranges);
370 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
373 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
374 if (!SWIG_IsOK(res1))
377 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
378 return self->selectByTupleId(tmp,tmp+size);
382 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
384 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
385 da2->checkAllocated();
386 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
390 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
393 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
394 if (!SWIG_IsOK(res1))
397 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
398 return self->selectByTupleIdSafe(tmp,tmp+size);
402 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
404 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
405 da2->checkAllocated();
406 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
410 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
412 std::vector<int> tmp;
413 convertPyToNewIntArr3(li,tmp);
414 DataArray *ret=self->keepSelectedComponents(tmp);
415 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
418 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
420 if(!PySlice_Check(slic))
421 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
422 Py_ssize_t strt=2,stp=2,step=2;
423 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
424 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
426 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
427 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
430 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
432 if(!PySlice_Check(slic))
433 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
434 Py_ssize_t strt=2,stp=2,step=2;
435 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
436 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
438 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
439 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
442 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
444 if(!PySlice_Check(slic))
445 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
446 Py_ssize_t strt=2,stp=2,step=2;
447 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
448 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
449 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
452 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
454 if(!PySlice_Check(slic))
455 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
456 Py_ssize_t strt=2,stp=2,step=2;
457 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
458 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
459 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
462 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
464 std::vector<const DataArray *> tmp;
465 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
466 return DataArray::Aggregate(tmp);
469 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
471 if(!PySlice_Check(slic))
472 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
473 Py_ssize_t strt=2,stp=2,step=2;
474 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
475 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
476 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
479 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
481 if(!PySlice_Check(slic))
482 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
483 Py_ssize_t strt=2,stp=2,step=2;
484 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
485 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
486 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
489 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
491 PyObject *ret(PyTuple_New(2));
492 std::string a0(self->getName());
493 const std::vector<std::string> &a1(self->getInfoOnComponents());
494 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
497 PyObject *ret1(PyList_New(sz));
498 for(int i=0;i<sz;i++)
499 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
500 PyTuple_SetItem(ret,1,ret1);
505 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
507 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 !";
508 if(!PyTuple_Check(inp))
509 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
510 int sz(PyTuple_Size(inp));
512 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
513 PyObject *a0(PyTuple_GetItem(inp,0));
514 if(!PyString_Check(a0))
515 throw INTERP_KERNEL::Exception(MSG);
516 PyObject *a1(PyTuple_GetItem(inp,1));
517 std::vector<std::string> a1cpp;
518 if(!fillStringVector(a1,a1cpp))
519 throw INTERP_KERNEL::Exception(MSG);
520 self->setName(PyString_AsString(a0));
521 self->setInfoOnComponents(a1cpp);
527 class DataArrayDoubleIterator;
529 class DataArrayDouble : public DataArray
532 static DataArrayDouble *New();
533 double doubleValue() const throw(INTERP_KERNEL::Exception);
534 bool empty() const throw(INTERP_KERNEL::Exception);
535 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
536 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
537 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
538 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
539 double popBackSilent() throw(INTERP_KERNEL::Exception);
540 void pack() const throw(INTERP_KERNEL::Exception);
541 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
542 void fillWithZero() throw(INTERP_KERNEL::Exception);
543 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
544 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
545 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
546 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
547 void reverse() throw(INTERP_KERNEL::Exception);
548 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
549 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
550 std::string repr() const throw(INTERP_KERNEL::Exception);
551 std::string reprZip() const throw(INTERP_KERNEL::Exception);
552 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
553 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
554 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
555 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
559 void transpose() throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
561 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
564 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
565 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
566 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
567 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
568 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
569 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
570 double front() const throw(INTERP_KERNEL::Exception);
571 double back() const throw(INTERP_KERNEL::Exception);
572 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
573 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
574 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
575 double *getPointer() throw(INTERP_KERNEL::Exception);
576 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
577 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
578 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
579 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
580 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
581 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
582 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
583 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
584 double getAverageValue() const throw(INTERP_KERNEL::Exception);
585 double norm2() const throw(INTERP_KERNEL::Exception);
586 double normMax() const throw(INTERP_KERNEL::Exception);
587 double normMin() const throw(INTERP_KERNEL::Exception);
588 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
590 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
591 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
595 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
596 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
605 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
606 void abs() throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
608 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
609 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
610 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
611 void applyPow(double val) throw(INTERP_KERNEL::Exception);
612 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
613 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
617 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
620 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
621 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
622 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
623 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
624 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
625 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
626 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
627 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
630 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
631 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
632 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
633 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
634 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
635 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
636 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
637 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
638 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
639 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
642 DataArrayDouble() throw(INTERP_KERNEL::Exception)
644 return DataArrayDouble::New();
647 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
649 const char *msgBase="MEDCoupling::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)";
650 std::string msg(msgBase);
652 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
655 if(PyList_Check(elt0) || PyTuple_Check(elt0))
659 if(PyInt_Check(nbOfTuples))
661 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
663 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
666 if(PyInt_Check(elt2))
667 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
668 int nbOfCompo=PyInt_AS_LONG(elt2);
670 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
671 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
672 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
673 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
677 throw INTERP_KERNEL::Exception(msg.c_str());
680 {//DataArrayDouble.New([1.,3.,4.],3)
681 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
683 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
684 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
689 throw INTERP_KERNEL::Exception(msg.c_str());
692 {// DataArrayDouble.New([1.,3.,4.])
693 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
694 int tmpp1=-1,tmpp2=-1;
695 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
696 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
700 else if(PyInt_Check(elt0))
702 int nbOfTuples1=PyInt_AS_LONG(elt0);
704 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
709 if(PyInt_Check(nbOfTuples))
710 {//DataArrayDouble.New(5,2)
711 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
713 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
714 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
715 ret->alloc(nbOfTuples1,nbOfCompo);
719 throw INTERP_KERNEL::Exception(msg.c_str());
722 throw INTERP_KERNEL::Exception(msg.c_str());
725 {//DataArrayDouble.New(5)
726 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
727 ret->alloc(nbOfTuples1,1);
732 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
733 {//DataArrayDouble.New(numpyArray)
734 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
738 throw INTERP_KERNEL::Exception(msg.c_str());
739 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
742 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
744 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
747 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
750 std::vector<double> bb;
752 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
753 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
754 self->pushBackValsSilent(tmp,tmp+nbTuples);
757 std::string __repr__() const throw(INTERP_KERNEL::Exception)
759 std::ostringstream oss;
760 self->reprQuickOverview(oss);
764 std::string __str__() const throw(INTERP_KERNEL::Exception)
766 return self->reprNotTooLong();
769 double __float__() const throw(INTERP_KERNEL::Exception)
771 return self->doubleValue();
774 int __len__() const throw(INTERP_KERNEL::Exception)
776 if(self->isAllocated())
778 return self->getNumberOfTuples();
782 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
786 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
788 return self->iterator();
791 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
793 const char *msg="MEDCoupling::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 !";
794 if(PyList_Check(li) || PyTuple_Check(li))
798 if(PyInt_Check(nbOfTuples))
800 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
802 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
805 if(PyInt_Check(nbOfComp))
806 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
807 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
809 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
810 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
811 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
814 throw INTERP_KERNEL::Exception(msg);
817 {//DataArrayDouble.setValues([1.,3.,4.],3)
819 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
820 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
824 throw INTERP_KERNEL::Exception(msg);
827 {// DataArrayDouble.setValues([1.,3.,4.])
828 int tmpp1=-1,tmpp2=-1;
829 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
830 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
834 throw INTERP_KERNEL::Exception(msg);
837 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
839 const double *vals=self->getConstPointer();
840 return convertDblArrToPyList(vals,self->getNbOfElems());
844 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
846 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
850 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
853 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
854 PyObject *ret=PyTuple_New(2);
855 PyObject *ret0Py=ret0?Py_True:Py_False;
857 PyTuple_SetItem(ret,0,ret0Py);
858 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
862 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
864 const double *vals=self->getConstPointer();
865 int nbOfComp=self->getNumberOfComponents();
866 int nbOfTuples=self->getNumberOfTuples();
867 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
870 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
873 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
874 if (!SWIG_IsOK(res1))
877 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
878 if(size!=self->getNumberOfTuples())
880 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
882 return self->renumber(tmp);
886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
888 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
889 da2->checkAllocated();
890 int size=self->getNumberOfTuples();
891 if(size!=self->getNumberOfTuples())
893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
895 return self->renumber(da2->getConstPointer());
899 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
902 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
903 if (!SWIG_IsOK(res1))
906 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
907 if(size!=self->getNumberOfTuples())
909 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
911 return self->renumberR(tmp);
915 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
917 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
918 da2->checkAllocated();
919 int size=self->getNumberOfTuples();
920 if(size!=self->getNumberOfTuples())
922 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
924 return self->renumberR(da2->getConstPointer());
928 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
931 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
932 if (!SWIG_IsOK(res1))
935 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
936 if(size!=self->getNumberOfTuples())
938 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
940 return self->renumberAndReduce(tmp,newNbOfTuple);
944 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
946 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
947 da2->checkAllocated();
948 int size=self->getNumberOfTuples();
949 if(size!=self->getNumberOfTuples())
951 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
953 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
957 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
959 int thisTupleId,otherTupleId;
960 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
961 PyObject *ret=PyTuple_New(3);
962 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
963 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
964 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
968 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
971 double r1=self->getMaxValue(tmp);
972 PyObject *ret=PyTuple_New(2);
973 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
974 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
978 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
981 double r1=self->getMaxValue2(tmp);
982 PyObject *ret=PyTuple_New(2);
983 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
984 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
988 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
991 double r1=self->getMinValue(tmp);
992 PyObject *ret=PyTuple_New(2);
993 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
994 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
998 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1001 double r1=self->getMinValue2(tmp);
1002 PyObject *ret=PyTuple_New(2);
1003 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1004 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1008 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1010 int nbOfCompo=self->getNumberOfComponents();
1011 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1012 self->getMinMaxPerComponent(tmp);
1013 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1017 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1019 int sz=self->getNumberOfComponents();
1020 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1021 self->accumulate(tmp);
1022 return convertDblArrToPyList(tmp,sz);
1025 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1028 std::vector<int> val2;
1029 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1030 return self->accumulatePerChunck(bg,bg+sz);
1033 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1035 DataArrayInt *comm, *commIndex;
1036 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1037 PyObject *res = PyList_New(2);
1038 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1039 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1043 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1047 DataArrayDoubleTuple *aa;
1048 std::vector<double> bb;
1050 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1051 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1053 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1054 PyObject *ret=PyTuple_New(2);
1055 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1056 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1060 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1062 std::vector<int> tmp;
1063 convertPyToNewIntArr3(li,tmp);
1064 self->setSelectedComponents(a,tmp);
1067 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1069 int sz=self->getNumberOfComponents();
1070 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1071 self->getTuple(tupleId,tmp);
1072 return convertDblArrToPyList(tmp,sz);
1075 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1077 std::vector<const DataArrayDouble *> tmp;
1078 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1079 return DataArrayDouble::Aggregate(tmp);
1082 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1084 std::vector<const DataArrayDouble *> tmp;
1085 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1086 return DataArrayDouble::Meld(tmp);
1089 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1093 DataArrayDoubleTuple *aa;
1094 std::vector<double> bb;
1096 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1097 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1098 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1099 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1100 DataArrayInt *c=0,*cI=0;
1101 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1102 PyObject *ret=PyTuple_New(2);
1103 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1104 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1108 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1110 DataArrayInt *ret1=0;
1111 bool ret0=self->areIncludedInMe(other,prec,ret1);
1112 PyObject *ret=PyTuple_New(2);
1113 PyObject *ret0Py=ret0?Py_True:Py_False;
1115 PyTuple_SetItem(ret,0,ret0Py);
1116 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1120 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1122 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1123 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1124 self->checkAllocated();
1125 int nbOfTuples=self->getNumberOfTuples();
1126 int nbOfComponents=self->getNumberOfComponents();
1128 std::vector<int> vt1,vc1;
1129 std::pair<int, std::pair<int,int> > pt1,pc1;
1130 DataArrayInt *dt1=0,*dc1=0;
1132 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1133 MCAuto<DataArrayDouble> ret;
1137 if(nbOfComponents==1)
1138 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1139 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1141 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1143 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1145 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1147 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1150 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1151 std::vector<int> v2(1,ic1);
1152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1156 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1157 std::vector<int> v2(1,ic1);
1158 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1162 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1163 std::vector<int> v2(1,ic1);
1164 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1168 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1169 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1173 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1174 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1178 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1183 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1184 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1188 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1189 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1190 std::vector<int> v2(nbOfComp);
1191 for(int i=0;i<nbOfComp;i++)
1192 v2[i]=pc1.first+i*pc1.second.second;
1193 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1197 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1198 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1199 std::vector<int> v2(nbOfComp);
1200 for(int i=0;i<nbOfComp;i++)
1201 v2[i]=pc1.first+i*pc1.second.second;
1202 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1206 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1207 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1208 std::vector<int> v2(nbOfComp);
1209 for(int i=0;i<nbOfComp;i++)
1210 v2[i]=pc1.first+i*pc1.second.second;
1211 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1215 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1216 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1217 std::vector<int> v2(nbOfComp);
1218 for(int i=0;i<nbOfComp;i++)
1219 v2[i]=pc1.first+i*pc1.second.second;
1220 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1223 throw INTERP_KERNEL::Exception(msg);
1227 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1229 self->checkAllocated();
1230 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1231 int nbOfTuples=self->getNumberOfTuples();
1232 int nbOfComponents=self->getNumberOfComponents();
1235 std::vector<double> v1;
1236 DataArrayDouble *d1=0;
1237 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1239 std::vector<int> vt1,vc1;
1240 std::pair<int, std::pair<int,int> > pt1,pc1;
1241 DataArrayInt *dt1=0,*dc1=0;
1242 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1243 MCAuto<DataArrayDouble> tmp;
1251 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1254 tmp=DataArrayDouble::New();
1255 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1256 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1259 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1262 throw INTERP_KERNEL::Exception(msg);
1271 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1274 tmp=DataArrayDouble::New();
1275 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1276 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1279 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1282 throw INTERP_KERNEL::Exception(msg);
1291 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1294 tmp=DataArrayDouble::New();
1295 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1296 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1299 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1302 throw INTERP_KERNEL::Exception(msg);
1311 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1314 tmp=DataArrayDouble::New();
1315 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1316 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1319 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1322 throw INTERP_KERNEL::Exception(msg);
1331 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1334 tmp=DataArrayDouble::New();
1335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1336 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1339 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1342 throw INTERP_KERNEL::Exception(msg);
1351 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1354 tmp=DataArrayDouble::New();
1355 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1356 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1359 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1362 throw INTERP_KERNEL::Exception(msg);
1371 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1374 tmp=DataArrayDouble::New();
1375 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1376 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1379 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1382 throw INTERP_KERNEL::Exception(msg);
1391 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1394 tmp=DataArrayDouble::New();
1395 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1396 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1399 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1402 throw INTERP_KERNEL::Exception(msg);
1411 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1414 tmp=DataArrayDouble::New();
1415 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1416 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1419 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1422 throw INTERP_KERNEL::Exception(msg);
1431 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1434 tmp=DataArrayDouble::New();
1435 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1436 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1439 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1442 throw INTERP_KERNEL::Exception(msg);
1451 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1454 tmp=DataArrayDouble::New();
1455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1456 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1459 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1462 throw INTERP_KERNEL::Exception(msg);
1471 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1474 tmp=DataArrayDouble::New();
1475 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1476 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1479 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1482 throw INTERP_KERNEL::Exception(msg);
1491 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1494 tmp=DataArrayDouble::New();
1495 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1496 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1499 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1502 throw INTERP_KERNEL::Exception(msg);
1511 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1514 tmp=DataArrayDouble::New();
1515 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1516 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1519 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1522 throw INTERP_KERNEL::Exception(msg);
1531 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1534 tmp=DataArrayDouble::New();
1535 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1536 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1539 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1542 throw INTERP_KERNEL::Exception(msg);
1551 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1554 tmp=DataArrayDouble::New();
1555 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1556 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1559 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1562 throw INTERP_KERNEL::Exception(msg);
1567 throw INTERP_KERNEL::Exception(msg);
1572 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1574 return self->negate();
1577 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1579 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1582 DataArrayDoubleTuple *aa;
1583 std::vector<double> bb;
1586 #ifndef WITHOUT_AUTOFIELD
1588 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1590 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1593 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1594 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1599 throw INTERP_KERNEL::Exception(msg);
1603 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1608 MCAuto<DataArrayDouble> ret=self->deepCopy();
1609 ret->applyLin(1.,val);
1610 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1614 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1618 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1619 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1623 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1624 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1627 throw INTERP_KERNEL::Exception(msg);
1631 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1633 const char msg[]="Unexpected situation in __radd__ !";
1636 DataArrayDoubleTuple *aa;
1637 std::vector<double> bb;
1639 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1644 MCAuto<DataArrayDouble> ret=self->deepCopy();
1645 ret->applyLin(1.,val);
1650 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1651 return DataArrayDouble::Add(self,aaa);
1655 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1656 return DataArrayDouble::Add(self,aaa);
1659 throw INTERP_KERNEL::Exception(msg);
1663 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1665 const char msg[]="Unexpected situation in __iadd__ !";
1668 DataArrayDoubleTuple *aa;
1669 std::vector<double> bb;
1671 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1676 self->applyLin(1.,val);
1677 Py_XINCREF(trueSelf);
1683 Py_XINCREF(trueSelf);
1688 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1689 self->addEqual(aaa);
1690 Py_XINCREF(trueSelf);
1695 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1696 self->addEqual(aaa);
1697 Py_XINCREF(trueSelf);
1701 throw INTERP_KERNEL::Exception(msg);
1705 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1707 const char msg[]="Unexpected situation in __sub__ !";
1710 DataArrayDoubleTuple *aa;
1711 std::vector<double> bb;
1714 #ifndef WITHOUT_AUTOFIELD
1716 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1718 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1721 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1722 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1724 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1727 throw INTERP_KERNEL::Exception(msg);
1731 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1736 MCAuto<DataArrayDouble> ret=self->deepCopy();
1737 ret->applyLin(1.,-val);
1738 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1746 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1747 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1751 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1752 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1755 throw INTERP_KERNEL::Exception(msg);
1759 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1761 const char msg[]="Unexpected situation in __rsub__ !";
1764 DataArrayDoubleTuple *aa;
1765 std::vector<double> bb;
1767 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1772 MCAuto<DataArrayDouble> ret=self->deepCopy();
1773 ret->applyLin(-1.,val);
1778 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1779 return DataArrayDouble::Substract(aaa,self);
1783 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1784 return DataArrayDouble::Substract(aaa,self);
1787 throw INTERP_KERNEL::Exception(msg);
1791 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1793 const char msg[]="Unexpected situation in __isub__ !";
1796 DataArrayDoubleTuple *aa;
1797 std::vector<double> bb;
1799 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1804 self->applyLin(1,-val);
1805 Py_XINCREF(trueSelf);
1810 self->substractEqual(a);
1811 Py_XINCREF(trueSelf);
1816 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1817 self->substractEqual(aaa);
1818 Py_XINCREF(trueSelf);
1823 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1824 self->substractEqual(aaa);
1825 Py_XINCREF(trueSelf);
1829 throw INTERP_KERNEL::Exception(msg);
1833 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1835 const char msg[]="Unexpected situation in __mul__ !";
1838 DataArrayDoubleTuple *aa;
1839 std::vector<double> bb;
1842 #ifndef WITHOUT_AUTOFIELD
1844 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1846 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1849 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1850 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1852 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1855 throw INTERP_KERNEL::Exception(msg);
1859 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1864 MCAuto<DataArrayDouble> ret=self->deepCopy();
1865 ret->applyLin(val,0.);
1866 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1870 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1874 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1875 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1879 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1880 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1883 throw INTERP_KERNEL::Exception(msg);
1887 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1889 const char msg[]="Unexpected situation in __rmul__ !";
1892 DataArrayDoubleTuple *aa;
1893 std::vector<double> bb;
1895 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1900 MCAuto<DataArrayDouble> ret=self->deepCopy();
1901 ret->applyLin(val,0.);
1906 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1907 return DataArrayDouble::Multiply(self,aaa);
1911 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1912 return DataArrayDouble::Multiply(self,aaa);
1915 throw INTERP_KERNEL::Exception(msg);
1919 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1921 const char msg[]="Unexpected situation in __imul__ !";
1924 DataArrayDoubleTuple *aa;
1925 std::vector<double> bb;
1927 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1932 self->applyLin(val,0.);
1933 Py_XINCREF(trueSelf);
1938 self->multiplyEqual(a);
1939 Py_XINCREF(trueSelf);
1944 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1945 self->multiplyEqual(aaa);
1946 Py_XINCREF(trueSelf);
1951 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1952 self->multiplyEqual(aaa);
1953 Py_XINCREF(trueSelf);
1957 throw INTERP_KERNEL::Exception(msg);
1961 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1963 const char msg[]="Unexpected situation in __div__ !";
1966 DataArrayDoubleTuple *aa;
1967 std::vector<double> bb;
1970 #ifndef WITHOUT_AUTOFIELD
1972 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1974 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1977 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1978 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1980 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1983 throw INTERP_KERNEL::Exception(msg);
1987 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1993 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1994 MCAuto<DataArrayDouble> ret=self->deepCopy();
1995 ret->applyLin(1/val,0.);
1996 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2000 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2004 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2005 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2009 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2010 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2013 throw INTERP_KERNEL::Exception(msg);
2017 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2019 const char msg[]="Unexpected situation in __rdiv__ !";
2022 DataArrayDoubleTuple *aa;
2023 std::vector<double> bb;
2025 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2030 MCAuto<DataArrayDouble> ret=self->deepCopy();
2036 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2037 return DataArrayDouble::Divide(aaa,self);
2041 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2042 return DataArrayDouble::Divide(aaa,self);
2045 throw INTERP_KERNEL::Exception(msg);
2049 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2051 const char msg[]="Unexpected situation in __idiv__ !";
2054 DataArrayDoubleTuple *aa;
2055 std::vector<double> bb;
2057 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2063 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2064 self->applyLin(1./val,0.);
2065 Py_XINCREF(trueSelf);
2070 self->divideEqual(a);
2071 Py_XINCREF(trueSelf);
2076 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2077 self->divideEqual(aaa);
2078 Py_XINCREF(trueSelf);
2083 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2084 self->divideEqual(aaa);
2085 Py_XINCREF(trueSelf);
2089 throw INTERP_KERNEL::Exception(msg);
2093 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2095 const char msg[]="Unexpected situation in __pow__ !";
2098 DataArrayDoubleTuple *aa;
2099 std::vector<double> bb;
2101 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2106 MCAuto<DataArrayDouble> ret=self->deepCopy();
2112 return DataArrayDouble::Pow(self,a);
2116 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2117 return DataArrayDouble::Pow(self,aaa);
2121 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2122 return DataArrayDouble::Pow(self,aaa);
2125 throw INTERP_KERNEL::Exception(msg);
2129 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2131 const char msg[]="Unexpected situation in __rpow__ !";
2134 DataArrayDoubleTuple *aa;
2135 std::vector<double> bb;
2137 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2142 MCAuto<DataArrayDouble> ret=self->deepCopy();
2143 ret->applyRPow(val);
2148 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2149 return DataArrayDouble::Pow(aaa,self);
2153 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2154 return DataArrayDouble::Pow(aaa,self);
2157 throw INTERP_KERNEL::Exception(msg);
2161 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2163 const char msg[]="Unexpected situation in __ipow__ !";
2166 DataArrayDoubleTuple *aa;
2167 std::vector<double> bb;
2169 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2174 self->applyPow(val);
2175 Py_XINCREF(trueSelf);
2181 Py_XINCREF(trueSelf);
2186 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2187 self->powEqual(aaa);
2188 Py_XINCREF(trueSelf);
2193 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2194 self->powEqual(aaa);
2195 Py_XINCREF(trueSelf);
2199 throw INTERP_KERNEL::Exception(msg);
2203 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2205 DataArrayInt *c=0,*cI=0;
2207 self->computeTupleIdsNearTuples(other,eps,c,cI);
2208 PyObject *ret=PyTuple_New(2);
2209 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2210 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2216 DataArrayInt *ret1=0;
2217 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2218 PyObject *ret=PyTuple_New(2);
2219 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2220 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2225 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2227 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2228 if(!PyTuple_Check(args))
2229 throw INTERP_KERNEL::Exception(MSG);
2230 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2231 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2232 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2234 PyObject *tmp0(PyTuple_New(1));
2235 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2236 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2238 Py_DECREF(selfMeth);
2239 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2240 int sz(PyTuple_Size(args));
2242 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2243 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2244 PyObject *zeNumpyRepr(0);
2245 PyObject *tmp1(PyInt_FromLong(0));
2246 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2248 PyObject *tmp3(PyTuple_New(1));
2249 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2250 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2254 Py_DECREF(initMeth);
2258 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2261 if(!self->isAllocated())
2262 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2263 PyObject *ret(PyTuple_New(1));
2264 PyObject *ret0(PyDict_New());
2265 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2266 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2267 PyObject *tmp1(PyInt_FromLong(0));
2268 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2269 PyTuple_SetItem(ret,0,ret0);
2273 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2279 class DataArrayDoubleTuple;
2281 class DataArrayDoubleIterator
2284 DataArrayDoubleIterator(DataArrayDouble *da);
2285 ~DataArrayDoubleIterator();
2290 DataArrayDoubleTuple *ret=self->nextt();
2292 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2295 PyErr_SetString(PyExc_StopIteration,"No more data.");
2302 class DataArrayDoubleTuple
2305 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2306 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2309 std::string __str__() const throw(INTERP_KERNEL::Exception)
2311 return self->repr();
2314 double __float__() const throw(INTERP_KERNEL::Exception)
2316 return self->doubleValue();
2319 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2321 return self->buildDADouble(1,self->getNumberOfCompo());
2324 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2326 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2327 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2328 Py_XINCREF(trueSelf);
2332 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2334 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2335 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2336 Py_XINCREF(trueSelf);
2340 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2342 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2343 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2344 Py_XINCREF(trueSelf);
2348 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2350 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2351 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2352 Py_XINCREF(trueSelf);
2356 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2358 return PyInt_FromLong(self->getNumberOfCompo());
2361 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2363 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2366 std::vector<int> multiVal;
2367 std::pair<int, std::pair<int,int> > slic;
2368 MEDCoupling::DataArrayInt *daIntTyypp=0;
2369 const double *pt=self->getConstPointer();
2370 int nbc=self->getNumberOfCompo();
2371 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2378 std::ostringstream oss;
2379 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2380 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2384 return PyFloat_FromDouble(pt[singleVal]);
2388 return PyFloat_FromDouble(pt[nbc+singleVal]);
2391 std::ostringstream oss;
2392 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2393 throw INTERP_KERNEL::Exception(oss.str().c_str());
2399 PyObject *t=PyTuple_New(multiVal.size());
2400 for(int j=0;j<(int)multiVal.size();j++)
2402 int cid=multiVal[j];
2405 std::ostringstream oss;
2406 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2407 throw INTERP_KERNEL::Exception(oss.str().c_str());
2409 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2415 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2416 PyObject *t=PyTuple_New(sz);
2417 for(int j=0;j<sz;j++)
2418 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2422 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2426 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2428 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2429 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2432 std::vector<double> multiValV;
2433 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2434 int nbc=self->getNumberOfCompo();
2435 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2437 std::vector<int> multiVal;
2438 std::pair<int, std::pair<int,int> > slic;
2439 MEDCoupling::DataArrayInt *daIntTyypp=0;
2440 double *pt=self->getPointer();
2441 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2448 std::ostringstream oss;
2449 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2450 throw INTERP_KERNEL::Exception(oss.str().c_str());
2456 pt[singleVal]=singleValV;
2461 if(multiValV.size()!=1)
2463 std::ostringstream oss;
2464 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2465 throw INTERP_KERNEL::Exception(oss.str().c_str());
2467 pt[singleVal]=multiValV[0];
2472 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2476 throw INTERP_KERNEL::Exception(msg);
2485 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2489 std::ostringstream oss;
2490 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2491 throw INTERP_KERNEL::Exception(oss.str().c_str());
2499 if(multiVal.size()!=multiValV.size())
2501 std::ostringstream oss;
2502 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2503 throw INTERP_KERNEL::Exception(oss.str().c_str());
2505 for(int i=0;i<(int)multiVal.size();i++)
2507 int pos=multiVal[i];
2510 std::ostringstream oss;
2511 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2512 throw INTERP_KERNEL::Exception(oss.str().c_str());
2514 pt[multiVal[i]]=multiValV[i];
2520 const double *ptV=daIntTyyppV->getConstPointer();
2521 if(nbc>daIntTyyppV->getNumberOfCompo())
2523 std::ostringstream oss;
2524 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2525 throw INTERP_KERNEL::Exception(oss.str().c_str());
2527 std::copy(ptV,ptV+nbc,pt);
2531 throw INTERP_KERNEL::Exception(msg);
2536 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2541 for(int j=0;j<sz;j++)
2542 pt[slic.first+j*slic.second.second]=singleValV;
2547 if(sz!=(int)multiValV.size())
2549 std::ostringstream oss;
2550 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2551 throw INTERP_KERNEL::Exception(oss.str().c_str());
2553 for(int j=0;j<sz;j++)
2554 pt[slic.first+j*slic.second.second]=multiValV[j];
2559 const double *ptV=daIntTyyppV->getConstPointer();
2560 if(sz>daIntTyyppV->getNumberOfCompo())
2562 std::ostringstream oss;
2563 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2564 throw INTERP_KERNEL::Exception(oss.str().c_str());
2566 for(int j=0;j<sz;j++)
2567 pt[slic.first+j*slic.second.second]=ptV[j];
2571 throw INTERP_KERNEL::Exception(msg);
2575 throw INTERP_KERNEL::Exception(msg);
2581 class DataArrayIntIterator;
2583 class DataArrayInt : public DataArray
2586 static DataArrayInt *New();
2587 int intValue() const throw(INTERP_KERNEL::Exception);
2588 int getHashCode() const throw(INTERP_KERNEL::Exception);
2589 bool empty() const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2591 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2592 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2593 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2594 int popBackSilent() throw(INTERP_KERNEL::Exception);
2595 void pack() const throw(INTERP_KERNEL::Exception);
2596 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2597 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2598 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2599 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2600 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2601 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2602 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2603 void reverse() throw(INTERP_KERNEL::Exception);
2604 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2605 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2606 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2607 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2608 void fillWithZero() throw(INTERP_KERNEL::Exception);
2609 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2610 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2611 std::string repr() const throw(INTERP_KERNEL::Exception);
2612 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2613 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2614 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2615 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2616 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2617 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2618 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2619 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2620 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2621 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2622 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2623 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2624 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2625 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2626 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2627 void transpose() throw(INTERP_KERNEL::Exception);
2628 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2629 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2630 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2631 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2632 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2633 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2634 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2635 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2636 int front() const throw(INTERP_KERNEL::Exception);
2637 int back() const throw(INTERP_KERNEL::Exception);
2638 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2639 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2640 int *getPointer() throw(INTERP_KERNEL::Exception);
2641 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2642 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2643 const int *begin() const throw(INTERP_KERNEL::Exception);
2644 const int *end() const throw(INTERP_KERNEL::Exception);
2645 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2646 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2647 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2648 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2649 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2650 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2651 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2652 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2653 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2654 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2655 int count(int value) const throw(INTERP_KERNEL::Exception);
2656 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2657 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2658 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2659 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2660 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2661 void abs() throw(INTERP_KERNEL::Exception);
2662 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2663 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2664 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2665 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2666 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2667 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2668 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2669 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2670 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2671 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2672 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2673 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2675 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2676 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2677 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2678 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2679 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2680 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2681 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2682 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2683 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2684 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2685 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2686 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2688 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2689 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2690 void computeOffsets() throw(INTERP_KERNEL::Exception);
2691 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2692 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2693 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2694 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2695 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2696 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2697 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2698 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2699 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2700 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2701 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2702 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2703 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2704 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2705 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2706 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2707 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2708 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2709 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2711 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2714 DataArrayInt() throw(INTERP_KERNEL::Exception)
2716 return DataArrayInt::New();
2719 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2721 const char *msgBase="MEDCoupling::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)";
2722 std::string msg(msgBase);
2724 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2727 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2731 if(PyInt_Check(nbOfTuples))
2733 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2735 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2738 if(PyInt_Check(nbOfComp))
2739 {//DataArrayInt.New([1,3,4,5],2,2)
2740 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2742 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2743 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2744 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2745 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2749 throw INTERP_KERNEL::Exception(msg.c_str());
2752 {//DataArrayInt.New([1,3,4],3)
2753 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2755 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2756 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2761 throw INTERP_KERNEL::Exception(msg.c_str());
2764 {// DataArrayInt.New([1,3,4])
2765 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2766 int tmpp1=-1,tmpp2=-1;
2767 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2768 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2772 else if(PyInt_Check(elt0))
2774 int nbOfTuples1=PyInt_AS_LONG(elt0);
2776 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2781 if(PyInt_Check(nbOfTuples))
2782 {//DataArrayInt.New(5,2)
2783 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2785 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2786 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2787 ret->alloc(nbOfTuples1,nbOfCompo);
2791 throw INTERP_KERNEL::Exception(msg.c_str());
2794 throw INTERP_KERNEL::Exception(msg.c_str());
2797 {//DataArrayInt.New(5)
2798 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2799 ret->alloc(nbOfTuples1,1);
2804 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2805 {//DataArrayInt.New(numpyArray)
2806 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2810 throw INTERP_KERNEL::Exception(msg.c_str());
2811 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2814 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2816 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2819 std::string __str__() const throw(INTERP_KERNEL::Exception)
2821 return self->reprNotTooLong();
2824 int __len__() const throw(INTERP_KERNEL::Exception)
2826 if(self->isAllocated())
2828 return self->getNumberOfTuples();
2832 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2836 int __int__() const throw(INTERP_KERNEL::Exception)
2838 return self->intValue();
2841 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2843 return self->iterator();
2846 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2848 int sz=self->getNumberOfComponents();
2849 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2850 self->accumulate(tmp);
2851 return convertIntArrToPyList(tmp,sz);
2854 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2857 std::vector<int> val2;
2858 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2859 return self->accumulatePerChunck(bg,bg+sz);
2862 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2865 std::vector<int> val2;
2866 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2867 return self->findIdsEqualTuple(bg,bg+sz);
2870 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2872 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2873 PyObject *ret=PyList_New(slcs.size());
2874 for(std::size_t i=0;i<slcs.size();i++)
2875 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2879 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2881 if(!PySlice_Check(slic))
2882 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2883 Py_ssize_t strt=2,stp=2,step=2;
2884 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2885 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2886 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2887 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 !");
2888 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2891 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2894 self->getMinMaxValues(a,b);
2895 PyObject *ret=PyTuple_New(2);
2896 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2897 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2901 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2903 int newNbOfTuples=-1;
2904 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2905 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2906 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2907 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2908 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2909 PyObject *ret=PyTuple_New(2);
2910 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2911 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2915 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2917 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2918 int szArr,sw,iTypppArr;
2919 std::vector<int> stdvecTyyppArr;
2920 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2921 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2922 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2926 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2928 const char *msg="MEDCoupling::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 !";
2929 if(PyList_Check(li) || PyTuple_Check(li))
2933 if(PyInt_Check(nbOfTuples))
2935 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2937 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2940 if(PyInt_Check(nbOfComp))
2941 {//DataArrayInt.setValues([1,3,4,5],2,2)
2942 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2944 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2945 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2946 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2949 throw INTERP_KERNEL::Exception(msg);
2952 {//DataArrayInt.setValues([1,3,4],3)
2954 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2955 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2959 throw INTERP_KERNEL::Exception(msg);
2962 {// DataArrayInt.setValues([1,3,4])
2963 int tmpp1=-1,tmpp2=-1;
2964 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2965 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2969 throw INTERP_KERNEL::Exception(msg);
2972 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2974 const int *vals=self->getConstPointer();
2975 return convertIntArrToPyList(vals,self->getNbOfElems());
2979 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2981 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2985 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2988 bool ret0=self->isEqualIfNotWhy(other,ret1);
2989 PyObject *ret=PyTuple_New(2);
2990 PyObject *ret0Py=ret0?Py_True:Py_False;
2992 PyTuple_SetItem(ret,0,ret0Py);
2993 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2997 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2999 const int *vals=self->getConstPointer();
3000 int nbOfComp=self->getNumberOfComponents();
3001 int nbOfTuples=self->getNumberOfTuples();
3002 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3005 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3007 std::vector<const DataArrayInt *> groups;
3008 std::vector< std::vector<int> > fidsOfGroups;
3009 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3010 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3011 PyObject *ret = PyList_New(2);
3012 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3013 int sz=fidsOfGroups.size();
3014 PyObject *ret1 = PyList_New(sz);
3015 for(int i=0;i<sz;i++)
3016 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3017 PyList_SetItem(ret,1,ret1);
3021 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3024 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3025 if (!SWIG_IsOK(res1))
3028 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3029 self->transformWithIndArr(tmp,tmp+size);
3033 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3034 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3038 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3042 std::vector<int> multiVal;
3043 std::pair<int, std::pair<int,int> > slic;
3044 MEDCoupling::DataArrayInt *daIntTyypp=0;
3045 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3049 return self->findIdsEqualList(&singleVal,&singleVal+1);
3051 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3053 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3055 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3059 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3063 std::vector<int> multiVal;
3064 std::pair<int, std::pair<int,int> > slic;
3065 MEDCoupling::DataArrayInt *daIntTyypp=0;
3066 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3070 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3072 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3074 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3076 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3080 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3082 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3084 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3085 if (!SWIG_IsOK(res1))
3088 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3089 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3093 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3095 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3096 da2->checkAllocated();
3097 int size=self->getNumberOfTuples();
3098 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
3100 PyObject *ret = PyList_New(3);
3101 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3102 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3103 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3107 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3110 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3111 if (!SWIG_IsOK(res1))
3114 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3115 return self->transformWithIndArrR(tmp,tmp+size);
3119 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3120 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3124 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3127 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3128 if (!SWIG_IsOK(res1))
3131 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3132 if(size!=self->getNumberOfTuples())
3134 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3136 return self->renumberAndReduce(tmp,newNbOfTuple);
3140 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3142 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3143 da2->checkAllocated();
3144 int size=self->getNumberOfTuples();
3145 if(size!=self->getNumberOfTuples())
3147 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3149 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3153 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3156 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3157 if (!SWIG_IsOK(res1))
3160 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3161 if(size!=self->getNumberOfTuples())
3163 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3165 return self->renumber(tmp);
3169 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3171 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3172 da2->checkAllocated();
3173 int size=self->getNumberOfTuples();
3174 if(size!=self->getNumberOfTuples())
3176 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3178 return self->renumber(da2->getConstPointer());
3182 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3185 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3186 if (!SWIG_IsOK(res1))
3189 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3190 if(size!=self->getNumberOfTuples())
3192 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3194 return self->renumberR(tmp);
3198 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3200 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3201 da2->checkAllocated();
3202 int size=self->getNumberOfTuples();
3203 if(size!=self->getNumberOfTuples())
3205 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3207 return self->renumberR(da2->getConstPointer());
3211 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3213 std::vector<int> tmp;
3214 convertPyToNewIntArr3(li,tmp);
3215 self->setSelectedComponents(a,tmp);
3218 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3220 int sz=self->getNumberOfComponents();
3221 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3222 self->getTuple(tupleId,tmp);
3223 return convertIntArrToPyList(tmp,sz);
3226 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3228 DataArrayInt *arr=0;
3229 DataArrayInt *arrI=0;
3230 self->changeSurjectiveFormat(targetNb,arr,arrI);
3231 PyObject *res = PyList_New(2);
3232 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3233 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3237 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3239 std::vector<const DataArrayInt *> tmp;
3240 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3241 return DataArrayInt::Meld(tmp);
3244 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3246 std::vector<const DataArrayInt *> tmp;
3247 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3248 return DataArrayInt::Aggregate(tmp);
3251 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3253 std::vector<const DataArrayInt *> tmp;
3254 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3255 return DataArrayInt::AggregateIndexes(tmp);
3258 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3260 std::vector<const DataArrayInt *> tmp;
3261 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3262 return DataArrayInt::BuildUnion(tmp);
3265 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3267 std::vector<const DataArrayInt *> tmp;
3268 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3269 return DataArrayInt::BuildIntersection(tmp);
3272 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3275 int r1=self->getMaxValue(tmp);
3276 PyObject *ret=PyTuple_New(2);
3277 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3278 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3282 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3285 int r1=self->getMinValue(tmp);
3286 PyObject *ret=PyTuple_New(2);
3287 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3288 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3292 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3294 int nbOfCompo=self->getNumberOfComponents();
3299 if(PyInt_Check(obj))
3301 int val=(int)PyInt_AS_LONG(obj);
3302 return self->findIdFirstEqual(val);
3305 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3309 std::vector<int> arr;
3310 convertPyToNewIntArr3(obj,arr);
3311 return self->findIdFirstEqualTuple(arr);
3316 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3318 int nbOfCompo=self->getNumberOfComponents();
3325 if(PyInt_Check(obj))
3327 int val=(int)PyInt_AS_LONG(obj);
3328 return self->presenceOfValue(val);
3331 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3335 std::vector<int> arr;
3336 convertPyToNewIntArr3(obj,arr);
3337 return self->presenceOfTuple(arr);
3342 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3344 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3345 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3346 self->checkAllocated();
3347 int nbOfTuples=self->getNumberOfTuples();
3348 int nbOfComponents=self->getNumberOfComponents();
3350 std::vector<int> vt1,vc1;
3351 std::pair<int, std::pair<int,int> > pt1,pc1;
3352 DataArrayInt *dt1=0,*dc1=0;
3354 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3355 MCAuto<DataArrayInt> ret;
3360 if(nbOfComponents==1)
3361 return PyInt_FromLong(self->getIJSafe(it1,0));
3362 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3365 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3367 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3369 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3371 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3374 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3375 std::vector<int> v2(1,ic1);
3376 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3380 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3381 std::vector<int> v2(1,ic1);
3382 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3386 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3387 std::vector<int> v2(1,ic1);
3388 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3392 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3393 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3397 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3398 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3402 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3403 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3407 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3408 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3412 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3413 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3414 std::vector<int> v2(nbOfComp);
3415 for(int i=0;i<nbOfComp;i++)
3416 v2[i]=pc1.first+i*pc1.second.second;
3417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3421 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3422 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3423 std::vector<int> v2(nbOfComp);
3424 for(int i=0;i<nbOfComp;i++)
3425 v2[i]=pc1.first+i*pc1.second.second;
3426 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3430 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3431 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3432 std::vector<int> v2(nbOfComp);
3433 for(int i=0;i<nbOfComp;i++)
3434 v2[i]=pc1.first+i*pc1.second.second;
3435 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3439 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3440 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3441 std::vector<int> v2(nbOfComp);
3442 for(int i=0;i<nbOfComp;i++)
3443 v2[i]=pc1.first+i*pc1.second.second;
3444 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3447 throw INTERP_KERNEL::Exception(msg);
3451 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3453 self->checkAllocated();
3454 const char msg[]="Unexpected situation in __setitem__ !";
3455 int nbOfTuples=self->getNumberOfTuples();
3456 int nbOfComponents=self->getNumberOfComponents();
3459 std::vector<int> v1;
3461 DataArrayIntTuple *dd1=0;
3462 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3464 std::vector<int> vt1,vc1;
3465 std::pair<int, std::pair<int,int> > pt1,pc1;
3466 DataArrayInt *dt1=0,*dc1=0;
3467 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3468 MCAuto<DataArrayInt> tmp;
3476 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3479 tmp=DataArrayInt::New();
3480 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3481 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3484 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3487 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3488 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3491 throw INTERP_KERNEL::Exception(msg);
3500 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3503 tmp=DataArrayInt::New();
3504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3505 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3508 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3511 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3512 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3515 throw INTERP_KERNEL::Exception(msg);
3524 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3527 tmp=DataArrayInt::New();
3528 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3529 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3532 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3535 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3536 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3539 throw INTERP_KERNEL::Exception(msg);
3548 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3551 tmp=DataArrayInt::New();
3552 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3553 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3556 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3559 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3560 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3563 throw INTERP_KERNEL::Exception(msg);
3572 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3575 tmp=DataArrayInt::New();
3576 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3577 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3580 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3583 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3584 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3587 throw INTERP_KERNEL::Exception(msg);
3596 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3599 tmp=DataArrayInt::New();
3600 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3601 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3604 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3607 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3608 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3611 throw INTERP_KERNEL::Exception(msg);
3620 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3623 tmp=DataArrayInt::New();
3624 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3625 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3628 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3631 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3632 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3635 throw INTERP_KERNEL::Exception(msg);
3644 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3647 tmp=DataArrayInt::New();
3648 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3649 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3652 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3655 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3656 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3659 throw INTERP_KERNEL::Exception(msg);
3668 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3671 tmp=DataArrayInt::New();
3672 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3673 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3676 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3679 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3680 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3683 throw INTERP_KERNEL::Exception(msg);
3692 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3695 tmp=DataArrayInt::New();
3696 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3697 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3700 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3703 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3704 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3707 throw INTERP_KERNEL::Exception(msg);
3716 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3719 tmp=DataArrayInt::New();
3720 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3721 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3724 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3727 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3728 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3731 throw INTERP_KERNEL::Exception(msg);
3740 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3743 tmp=DataArrayInt::New();
3744 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3745 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3748 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3751 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3752 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3755 throw INTERP_KERNEL::Exception(msg);
3764 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3767 tmp=DataArrayInt::New();
3768 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3769 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3772 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3775 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3776 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3779 throw INTERP_KERNEL::Exception(msg);
3788 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3791 tmp=DataArrayInt::New();
3792 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3793 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3796 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3799 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3800 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3803 throw INTERP_KERNEL::Exception(msg);
3812 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3815 tmp=DataArrayInt::New();
3816 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3817 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3820 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3823 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3824 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3827 throw INTERP_KERNEL::Exception(msg);
3836 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3839 tmp=DataArrayInt::New();
3840 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3841 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3844 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3847 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3848 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3851 throw INTERP_KERNEL::Exception(msg);
3856 throw INTERP_KERNEL::Exception(msg);
3861 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3863 return self->negate();
3866 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3868 const char msg[]="Unexpected situation in __add__ !";
3871 std::vector<int> aa;
3872 DataArrayIntTuple *aaa;
3874 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3879 MCAuto<DataArrayInt> ret=self->deepCopy();
3880 ret->applyLin(1,val);
3885 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3886 return DataArrayInt::Add(self,aaaa);
3890 return DataArrayInt::Add(self,a);
3894 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3895 return DataArrayInt::Add(self,aaaa);
3898 throw INTERP_KERNEL::Exception(msg);
3902 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3904 const char msg[]="Unexpected situation in __radd__ !";
3907 std::vector<int> aa;
3908 DataArrayIntTuple *aaa;
3910 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3915 MCAuto<DataArrayInt> ret=self->deepCopy();
3916 ret->applyLin(1,val);
3921 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3922 return DataArrayInt::Add(self,aaaa);
3926 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3927 return DataArrayInt::Add(self,aaaa);
3930 throw INTERP_KERNEL::Exception(msg);
3934 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3936 const char msg[]="Unexpected situation in __iadd__ !";
3939 std::vector<int> aa;
3940 DataArrayIntTuple *aaa;
3942 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3947 self->applyLin(1,val);
3948 Py_XINCREF(trueSelf);
3953 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3955 Py_XINCREF(trueSelf);
3961 Py_XINCREF(trueSelf);
3966 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3967 self->addEqual(aaaa);
3968 Py_XINCREF(trueSelf);
3972 throw INTERP_KERNEL::Exception(msg);
3976 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3978 const char msg[]="Unexpected situation in __sub__ !";
3981 std::vector<int> aa;
3982 DataArrayIntTuple *aaa;
3984 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3989 MCAuto<DataArrayInt> ret=self->deepCopy();
3990 ret->applyLin(1,-val);
3995 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3996 return DataArrayInt::Substract(self,aaaa);
4000 return DataArrayInt::Substract(self,a);
4004 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4005 return DataArrayInt::Substract(self,aaaa);
4008 throw INTERP_KERNEL::Exception(msg);
4012 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4014 const char msg[]="Unexpected situation in __rsub__ !";
4017 std::vector<int> aa;
4018 DataArrayIntTuple *aaa;
4020 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4025 MCAuto<DataArrayInt> ret=self->deepCopy();
4026 ret->applyLin(-1,val);
4031 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4032 return DataArrayInt::Substract(aaaa,self);
4036 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4037 return DataArrayInt::Substract(aaaa,self);
4040 throw INTERP_KERNEL::Exception(msg);
4044 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4046 const char msg[]="Unexpected situation in __isub__ !";
4049 std::vector<int> aa;
4050 DataArrayIntTuple *aaa;
4052 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4057 self->applyLin(1,-val);
4058 Py_XINCREF(trueSelf);
4063 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4064 self->substractEqual(bb);
4065 Py_XINCREF(trueSelf);
4070 self->substractEqual(a);
4071 Py_XINCREF(trueSelf);
4076 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4077 self->substractEqual(aaaa);
4078 Py_XINCREF(trueSelf);
4082 throw INTERP_KERNEL::Exception(msg);
4086 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4088 const char msg[]="Unexpected situation in __mul__ !";
4091 std::vector<int> aa;
4092 DataArrayIntTuple *aaa;
4094 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4099 MCAuto<DataArrayInt> ret=self->deepCopy();
4100 ret->applyLin(val,0);
4105 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4106 return DataArrayInt::Multiply(self,aaaa);
4110 return DataArrayInt::Multiply(self,a);
4114 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4115 return DataArrayInt::Multiply(self,aaaa);
4118 throw INTERP_KERNEL::Exception(msg);
4122 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4124 const char msg[]="Unexpected situation in __rmul__ !";
4127 std::vector<int> aa;
4128 DataArrayIntTuple *aaa;
4130 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4135 MCAuto<DataArrayInt> ret=self->deepCopy();
4136 ret->applyLin(val,0);
4141 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4142 return DataArrayInt::Multiply(self,aaaa);
4146 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4147 return DataArrayInt::Multiply(self,aaaa);
4150 throw INTERP_KERNEL::Exception(msg);
4154 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4156 const char msg[]="Unexpected situation in __imul__ !";
4159 std::vector<int> aa;
4160 DataArrayIntTuple *aaa;
4162 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4167 self->applyLin(val,0);
4168 Py_XINCREF(trueSelf);
4173 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4174 self->multiplyEqual(bb);
4175 Py_XINCREF(trueSelf);
4180 self->multiplyEqual(a);
4181 Py_XINCREF(trueSelf);
4186 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4187 self->multiplyEqual(aaaa);
4188 Py_XINCREF(trueSelf);
4192 throw INTERP_KERNEL::Exception(msg);
4196 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4198 const char msg[]="Unexpected situation in __div__ !";
4201 std::vector<int> aa;
4202 DataArrayIntTuple *aaa;
4204 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4209 MCAuto<DataArrayInt> ret=self->deepCopy();
4210 ret->applyDivideBy(val);
4215 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4216 return DataArrayInt::Divide(self,aaaa);
4220 return DataArrayInt::Divide(self,a);
4224 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4225 return DataArrayInt::Divide(self,aaaa);
4228 throw INTERP_KERNEL::Exception(msg);
4232 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4234 const char msg[]="Unexpected situation in __rdiv__ !";
4237 std::vector<int> aa;
4238 DataArrayIntTuple *aaa;
4240 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4245 MCAuto<DataArrayInt> ret=self->deepCopy();
4251 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4252 return DataArrayInt::Divide(aaaa,self);
4256 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4257 return DataArrayInt::Divide(aaaa,self);
4260 throw INTERP_KERNEL::Exception(msg);
4264 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4266 const char msg[]="Unexpected situation in __idiv__ !";
4269 std::vector<int> aa;
4270 DataArrayIntTuple *aaa;
4272 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4277 self->applyDivideBy(val);
4278 Py_XINCREF(trueSelf);
4283 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4284 self->divideEqual(bb);
4285 Py_XINCREF(trueSelf);
4290 self->divideEqual(a);
4291 Py_XINCREF(trueSelf);
4296 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4297 self->divideEqual(aaaa);
4298 Py_XINCREF(trueSelf);
4302 throw INTERP_KERNEL::Exception(msg);
4306 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4308 const char msg[]="Unexpected situation in __mod__ !";
4311 std::vector<int> aa;
4312 DataArrayIntTuple *aaa;
4314 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4319 MCAuto<DataArrayInt> ret=self->deepCopy();
4320 ret->applyModulus(val);
4325 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4326 return DataArrayInt::Modulus(self,aaaa);
4330 return DataArrayInt::Modulus(self,a);
4334 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4335 return DataArrayInt::Modulus(self,aaaa);
4338 throw INTERP_KERNEL::Exception(msg);
4342 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4344 const char msg[]="Unexpected situation in __rmod__ !";
4347 std::vector<int> aa;
4348 DataArrayIntTuple *aaa;
4350 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4355 MCAuto<DataArrayInt> ret=self->deepCopy();
4356 ret->applyRModulus(val);
4361 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4362 return DataArrayInt::Modulus(aaaa,self);
4366 return DataArrayInt::Modulus(a,self);
4370 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4371 return DataArrayInt::Modulus(aaaa,self);
4374 throw INTERP_KERNEL::Exception(msg);
4378 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4380 const char msg[]="Unexpected situation in __imod__ !";
4383 std::vector<int> aa;
4384 DataArrayIntTuple *aaa;
4386 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4391 self->applyModulus(val);
4392 Py_XINCREF(trueSelf);
4397 self->modulusEqual(a);
4398 Py_XINCREF(trueSelf);
4403 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4404 self->modulusEqual(aaaa);
4405 Py_XINCREF(trueSelf);
4409 throw INTERP_KERNEL::Exception(msg);
4413 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4415 const char msg[]="Unexpected situation in __pow__ !";
4418 std::vector<int> aa;
4419 DataArrayIntTuple *aaa;
4421 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4426 MCAuto<DataArrayInt> ret=self->deepCopy();
4432 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4433 return DataArrayInt::Pow(self,aaaa);
4437 return DataArrayInt::Pow(self,a);
4441 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4442 return DataArrayInt::Pow(self,aaaa);
4445 throw INTERP_KERNEL::Exception(msg);
4449 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4451 const char msg[]="Unexpected situation in __rpow__ !";
4454 std::vector<int> aa;
4455 DataArrayIntTuple *aaa;
4457 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4462 MCAuto<DataArrayInt> ret=self->deepCopy();
4463 ret->applyRPow(val);
4468 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4469 return DataArrayInt::Pow(aaaa,self);
4473 return DataArrayInt::Pow(a,self);
4477 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4478 return DataArrayInt::Pow(aaaa,self);
4481 throw INTERP_KERNEL::Exception(msg);
4485 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4487 const char msg[]="Unexpected situation in __ipow__ !";
4490 std::vector<int> aa;
4491 DataArrayIntTuple *aaa;
4493 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4498 self->applyPow(val);
4499 Py_XINCREF(trueSelf);
4505 Py_XINCREF(trueSelf);
4510 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4511 self->powEqual(aaaa);
4512 Py_XINCREF(trueSelf);
4516 throw INTERP_KERNEL::Exception(msg);
4520 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4522 std::ostringstream oss;
4523 self->reprQuickOverview(oss);
4527 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4529 int szArr,sw,iTypppArr;
4530 std::vector<int> stdvecTyyppArr;
4531 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4532 self->pushBackValsSilent(tmp,tmp+szArr);
4535 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4537 std::vector<int> ret1;
4538 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4539 std::size_t sz=ret0.size();
4540 PyObject *pyRet=PyTuple_New(2);
4541 PyObject *pyRet0=PyList_New((int)sz);
4542 PyObject *pyRet1=PyList_New((int)sz);
4543 for(std::size_t i=0;i<sz;i++)
4545 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4546 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4548 PyTuple_SetItem(pyRet,0,pyRet0);
4549 PyTuple_SetItem(pyRet,1,pyRet1);
4553 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4555 DataArrayInt *ret0=0,*ret1=0;
4556 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4557 PyObject *pyRet=PyTuple_New(2);
4558 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4559 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4563 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4566 bool ret(self->isRange(a,b,c));
4567 PyObject *pyRet=PyTuple_New(2);
4568 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4570 PyTuple_SetItem(pyRet,0,ret0Py);
4572 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4578 PyTuple_SetItem(pyRet,1,ret1Py);
4583 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4585 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4586 if(!PyTuple_Check(args))
4587 throw INTERP_KERNEL::Exception(MSG);
4588 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4589 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4590 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4592 PyObject *tmp0(PyTuple_New(1));
4593 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4594 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4596 Py_DECREF(selfMeth);
4597 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4598 int sz(PyTuple_Size(args));
4600 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4601 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4602 PyObject *zeNumpyRepr(0);
4603 PyObject *tmp1(PyInt_FromLong(0));
4604 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4606 PyObject *tmp3(PyTuple_New(1));
4607 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4608 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4612 Py_DECREF(initMeth);
4616 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4619 if(!self->isAllocated())
4620 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4621 PyObject *ret(PyTuple_New(1));
4622 PyObject *ret0(PyDict_New());
4623 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4624 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4625 PyObject *tmp1(PyInt_FromLong(0));
4626 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4627 PyTuple_SetItem(ret,0,ret0);
4631 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4637 class DataArrayIntTuple;
4639 class DataArrayIntIterator
4642 DataArrayIntIterator(DataArrayInt *da);
4643 ~DataArrayIntIterator();
4648 DataArrayIntTuple *ret=self->nextt();
4650 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4653 PyErr_SetString(PyExc_StopIteration,"No more data.");
4660 class DataArrayIntTuple
4663 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4664 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4667 std::string __str__() const throw(INTERP_KERNEL::Exception)
4669 return self->repr();
4672 int __int__() const throw(INTERP_KERNEL::Exception)
4674 return self->intValue();
4677 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4679 return self->buildDAInt(1,self->getNumberOfCompo());
4682 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4684 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4685 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4686 Py_XINCREF(trueSelf);
4690 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4692 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4693 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4694 Py_XINCREF(trueSelf);
4698 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4700 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4701 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4702 Py_XINCREF(trueSelf);
4706 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4708 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4709 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4710 Py_XINCREF(trueSelf);
4714 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4716 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4717 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4718 Py_XINCREF(trueSelf);
4722 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4724 return PyInt_FromLong(self->getNumberOfCompo());
4727 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4729 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4732 std::vector<int> multiVal;
4733 std::pair<int, std::pair<int,int> > slic;
4734 MEDCoupling::DataArrayInt *daIntTyypp=0;
4735 const int *pt=self->getConstPointer();
4736 int nbc=self->getNumberOfCompo();
4737 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4744 std::ostringstream oss;
4745 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4746 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4750 return PyInt_FromLong(pt[singleVal]);
4754 return PyInt_FromLong(pt[nbc+singleVal]);
4757 std::ostringstream oss;
4758 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4759 throw INTERP_KERNEL::Exception(oss.str().c_str());
4765 PyObject *t=PyTuple_New(multiVal.size());
4766 for(int j=0;j<(int)multiVal.size();j++)
4768 int cid=multiVal[j];
4771 std::ostringstream oss;
4772 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4773 throw INTERP_KERNEL::Exception(oss.str().c_str());
4775 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4781 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4782 PyObject *t=PyTuple_New(sz);
4783 for(int j=0;j<sz;j++)
4784 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4788 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4792 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4794 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4795 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4798 std::vector<int> multiValV;
4799 std::pair<int, std::pair<int,int> > slicV;
4800 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4801 int nbc=self->getNumberOfCompo();
4802 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4804 std::vector<int> multiVal;
4805 std::pair<int, std::pair<int,int> > slic;
4806 MEDCoupling::DataArrayInt *daIntTyypp=0;
4807 int *pt=self->getPointer();
4808 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4815 std::ostringstream oss;
4816 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4817 throw INTERP_KERNEL::Exception(oss.str().c_str());
4823 pt[singleVal]=singleValV;
4828 if(multiValV.size()!=1)
4830 std::ostringstream oss;
4831 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4832 throw INTERP_KERNEL::Exception(oss.str().c_str());
4834 pt[singleVal]=multiValV[0];
4839 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4843 throw INTERP_KERNEL::Exception(msg);
4852 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4856 std::ostringstream oss;
4857 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4858 throw INTERP_KERNEL::Exception(oss.str().c_str());
4866 if(multiVal.size()!=multiValV.size())
4868 std::ostringstream oss;
4869 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4870 throw INTERP_KERNEL::Exception(oss.str().c_str());
4872 for(int i=0;i<(int)multiVal.size();i++)
4874 int pos=multiVal[i];
4877 std::ostringstream oss;
4878 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4879 throw INTERP_KERNEL::Exception(oss.str().c_str());
4881 pt[multiVal[i]]=multiValV[i];
4887 const int *ptV=daIntTyyppV->getConstPointer();
4888 if(nbc>daIntTyyppV->getNumberOfCompo())
4890 std::ostringstream oss;
4891 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4892 throw INTERP_KERNEL::Exception(oss.str().c_str());
4894 std::copy(ptV,ptV+nbc,pt);
4898 throw INTERP_KERNEL::Exception(msg);
4903 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4908 for(int j=0;j<sz;j++)
4909 pt[slic.first+j*slic.second.second]=singleValV;
4914 if(sz!=(int)multiValV.size())
4916 std::ostringstream oss;
4917 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4918 throw INTERP_KERNEL::Exception(oss.str().c_str());
4920 for(int j=0;j<sz;j++)
4921 pt[slic.first+j*slic.second.second]=multiValV[j];
4926 const int *ptV=daIntTyyppV->getConstPointer();
4927 if(sz>daIntTyyppV->getNumberOfCompo())
4929 std::ostringstream oss;
4930 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4931 throw INTERP_KERNEL::Exception(oss.str().c_str());
4933 for(int j=0;j<sz;j++)
4934 pt[slic.first+j*slic.second.second]=ptV[j];
4938 throw INTERP_KERNEL::Exception(msg);
4942 throw INTERP_KERNEL::Exception(msg);
4948 class DataArrayChar : public DataArray
4951 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4952 int getHashCode() const throw(INTERP_KERNEL::Exception);
4953 bool empty() const throw(INTERP_KERNEL::Exception);
4954 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4955 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4956 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4957 char popBackSilent() throw(INTERP_KERNEL::Exception);
4958 void pack() const throw(INTERP_KERNEL::Exception);
4959 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4960 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4961 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4962 void reverse() throw(INTERP_KERNEL::Exception);
4963 void fillWithZero() throw(INTERP_KERNEL::Exception);
4964 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4965 std::string repr() const throw(INTERP_KERNEL::Exception);
4966 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4967 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4968 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4969 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4970 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4971 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4972 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4973 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4974 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4975 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4976 char front() const throw(INTERP_KERNEL::Exception);
4977 char back() const throw(INTERP_KERNEL::Exception);
4978 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4979 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4980 char *getPointer() throw(INTERP_KERNEL::Exception);
4981 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4982 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4983 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4984 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4985 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4986 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4987 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4988 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4989 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4990 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4991 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4994 int __len__() const throw(INTERP_KERNEL::Exception)
4996 if(self->isAllocated())
4998 return self->getNumberOfTuples();
5002 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5006 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5009 bool ret0=self->isEqualIfNotWhy(other,ret1);
5010 PyObject *ret=PyTuple_New(2);
5011 PyObject *ret0Py=ret0?Py_True:Py_False;
5013 PyTuple_SetItem(ret,0,ret0Py);
5014 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5018 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5021 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5022 if (!SWIG_IsOK(res1))
5025 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5026 if(size!=self->getNumberOfTuples())
5028 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5030 return self->renumber(tmp);
5034 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5036 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5037 da2->checkAllocated();
5038 int size=self->getNumberOfTuples();
5039 if(size!=self->getNumberOfTuples())
5041 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5043 return self->renumber(da2->getConstPointer());
5047 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5050 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5051 if (!SWIG_IsOK(res1))
5054 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5055 if(size!=self->getNumberOfTuples())
5057 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5059 return self->renumberR(tmp);
5063 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5065 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5066 da2->checkAllocated();
5067 int size=self->getNumberOfTuples();
5068 if(size!=self->getNumberOfTuples())
5070 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5072 return self->renumberR(da2->getConstPointer());
5076 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5079 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5080 if (!SWIG_IsOK(res1))
5083 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5084 if(size!=self->getNumberOfTuples())
5086 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5088 return self->renumberAndReduce(tmp,newNbOfTuple);
5092 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5094 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5095 da2->checkAllocated();
5096 int size=self->getNumberOfTuples();
5097 if(size!=self->getNumberOfTuples())
5099 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5101 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5105 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5107 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5108 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5109 return DataArrayChar::Aggregate(tmp);
5112 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5114 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5115 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5116 return DataArrayChar::Meld(tmp);
5121 class DataArrayByteIterator;
5123 class DataArrayByte : public DataArrayChar
5126 static DataArrayByte *New();
5127 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5128 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5129 char byteValue() const throw(INTERP_KERNEL::Exception);
5132 DataArrayByte() throw(INTERP_KERNEL::Exception)
5134 return DataArrayByte::New();
5137 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5139 const char *msg="MEDCoupling::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) !";
5140 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5144 if(PyInt_Check(nbOfTuples))
5146 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5148 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5151 if(PyInt_Check(nbOfComp))
5152 {//DataArrayByte.New([1,3,4,5],2,2)
5153 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5155 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5156 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5157 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5158 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5162 throw INTERP_KERNEL::Exception(msg);
5165 {//DataArrayByte.New([1,3,4],3)
5166 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5168 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5169 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5174 throw INTERP_KERNEL::Exception(msg);
5177 {// DataArrayByte.New([1,3,4])
5178 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5179 int tmpp1=-1,tmpp2=-1;
5180 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5181 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5185 else if(PyInt_Check(elt0))
5187 int nbOfTuples1=PyInt_AS_LONG(elt0);
5189 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5194 if(PyInt_Check(nbOfTuples))
5195 {//DataArrayByte.New(5,2)
5196 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5198 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5199 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5200 ret->alloc(nbOfTuples1,nbOfCompo);
5204 throw INTERP_KERNEL::Exception(msg);
5207 throw INTERP_KERNEL::Exception(msg);
5210 {//DataArrayByte.New(5)
5211 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5212 ret->alloc(nbOfTuples1,1);
5217 throw INTERP_KERNEL::Exception(msg);
5220 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5222 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5225 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5227 std::ostringstream oss;
5228 self->reprQuickOverview(oss);
5232 int __int__() const throw(INTERP_KERNEL::Exception)
5234 return (int) self->byteValue();
5237 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5239 return self->iterator();
5242 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5244 return (int)self->getIJ(tupleId,compoId);
5247 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5249 return (int)self->getIJSafe(tupleId,compoId);
5252 std::string __str__() const throw(INTERP_KERNEL::Exception)
5254 return self->repr();
5257 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5259 const char *vals=self->getConstPointer();
5260 int nbOfComp=self->getNumberOfComponents();
5261 int nbOfTuples=self->getNumberOfTuples();
5262 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5265 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5268 int ival=-1; std::vector<int> ivval;
5269 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5270 std::vector<char> vals(sz);
5271 std::copy(pt,pt+sz,vals.begin());
5272 return self->presenceOfTuple(vals);
5275 bool presenceOfValue(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->presenceOfValue(vals2);
5285 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5288 int ival=-1; std::vector<int> ivval;
5289 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5290 std::vector<char> vals2(sz);
5291 std::copy(pt,pt+sz,vals2.begin());
5292 return self->findIdFirstEqual(vals2);
5295 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5298 int ival=-1; std::vector<int> ivval;
5299 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5300 std::vector<char> vals(sz);
5301 std::copy(pt,pt+sz,vals.begin());
5302 return self->findIdFirstEqualTuple(vals);
5305 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5308 int ival=-1; std::vector<int> ivval;
5309 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5310 std::vector<char> vals(sz);
5311 std::copy(pt,pt+sz,vals.begin());
5312 return self->findIdSequence(vals);
5315 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5317 int sz=self->getNumberOfComponents();
5318 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5319 self->getTuple(tupleId,tmp);
5320 PyObject *ret=PyTuple_New(sz);
5321 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5325 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5328 int r1=(int)self->getMaxValue(tmp);
5329 PyObject *ret=PyTuple_New(2);
5330 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5331 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5335 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5338 int r1=(int)self->getMinValue(tmp);
5339 PyObject *ret=PyTuple_New(2);
5340 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5341 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5345 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5347 int nbOfCompo=self->getNumberOfComponents();
5352 if(PyInt_Check(obj))
5354 int val=(int)PyInt_AS_LONG(obj);
5355 return self->findIdFirstEqual(val);
5358 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5361 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5365 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5367 int nbOfCompo=self->getNumberOfComponents();
5374 if(PyInt_Check(obj))
5376 int val=(int)PyInt_AS_LONG(obj);
5377 return self->presenceOfValue(val);
5380 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5383 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5387 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5389 self->checkAllocated();
5390 const char msg[]="Unexpected situation in __setitem__ !";
5391 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5394 std::vector<int> v1;
5396 DataArrayIntTuple *dd1=0;
5397 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5399 std::vector<int> vt1,vc1;
5400 std::pair<int, std::pair<int,int> > pt1,pc1;
5401 DataArrayInt *dt1=0,*dc1=0;
5402 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5403 MCAuto<DataArrayInt> tmp;
5411 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5414 throw INTERP_KERNEL::Exception(msg);
5423 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5426 throw INTERP_KERNEL::Exception(msg);
5435 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5438 throw INTERP_KERNEL::Exception(msg);
5447 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5450 throw INTERP_KERNEL::Exception(msg);
5459 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5462 throw INTERP_KERNEL::Exception(msg);
5471 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5474 throw INTERP_KERNEL::Exception(msg);
5483 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5486 throw INTERP_KERNEL::Exception(msg);
5495 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5498 throw INTERP_KERNEL::Exception(msg);
5507 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5510 throw INTERP_KERNEL::Exception(msg);
5519 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5522 throw INTERP_KERNEL::Exception(msg);
5531 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5534 throw INTERP_KERNEL::Exception(msg);
5543 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5546 throw INTERP_KERNEL::Exception(msg);
5555 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5558 throw INTERP_KERNEL::Exception(msg);
5567 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5570 throw INTERP_KERNEL::Exception(msg);
5579 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5582 throw INTERP_KERNEL::Exception(msg);
5591 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5594 throw INTERP_KERNEL::Exception(msg);
5599 throw INTERP_KERNEL::Exception(msg);
5606 class DataArrayByteTuple;
5608 class DataArrayByteIterator
5611 DataArrayByteIterator(DataArrayByte *da);
5612 ~DataArrayByteIterator();
5615 class DataArrayByteTuple
5618 std::string repr() const throw(INTERP_KERNEL::Exception);
5619 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5622 std::string __str__() const throw(INTERP_KERNEL::Exception)
5624 return self->repr();
5627 char __int__() const throw(INTERP_KERNEL::Exception)
5629 return self->byteValue();
5632 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5634 return self->buildDAByte(1,self->getNumberOfCompo());
5639 class DataArrayAsciiCharIterator;
5641 class DataArrayAsciiChar : public DataArrayChar
5644 static DataArrayAsciiChar *New();
5645 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5646 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5647 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5650 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5652 return DataArrayAsciiChar::New();
5655 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5657 const char *msg="MEDCoupling::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) !";
5658 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5662 if(PyInt_Check(nbOfTuples))
5664 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5666 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5669 if(PyInt_Check(nbOfComp))
5670 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5671 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5673 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5674 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5675 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5676 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5680 throw INTERP_KERNEL::Exception(msg);
5683 {//DataArrayAsciiChar.New([1,3,4],3)
5684 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5686 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5687 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5691 else if(PyString_Check(nbOfTuples))
5693 if(PyString_Size(nbOfTuples)!=1)
5694 throw INTERP_KERNEL::Exception(msg);
5695 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5696 std::vector<std::string> tmp;
5697 if(fillStringVector(elt0,tmp))
5698 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5700 throw INTERP_KERNEL::Exception(msg);
5703 throw INTERP_KERNEL::Exception(msg);
5707 std::vector<std::string> tmmp;
5708 if(fillStringVector(elt0,tmmp))
5709 //DataArrayAsciiChar.New(["abc","de","fghi"])
5710 return DataArrayAsciiChar::New(tmmp,' ');
5713 // DataArrayAsciiChar.New([1,3,4])
5714 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5715 int tmpp1=-1,tmpp2=-1;
5716 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5717 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5722 else if(PyInt_Check(elt0))
5724 int nbOfTuples1=PyInt_AS_LONG(elt0);
5726 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5731 if(PyInt_Check(nbOfTuples))
5732 {//DataArrayAsciiChar.New(5,2)
5733 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5735 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5736 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5737 ret->alloc(nbOfTuples1,nbOfCompo);
5741 throw INTERP_KERNEL::Exception(msg);
5744 throw INTERP_KERNEL::Exception(msg);
5747 {//DataArrayAsciiChar.New(5)
5748 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5749 ret->alloc(nbOfTuples1,1);
5754 throw INTERP_KERNEL::Exception(msg);
5757 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5759 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5762 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5764 std::ostringstream oss;
5765 self->reprQuickOverview(oss);
5769 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5771 return self->iterator();
5774 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5776 char tmp[2]; tmp[1]='\0';
5777 tmp[0]=self->getIJ(tupleId,compoId);
5778 return std::string(tmp);
5781 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5783 char tmp[2]; tmp[1]='\0';
5784 tmp[0]=self->getIJSafe(tupleId,compoId);
5785 return std::string(tmp);
5788 std::string __str__() const throw(INTERP_KERNEL::Exception)
5790 return self->repr();
5793 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5795 const char *vals=self->getConstPointer();
5796 int nbOfComp=self->getNumberOfComponents();
5797 int nbOfTuples=self->getNumberOfTuples();
5798 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5801 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5803 if(PyString_Check(tupl))
5805 Py_ssize_t sz=PyString_Size(tupl);
5806 std::vector<char> vals(sz);
5807 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5808 return self->presenceOfTuple(vals);
5811 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5814 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5816 if(PyString_Check(vals))
5818 Py_ssize_t sz=PyString_Size(vals);
5819 std::vector<char> vals2(sz);
5820 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5821 return self->presenceOfValue(vals2);
5824 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5827 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5829 if(PyString_Check(vals))
5831 Py_ssize_t sz=PyString_Size(vals);
5832 std::vector<char> vals2(sz);
5833 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5834 return self->findIdFirstEqual(vals2);
5837 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5840 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5842 if(PyString_Check(tupl))
5844 Py_ssize_t sz=PyString_Size(tupl);
5845 std::vector<char> vals(sz);
5846 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5847 return self->findIdFirstEqualTuple(vals);
5850 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5853 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5855 if(PyString_Check(strOrListOfInt))
5857 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5858 std::vector<char> vals(sz);
5859 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5860 return self->findIdSequence(vals);
5863 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5866 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5868 int sz=self->getNumberOfComponents();
5869 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5870 self->getTuple(tupleId,tmp);
5871 return PyString_FromString(tmp);
5874 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5877 char tmp2[2]; tmp2[1]='\0';
5878 tmp2[0]=self->getMaxValue(tmp);
5879 PyObject *ret=PyTuple_New(2);
5880 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5881 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5885 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5888 char tmp2[2]; tmp2[1]='\0';
5889 tmp2[0]=self->getMinValue(tmp);
5890 PyObject *ret=PyTuple_New(2);
5891 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5892 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5896 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5898 int nbOfCompo=self->getNumberOfComponents();
5903 if(PyString_Check(obj))
5905 Py_ssize_t sz=PyString_Size(obj);
5906 char *pt=PyString_AsString(obj);
5908 return self->findIdFirstEqual(pt[0]);
5910 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5913 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5916 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5920 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5922 int nbOfCompo=self->getNumberOfComponents();
5929 if(PyString_Check(obj))
5931 Py_ssize_t sz=PyString_Size(obj);
5932 char *pt=PyString_AsString(obj);
5934 return self->presenceOfValue(pt[0]);
5936 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5939 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5942 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5946 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5949 std::vector<int> stdvecTyyppArr;
5950 std::pair<int, std::pair<int,int> > sTyyppArr;
5951 MEDCoupling::DataArrayInt *daIntTyypp=0;
5952 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5956 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5958 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5960 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5962 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5964 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5968 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5970 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.";
5972 std::vector<int> stdvecTyyppArr;
5973 std::pair<int, std::pair<int,int> > sTyyppArr;
5974 MEDCoupling::DataArrayInt *daIntTyypp=0;
5975 int nbOfCompo=self->getNumberOfComponents();
5976 int nbOfTuples=self->getNumberOfTuples();
5977 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5979 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5980 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5989 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5995 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5996 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5999 //value vector<string>
6002 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6003 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6006 //value DataArrayChar
6009 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6013 throw INTERP_KERNEL::Exception(msg);
6017 {//obj list-tuple[int]
6023 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6029 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6030 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6033 //value vector<string>
6036 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6037 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6040 //value DataArrayChar
6043 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6047 throw INTERP_KERNEL::Exception(msg);
6058 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6064 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6065 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6068 //value vector<string>
6071 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6072 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6075 //value DataArrayChar
6078 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6082 throw INTERP_KERNEL::Exception(msg);
6093 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6099 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6100 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6103 //value vector<string>
6106 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6107 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6110 //value DataArrayChar
6113 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6117 throw INTERP_KERNEL::Exception(msg);
6122 throw INTERP_KERNEL::Exception(msg);
6128 class DataArrayAsciiCharTuple;
6130 class DataArrayAsciiCharIterator
6133 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6134 ~DataArrayAsciiCharIterator();
6139 DataArrayAsciiCharTuple *ret=self->nextt();
6141 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6144 PyErr_SetString(PyExc_StopIteration,"No more data.");
6151 class DataArrayAsciiCharTuple
6154 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6155 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6158 std::string __str__() const throw(INTERP_KERNEL::Exception)
6160 return self->repr();
6163 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6165 return self->buildDAAsciiChar(1,self->getNumberOfCompo());