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 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
536 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
537 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
538 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
539 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
540 double popBackSilent() throw(INTERP_KERNEL::Exception);
541 void pack() const throw(INTERP_KERNEL::Exception);
542 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
543 void fillWithZero() throw(INTERP_KERNEL::Exception);
544 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
545 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
546 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
547 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
548 void reverse() throw(INTERP_KERNEL::Exception);
549 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
550 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
551 std::string repr() const throw(INTERP_KERNEL::Exception);
552 std::string reprZip() const throw(INTERP_KERNEL::Exception);
553 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
554 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
555 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
556 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
560 void transpose() throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
562 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
565 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
566 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
567 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
568 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
569 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
570 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
571 double front() const throw(INTERP_KERNEL::Exception);
572 double back() const throw(INTERP_KERNEL::Exception);
573 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
574 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
575 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
576 double *getPointer() throw(INTERP_KERNEL::Exception);
577 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
578 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
579 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
580 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
581 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
582 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
583 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
584 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
585 double getAverageValue() const throw(INTERP_KERNEL::Exception);
586 double norm2() const throw(INTERP_KERNEL::Exception);
587 double normMax() const throw(INTERP_KERNEL::Exception);
588 double normMin() const throw(INTERP_KERNEL::Exception);
589 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
590 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
591 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
595 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
596 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
606 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
607 void abs() throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
609 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
610 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
611 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
612 void applyPow(double val) throw(INTERP_KERNEL::Exception);
613 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
617 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
618 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
620 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
621 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
622 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
623 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
624 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
625 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
626 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
627 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
630 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
631 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
632 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
633 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
634 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
635 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
636 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
637 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
638 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
639 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
640 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
643 DataArrayDouble() throw(INTERP_KERNEL::Exception)
645 return DataArrayDouble::New();
648 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
650 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)";
651 std::string msg(msgBase);
653 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
656 if(PyList_Check(elt0) || PyTuple_Check(elt0))
660 if(PyInt_Check(nbOfTuples))
662 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
664 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
667 if(PyInt_Check(elt2))
668 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
669 int nbOfCompo=PyInt_AS_LONG(elt2);
671 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
672 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
673 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
674 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
678 throw INTERP_KERNEL::Exception(msg.c_str());
681 {//DataArrayDouble.New([1.,3.,4.],3)
682 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
684 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
685 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
690 throw INTERP_KERNEL::Exception(msg.c_str());
693 {// DataArrayDouble.New([1.,3.,4.])
694 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
695 int tmpp1=-1,tmpp2=-1;
696 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
697 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
701 else if(PyInt_Check(elt0))
703 int nbOfTuples1=PyInt_AS_LONG(elt0);
705 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
710 if(PyInt_Check(nbOfTuples))
711 {//DataArrayDouble.New(5,2)
712 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
714 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
715 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
716 ret->alloc(nbOfTuples1,nbOfCompo);
720 throw INTERP_KERNEL::Exception(msg.c_str());
723 throw INTERP_KERNEL::Exception(msg.c_str());
726 {//DataArrayDouble.New(5)
727 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
728 ret->alloc(nbOfTuples1,1);
733 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
734 {//DataArrayDouble.New(numpyArray)
735 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
739 throw INTERP_KERNEL::Exception(msg.c_str());
740 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
743 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
745 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
748 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
751 std::vector<double> bb;
753 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
754 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
755 self->pushBackValsSilent(tmp,tmp+nbTuples);
758 std::string __repr__() const throw(INTERP_KERNEL::Exception)
760 std::ostringstream oss;
761 self->reprQuickOverview(oss);
765 std::string __str__() const throw(INTERP_KERNEL::Exception)
767 return self->reprNotTooLong();
770 double __float__() const throw(INTERP_KERNEL::Exception)
772 return self->doubleValue();
775 int __len__() const throw(INTERP_KERNEL::Exception)
777 if(self->isAllocated())
779 return self->getNumberOfTuples();
783 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
787 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
789 return self->iterator();
792 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
794 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 !";
795 if(PyList_Check(li) || PyTuple_Check(li))
799 if(PyInt_Check(nbOfTuples))
801 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
803 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
806 if(PyInt_Check(nbOfComp))
807 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
808 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
810 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
811 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
812 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
815 throw INTERP_KERNEL::Exception(msg);
818 {//DataArrayDouble.setValues([1.,3.,4.],3)
820 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
821 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
825 throw INTERP_KERNEL::Exception(msg);
828 {// DataArrayDouble.setValues([1.,3.,4.])
829 int tmpp1=-1,tmpp2=-1;
830 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
831 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
835 throw INTERP_KERNEL::Exception(msg);
838 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
840 const double *vals=self->getConstPointer();
841 return convertDblArrToPyList(vals,self->getNbOfElems());
845 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
847 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
851 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
854 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
855 PyObject *ret=PyTuple_New(2);
856 PyObject *ret0Py=ret0?Py_True:Py_False;
858 PyTuple_SetItem(ret,0,ret0Py);
859 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
863 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
865 const double *vals=self->getConstPointer();
866 int nbOfComp=self->getNumberOfComponents();
867 int nbOfTuples=self->getNumberOfTuples();
868 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
871 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
874 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
875 if (!SWIG_IsOK(res1))
878 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
879 if(size!=self->getNumberOfTuples())
881 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
883 return self->renumber(tmp);
887 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
889 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
890 da2->checkAllocated();
891 int size=self->getNumberOfTuples();
892 if(size!=self->getNumberOfTuples())
894 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
896 return self->renumber(da2->getConstPointer());
900 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
903 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
904 if (!SWIG_IsOK(res1))
907 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
908 if(size!=self->getNumberOfTuples())
910 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
912 return self->renumberR(tmp);
916 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
918 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
919 da2->checkAllocated();
920 int size=self->getNumberOfTuples();
921 if(size!=self->getNumberOfTuples())
923 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
925 return self->renumberR(da2->getConstPointer());
929 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
932 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
933 if (!SWIG_IsOK(res1))
936 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
937 if(size!=self->getNumberOfTuples())
939 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
941 return self->renumberAndReduce(tmp,newNbOfTuple);
945 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
947 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
948 da2->checkAllocated();
949 int size=self->getNumberOfTuples();
950 if(size!=self->getNumberOfTuples())
952 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
954 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
958 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
960 int thisTupleId,otherTupleId;
961 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
962 PyObject *ret=PyTuple_New(3);
963 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
964 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
965 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
969 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
972 double r1=self->getMaxValue(tmp);
973 PyObject *ret=PyTuple_New(2);
974 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
975 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
979 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
982 double r1=self->getMaxValue2(tmp);
983 PyObject *ret=PyTuple_New(2);
984 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
985 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
989 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
992 double r1=self->getMinValue(tmp);
993 PyObject *ret=PyTuple_New(2);
994 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
995 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
999 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1002 double r1=self->getMinValue2(tmp);
1003 PyObject *ret=PyTuple_New(2);
1004 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1005 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1009 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1011 int nbOfCompo=self->getNumberOfComponents();
1012 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1013 self->getMinMaxPerComponent(tmp);
1014 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1018 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1020 int sz=self->getNumberOfComponents();
1021 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1022 self->accumulate(tmp);
1023 return convertDblArrToPyList(tmp,sz);
1026 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1029 std::vector<int> val2;
1030 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1031 return self->accumulatePerChunck(bg,bg+sz);
1034 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1036 DataArrayInt *comm, *commIndex;
1037 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1038 PyObject *res = PyList_New(2);
1039 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1040 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1044 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1048 DataArrayDoubleTuple *aa;
1049 std::vector<double> bb;
1051 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1052 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1054 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1055 PyObject *ret=PyTuple_New(2);
1056 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1057 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1061 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1063 std::vector<int> tmp;
1064 convertPyToNewIntArr3(li,tmp);
1065 self->setSelectedComponents(a,tmp);
1068 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1070 int sz=self->getNumberOfComponents();
1071 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1072 self->getTuple(tupleId,tmp);
1073 return convertDblArrToPyList(tmp,sz);
1076 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1078 std::vector<const DataArrayDouble *> tmp;
1079 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1080 return DataArrayDouble::Aggregate(tmp);
1083 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1085 std::vector<const DataArrayDouble *> tmp;
1086 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1087 return DataArrayDouble::Meld(tmp);
1090 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1094 DataArrayDoubleTuple *aa;
1095 std::vector<double> bb;
1097 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1098 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1099 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1100 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1101 DataArrayInt *c=0,*cI=0;
1102 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1103 PyObject *ret=PyTuple_New(2);
1104 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1105 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1109 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1111 DataArrayInt *ret1=0;
1112 bool ret0=self->areIncludedInMe(other,prec,ret1);
1113 PyObject *ret=PyTuple_New(2);
1114 PyObject *ret0Py=ret0?Py_True:Py_False;
1116 PyTuple_SetItem(ret,0,ret0Py);
1117 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1121 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1123 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1124 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1125 self->checkAllocated();
1126 int nbOfTuples=self->getNumberOfTuples();
1127 int nbOfComponents=self->getNumberOfComponents();
1129 std::vector<int> vt1,vc1;
1130 std::pair<int, std::pair<int,int> > pt1,pc1;
1131 DataArrayInt *dt1=0,*dc1=0;
1133 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1134 MCAuto<DataArrayDouble> ret;
1138 if(nbOfComponents==1)
1139 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1140 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1142 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1144 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1146 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1148 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1151 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1152 std::vector<int> v2(1,ic1);
1153 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1157 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1158 std::vector<int> v2(1,ic1);
1159 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1163 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1164 std::vector<int> v2(1,ic1);
1165 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1169 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1174 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1175 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1179 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1180 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1184 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1185 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1189 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1190 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1191 std::vector<int> v2(nbOfComp);
1192 for(int i=0;i<nbOfComp;i++)
1193 v2[i]=pc1.first+i*pc1.second.second;
1194 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1198 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1199 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1200 std::vector<int> v2(nbOfComp);
1201 for(int i=0;i<nbOfComp;i++)
1202 v2[i]=pc1.first+i*pc1.second.second;
1203 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1207 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1208 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1209 std::vector<int> v2(nbOfComp);
1210 for(int i=0;i<nbOfComp;i++)
1211 v2[i]=pc1.first+i*pc1.second.second;
1212 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1216 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1217 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1218 std::vector<int> v2(nbOfComp);
1219 for(int i=0;i<nbOfComp;i++)
1220 v2[i]=pc1.first+i*pc1.second.second;
1221 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1224 throw INTERP_KERNEL::Exception(msg);
1228 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1230 self->checkAllocated();
1231 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1232 int nbOfTuples=self->getNumberOfTuples();
1233 int nbOfComponents=self->getNumberOfComponents();
1236 std::vector<double> v1;
1237 DataArrayDouble *d1=0;
1238 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1240 std::vector<int> vt1,vc1;
1241 std::pair<int, std::pair<int,int> > pt1,pc1;
1242 DataArrayInt *dt1=0,*dc1=0;
1243 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1244 MCAuto<DataArrayDouble> tmp;
1252 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1255 tmp=DataArrayDouble::New();
1256 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1257 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1260 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1263 throw INTERP_KERNEL::Exception(msg);
1272 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1275 tmp=DataArrayDouble::New();
1276 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1277 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1280 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1283 throw INTERP_KERNEL::Exception(msg);
1292 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1295 tmp=DataArrayDouble::New();
1296 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1297 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1300 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1303 throw INTERP_KERNEL::Exception(msg);
1312 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1315 tmp=DataArrayDouble::New();
1316 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1317 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1320 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1323 throw INTERP_KERNEL::Exception(msg);
1332 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1335 tmp=DataArrayDouble::New();
1336 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1337 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1340 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1343 throw INTERP_KERNEL::Exception(msg);
1352 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1355 tmp=DataArrayDouble::New();
1356 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1357 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1360 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1363 throw INTERP_KERNEL::Exception(msg);
1372 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1375 tmp=DataArrayDouble::New();
1376 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1377 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1380 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1383 throw INTERP_KERNEL::Exception(msg);
1392 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1395 tmp=DataArrayDouble::New();
1396 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1397 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1400 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1403 throw INTERP_KERNEL::Exception(msg);
1412 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1415 tmp=DataArrayDouble::New();
1416 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1417 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1420 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1423 throw INTERP_KERNEL::Exception(msg);
1432 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1435 tmp=DataArrayDouble::New();
1436 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1437 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1440 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1443 throw INTERP_KERNEL::Exception(msg);
1452 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1455 tmp=DataArrayDouble::New();
1456 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1457 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1460 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1463 throw INTERP_KERNEL::Exception(msg);
1472 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1475 tmp=DataArrayDouble::New();
1476 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1477 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1480 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1483 throw INTERP_KERNEL::Exception(msg);
1492 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1495 tmp=DataArrayDouble::New();
1496 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1497 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1500 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1503 throw INTERP_KERNEL::Exception(msg);
1512 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1515 tmp=DataArrayDouble::New();
1516 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1517 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1520 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1523 throw INTERP_KERNEL::Exception(msg);
1532 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1535 tmp=DataArrayDouble::New();
1536 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1537 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1540 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1543 throw INTERP_KERNEL::Exception(msg);
1552 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1555 tmp=DataArrayDouble::New();
1556 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1557 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1560 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1563 throw INTERP_KERNEL::Exception(msg);
1568 throw INTERP_KERNEL::Exception(msg);
1573 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1575 return self->negate();
1578 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1580 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1583 DataArrayDoubleTuple *aa;
1584 std::vector<double> bb;
1587 #ifndef WITHOUT_AUTOFIELD
1589 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1591 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1594 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1595 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1597 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1600 throw INTERP_KERNEL::Exception(msg);
1604 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1609 MCAuto<DataArrayDouble> ret=self->deepCopy();
1610 ret->applyLin(1.,val);
1611 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1615 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1619 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1620 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1624 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1625 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1628 throw INTERP_KERNEL::Exception(msg);
1632 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1634 const char msg[]="Unexpected situation in __radd__ !";
1637 DataArrayDoubleTuple *aa;
1638 std::vector<double> bb;
1640 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1645 MCAuto<DataArrayDouble> ret=self->deepCopy();
1646 ret->applyLin(1.,val);
1651 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1652 return DataArrayDouble::Add(self,aaa);
1656 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1657 return DataArrayDouble::Add(self,aaa);
1660 throw INTERP_KERNEL::Exception(msg);
1664 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1666 const char msg[]="Unexpected situation in __iadd__ !";
1669 DataArrayDoubleTuple *aa;
1670 std::vector<double> bb;
1672 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1677 self->applyLin(1.,val);
1678 Py_XINCREF(trueSelf);
1684 Py_XINCREF(trueSelf);
1689 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1690 self->addEqual(aaa);
1691 Py_XINCREF(trueSelf);
1696 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1697 self->addEqual(aaa);
1698 Py_XINCREF(trueSelf);
1702 throw INTERP_KERNEL::Exception(msg);
1706 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1708 const char msg[]="Unexpected situation in __sub__ !";
1711 DataArrayDoubleTuple *aa;
1712 std::vector<double> bb;
1715 #ifndef WITHOUT_AUTOFIELD
1717 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1719 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1722 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1723 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1725 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1728 throw INTERP_KERNEL::Exception(msg);
1732 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1737 MCAuto<DataArrayDouble> ret=self->deepCopy();
1738 ret->applyLin(1.,-val);
1739 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1743 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1747 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1748 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1752 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1756 throw INTERP_KERNEL::Exception(msg);
1760 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1762 const char msg[]="Unexpected situation in __rsub__ !";
1765 DataArrayDoubleTuple *aa;
1766 std::vector<double> bb;
1768 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1773 MCAuto<DataArrayDouble> ret=self->deepCopy();
1774 ret->applyLin(-1.,val);
1779 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1780 return DataArrayDouble::Substract(aaa,self);
1784 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1785 return DataArrayDouble::Substract(aaa,self);
1788 throw INTERP_KERNEL::Exception(msg);
1792 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1794 const char msg[]="Unexpected situation in __isub__ !";
1797 DataArrayDoubleTuple *aa;
1798 std::vector<double> bb;
1800 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1805 self->applyLin(1,-val);
1806 Py_XINCREF(trueSelf);
1811 self->substractEqual(a);
1812 Py_XINCREF(trueSelf);
1817 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1818 self->substractEqual(aaa);
1819 Py_XINCREF(trueSelf);
1824 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1825 self->substractEqual(aaa);
1826 Py_XINCREF(trueSelf);
1830 throw INTERP_KERNEL::Exception(msg);
1834 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1836 const char msg[]="Unexpected situation in __mul__ !";
1839 DataArrayDoubleTuple *aa;
1840 std::vector<double> bb;
1843 #ifndef WITHOUT_AUTOFIELD
1845 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1847 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1850 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1851 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1853 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1856 throw INTERP_KERNEL::Exception(msg);
1860 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1865 MCAuto<DataArrayDouble> ret=self->deepCopy();
1866 ret->applyLin(val,0.);
1867 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1871 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1875 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1876 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1880 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1881 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1884 throw INTERP_KERNEL::Exception(msg);
1888 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1890 const char msg[]="Unexpected situation in __rmul__ !";
1893 DataArrayDoubleTuple *aa;
1894 std::vector<double> bb;
1896 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1901 MCAuto<DataArrayDouble> ret=self->deepCopy();
1902 ret->applyLin(val,0.);
1907 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1908 return DataArrayDouble::Multiply(self,aaa);
1912 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1913 return DataArrayDouble::Multiply(self,aaa);
1916 throw INTERP_KERNEL::Exception(msg);
1920 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1922 const char msg[]="Unexpected situation in __imul__ !";
1925 DataArrayDoubleTuple *aa;
1926 std::vector<double> bb;
1928 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1933 self->applyLin(val,0.);
1934 Py_XINCREF(trueSelf);
1939 self->multiplyEqual(a);
1940 Py_XINCREF(trueSelf);
1945 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1946 self->multiplyEqual(aaa);
1947 Py_XINCREF(trueSelf);
1952 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1953 self->multiplyEqual(aaa);
1954 Py_XINCREF(trueSelf);
1958 throw INTERP_KERNEL::Exception(msg);
1962 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1964 const char msg[]="Unexpected situation in __div__ !";
1967 DataArrayDoubleTuple *aa;
1968 std::vector<double> bb;
1971 #ifndef WITHOUT_AUTOFIELD
1973 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1975 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1978 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1979 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1981 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1984 throw INTERP_KERNEL::Exception(msg);
1988 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1994 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1995 MCAuto<DataArrayDouble> ret=self->deepCopy();
1996 ret->applyLin(1/val,0.);
1997 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2001 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2005 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2006 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2010 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2011 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2014 throw INTERP_KERNEL::Exception(msg);
2018 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2020 const char msg[]="Unexpected situation in __rdiv__ !";
2023 DataArrayDoubleTuple *aa;
2024 std::vector<double> bb;
2026 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2031 MCAuto<DataArrayDouble> ret=self->deepCopy();
2037 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2038 return DataArrayDouble::Divide(aaa,self);
2042 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2043 return DataArrayDouble::Divide(aaa,self);
2046 throw INTERP_KERNEL::Exception(msg);
2050 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2052 const char msg[]="Unexpected situation in __idiv__ !";
2055 DataArrayDoubleTuple *aa;
2056 std::vector<double> bb;
2058 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2064 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2065 self->applyLin(1./val,0.);
2066 Py_XINCREF(trueSelf);
2071 self->divideEqual(a);
2072 Py_XINCREF(trueSelf);
2077 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2078 self->divideEqual(aaa);
2079 Py_XINCREF(trueSelf);
2084 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2085 self->divideEqual(aaa);
2086 Py_XINCREF(trueSelf);
2090 throw INTERP_KERNEL::Exception(msg);
2094 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2096 const char msg[]="Unexpected situation in __pow__ !";
2099 DataArrayDoubleTuple *aa;
2100 std::vector<double> bb;
2102 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2107 MCAuto<DataArrayDouble> ret=self->deepCopy();
2113 return DataArrayDouble::Pow(self,a);
2117 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2118 return DataArrayDouble::Pow(self,aaa);
2122 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2123 return DataArrayDouble::Pow(self,aaa);
2126 throw INTERP_KERNEL::Exception(msg);
2130 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2132 const char msg[]="Unexpected situation in __rpow__ !";
2135 DataArrayDoubleTuple *aa;
2136 std::vector<double> bb;
2138 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2143 MCAuto<DataArrayDouble> ret=self->deepCopy();
2144 ret->applyRPow(val);
2149 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2150 return DataArrayDouble::Pow(aaa,self);
2154 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2155 return DataArrayDouble::Pow(aaa,self);
2158 throw INTERP_KERNEL::Exception(msg);
2162 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2164 const char msg[]="Unexpected situation in __ipow__ !";
2167 DataArrayDoubleTuple *aa;
2168 std::vector<double> bb;
2170 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2175 self->applyPow(val);
2176 Py_XINCREF(trueSelf);
2182 Py_XINCREF(trueSelf);
2187 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2188 self->powEqual(aaa);
2189 Py_XINCREF(trueSelf);
2194 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2195 self->powEqual(aaa);
2196 Py_XINCREF(trueSelf);
2200 throw INTERP_KERNEL::Exception(msg);
2204 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2206 DataArrayInt *c=0,*cI=0;
2208 self->computeTupleIdsNearTuples(other,eps,c,cI);
2209 PyObject *ret=PyTuple_New(2);
2210 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2211 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2215 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2217 DataArrayInt *ret1=0;
2218 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2219 PyObject *ret=PyTuple_New(2);
2220 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2221 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2226 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2228 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2229 if(!PyTuple_Check(args))
2230 throw INTERP_KERNEL::Exception(MSG);
2231 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2232 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2233 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2235 PyObject *tmp0(PyTuple_New(1));
2236 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2237 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2239 Py_DECREF(selfMeth);
2240 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2241 int sz(PyTuple_Size(args));
2243 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2244 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2245 PyObject *zeNumpyRepr(0);
2246 PyObject *tmp1(PyInt_FromLong(0));
2247 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2249 PyObject *tmp3(PyTuple_New(1));
2250 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2251 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2255 Py_DECREF(initMeth);
2259 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2262 if(!self->isAllocated())
2263 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2264 PyObject *ret(PyTuple_New(1));
2265 PyObject *ret0(PyDict_New());
2266 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2267 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2268 PyObject *tmp1(PyInt_FromLong(0));
2269 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2270 PyTuple_SetItem(ret,0,ret0);
2274 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2280 class DataArrayDoubleTuple;
2282 class DataArrayDoubleIterator
2285 DataArrayDoubleIterator(DataArrayDouble *da);
2286 ~DataArrayDoubleIterator();
2291 DataArrayDoubleTuple *ret=self->nextt();
2293 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2296 PyErr_SetString(PyExc_StopIteration,"No more data.");
2303 class DataArrayDoubleTuple
2306 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2307 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2310 std::string __str__() const throw(INTERP_KERNEL::Exception)
2312 return self->repr();
2315 double __float__() const throw(INTERP_KERNEL::Exception)
2317 return self->doubleValue();
2320 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2322 return self->buildDADouble(1,self->getNumberOfCompo());
2325 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2327 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2328 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2329 Py_XINCREF(trueSelf);
2333 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2335 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2336 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2337 Py_XINCREF(trueSelf);
2341 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2343 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2344 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2345 Py_XINCREF(trueSelf);
2349 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2351 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2352 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2353 Py_XINCREF(trueSelf);
2357 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2359 return PyInt_FromLong(self->getNumberOfCompo());
2362 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2364 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2367 std::vector<int> multiVal;
2368 std::pair<int, std::pair<int,int> > slic;
2369 MEDCoupling::DataArrayInt *daIntTyypp=0;
2370 const double *pt=self->getConstPointer();
2371 int nbc=self->getNumberOfCompo();
2372 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2379 std::ostringstream oss;
2380 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2381 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2385 return PyFloat_FromDouble(pt[singleVal]);
2389 return PyFloat_FromDouble(pt[nbc+singleVal]);
2392 std::ostringstream oss;
2393 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2394 throw INTERP_KERNEL::Exception(oss.str().c_str());
2400 PyObject *t=PyTuple_New(multiVal.size());
2401 for(int j=0;j<(int)multiVal.size();j++)
2403 int cid=multiVal[j];
2406 std::ostringstream oss;
2407 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2408 throw INTERP_KERNEL::Exception(oss.str().c_str());
2410 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2416 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2417 PyObject *t=PyTuple_New(sz);
2418 for(int j=0;j<sz;j++)
2419 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2423 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2427 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2429 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2430 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2433 std::vector<double> multiValV;
2434 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2435 int nbc=self->getNumberOfCompo();
2436 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2438 std::vector<int> multiVal;
2439 std::pair<int, std::pair<int,int> > slic;
2440 MEDCoupling::DataArrayInt *daIntTyypp=0;
2441 double *pt=self->getPointer();
2442 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2449 std::ostringstream oss;
2450 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2451 throw INTERP_KERNEL::Exception(oss.str().c_str());
2457 pt[singleVal]=singleValV;
2462 if(multiValV.size()!=1)
2464 std::ostringstream oss;
2465 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2466 throw INTERP_KERNEL::Exception(oss.str().c_str());
2468 pt[singleVal]=multiValV[0];
2473 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2477 throw INTERP_KERNEL::Exception(msg);
2486 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2490 std::ostringstream oss;
2491 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2492 throw INTERP_KERNEL::Exception(oss.str().c_str());
2500 if(multiVal.size()!=multiValV.size())
2502 std::ostringstream oss;
2503 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2504 throw INTERP_KERNEL::Exception(oss.str().c_str());
2506 for(int i=0;i<(int)multiVal.size();i++)
2508 int pos=multiVal[i];
2511 std::ostringstream oss;
2512 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2513 throw INTERP_KERNEL::Exception(oss.str().c_str());
2515 pt[multiVal[i]]=multiValV[i];
2521 const double *ptV=daIntTyyppV->getConstPointer();
2522 if(nbc>daIntTyyppV->getNumberOfCompo())
2524 std::ostringstream oss;
2525 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2526 throw INTERP_KERNEL::Exception(oss.str().c_str());
2528 std::copy(ptV,ptV+nbc,pt);
2532 throw INTERP_KERNEL::Exception(msg);
2537 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2542 for(int j=0;j<sz;j++)
2543 pt[slic.first+j*slic.second.second]=singleValV;
2548 if(sz!=(int)multiValV.size())
2550 std::ostringstream oss;
2551 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2552 throw INTERP_KERNEL::Exception(oss.str().c_str());
2554 for(int j=0;j<sz;j++)
2555 pt[slic.first+j*slic.second.second]=multiValV[j];
2560 const double *ptV=daIntTyyppV->getConstPointer();
2561 if(sz>daIntTyyppV->getNumberOfCompo())
2563 std::ostringstream oss;
2564 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2565 throw INTERP_KERNEL::Exception(oss.str().c_str());
2567 for(int j=0;j<sz;j++)
2568 pt[slic.first+j*slic.second.second]=ptV[j];
2572 throw INTERP_KERNEL::Exception(msg);
2576 throw INTERP_KERNEL::Exception(msg);
2582 class DataArrayIntIterator;
2584 class DataArrayInt : public DataArray
2587 static DataArrayInt *New();
2588 int intValue() const throw(INTERP_KERNEL::Exception);
2589 int getHashCode() const throw(INTERP_KERNEL::Exception);
2590 bool empty() const throw(INTERP_KERNEL::Exception);
2591 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2592 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2593 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2594 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2595 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2596 int popBackSilent() throw(INTERP_KERNEL::Exception);
2597 void pack() const throw(INTERP_KERNEL::Exception);
2598 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2599 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2600 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2601 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2602 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2603 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2604 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2605 void reverse() throw(INTERP_KERNEL::Exception);
2606 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2607 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2608 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2609 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2610 void fillWithZero() throw(INTERP_KERNEL::Exception);
2611 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2612 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2613 std::string repr() const throw(INTERP_KERNEL::Exception);
2614 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2615 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2616 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2617 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2618 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2619 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2620 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2621 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2622 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2623 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2624 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2625 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2626 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2627 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2628 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2629 void transpose() throw(INTERP_KERNEL::Exception);
2630 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2631 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2632 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2633 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2634 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2635 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2636 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2637 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2638 int front() const throw(INTERP_KERNEL::Exception);
2639 int back() const throw(INTERP_KERNEL::Exception);
2640 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2641 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2642 int *getPointer() throw(INTERP_KERNEL::Exception);
2643 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2644 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2645 const int *begin() const throw(INTERP_KERNEL::Exception);
2646 const int *end() const throw(INTERP_KERNEL::Exception);
2647 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2648 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2649 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2650 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2651 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2652 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2653 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2654 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2655 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2656 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2657 int count(int value) const throw(INTERP_KERNEL::Exception);
2658 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2659 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2660 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2661 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2662 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2663 void abs() throw(INTERP_KERNEL::Exception);
2664 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2665 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2666 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2667 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2668 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2669 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2670 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2671 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2672 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2673 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2675 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2677 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2678 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2679 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2680 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2681 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2682 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2683 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2684 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2685 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2686 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2688 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2689 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2690 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2691 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2692 void computeOffsets() throw(INTERP_KERNEL::Exception);
2693 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2694 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2695 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2696 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2697 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2698 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2699 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2700 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2701 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2702 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2703 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2704 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2705 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2706 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2707 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2708 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2709 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2710 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2711 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2713 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2716 DataArrayInt() throw(INTERP_KERNEL::Exception)
2718 return DataArrayInt::New();
2721 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2723 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)";
2724 std::string msg(msgBase);
2726 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2729 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2733 if(PyInt_Check(nbOfTuples))
2735 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2737 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2740 if(PyInt_Check(nbOfComp))
2741 {//DataArrayInt.New([1,3,4,5],2,2)
2742 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2744 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2745 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2746 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2747 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2751 throw INTERP_KERNEL::Exception(msg.c_str());
2754 {//DataArrayInt.New([1,3,4],3)
2755 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2757 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2758 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2763 throw INTERP_KERNEL::Exception(msg.c_str());
2766 {// DataArrayInt.New([1,3,4])
2767 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2768 int tmpp1=-1,tmpp2=-1;
2769 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2770 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2774 else if(PyInt_Check(elt0))
2776 int nbOfTuples1=PyInt_AS_LONG(elt0);
2778 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2783 if(PyInt_Check(nbOfTuples))
2784 {//DataArrayInt.New(5,2)
2785 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2787 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2788 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2789 ret->alloc(nbOfTuples1,nbOfCompo);
2793 throw INTERP_KERNEL::Exception(msg.c_str());
2796 throw INTERP_KERNEL::Exception(msg.c_str());
2799 {//DataArrayInt.New(5)
2800 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2801 ret->alloc(nbOfTuples1,1);
2806 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2807 {//DataArrayInt.New(numpyArray)
2808 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2812 throw INTERP_KERNEL::Exception(msg.c_str());
2813 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2816 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2818 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2821 std::string __str__() const throw(INTERP_KERNEL::Exception)
2823 return self->reprNotTooLong();
2826 int __len__() const throw(INTERP_KERNEL::Exception)
2828 if(self->isAllocated())
2830 return self->getNumberOfTuples();
2834 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2838 int __int__() const throw(INTERP_KERNEL::Exception)
2840 return self->intValue();
2843 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2845 return self->iterator();
2848 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2850 int sz=self->getNumberOfComponents();
2851 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2852 self->accumulate(tmp);
2853 return convertIntArrToPyList(tmp,sz);
2856 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2859 std::vector<int> val2;
2860 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2861 return self->accumulatePerChunck(bg,bg+sz);
2864 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2867 std::vector<int> val2;
2868 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2869 return self->findIdsEqualTuple(bg,bg+sz);
2872 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2874 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2875 PyObject *ret=PyList_New(slcs.size());
2876 for(std::size_t i=0;i<slcs.size();i++)
2877 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2881 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2883 if(!PySlice_Check(slic))
2884 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2885 Py_ssize_t strt=2,stp=2,step=2;
2886 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2887 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2888 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2889 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 !");
2890 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2893 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2896 self->getMinMaxValues(a,b);
2897 PyObject *ret=PyTuple_New(2);
2898 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2899 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2903 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2905 int newNbOfTuples=-1;
2906 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2907 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2908 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2909 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2910 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2911 PyObject *ret=PyTuple_New(2);
2912 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2913 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2917 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2919 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2920 int szArr,sw,iTypppArr;
2921 std::vector<int> stdvecTyyppArr;
2922 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2923 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2924 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2928 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2930 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 !";
2931 if(PyList_Check(li) || PyTuple_Check(li))
2935 if(PyInt_Check(nbOfTuples))
2937 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2939 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2942 if(PyInt_Check(nbOfComp))
2943 {//DataArrayInt.setValues([1,3,4,5],2,2)
2944 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2946 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2947 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2948 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2951 throw INTERP_KERNEL::Exception(msg);
2954 {//DataArrayInt.setValues([1,3,4],3)
2956 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2957 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2961 throw INTERP_KERNEL::Exception(msg);
2964 {// DataArrayInt.setValues([1,3,4])
2965 int tmpp1=-1,tmpp2=-1;
2966 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2967 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2971 throw INTERP_KERNEL::Exception(msg);
2974 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2976 const int *vals=self->getConstPointer();
2977 return convertIntArrToPyList(vals,self->getNbOfElems());
2981 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2983 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2987 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2990 bool ret0=self->isEqualIfNotWhy(other,ret1);
2991 PyObject *ret=PyTuple_New(2);
2992 PyObject *ret0Py=ret0?Py_True:Py_False;
2994 PyTuple_SetItem(ret,0,ret0Py);
2995 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2999 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3001 const int *vals=self->getConstPointer();
3002 int nbOfComp=self->getNumberOfComponents();
3003 int nbOfTuples=self->getNumberOfTuples();
3004 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3007 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3009 std::vector<const DataArrayInt *> groups;
3010 std::vector< std::vector<int> > fidsOfGroups;
3011 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3012 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3013 PyObject *ret = PyList_New(2);
3014 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3015 int sz=fidsOfGroups.size();
3016 PyObject *ret1 = PyList_New(sz);
3017 for(int i=0;i<sz;i++)
3018 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3019 PyList_SetItem(ret,1,ret1);
3023 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3026 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3027 if (!SWIG_IsOK(res1))
3030 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3031 self->transformWithIndArr(tmp,tmp+size);
3035 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3036 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3040 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3044 std::vector<int> multiVal;
3045 std::pair<int, std::pair<int,int> > slic;
3046 MEDCoupling::DataArrayInt *daIntTyypp=0;
3047 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3051 return self->findIdsEqualList(&singleVal,&singleVal+1);
3053 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3055 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3057 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3061 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3065 std::vector<int> multiVal;
3066 std::pair<int, std::pair<int,int> > slic;
3067 MEDCoupling::DataArrayInt *daIntTyypp=0;
3068 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3072 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3074 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3076 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3078 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3082 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3084 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3086 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3087 if (!SWIG_IsOK(res1))
3090 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3091 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3095 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3097 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3098 da2->checkAllocated();
3099 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3101 PyObject *ret = PyList_New(3);
3102 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3103 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3104 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3108 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3111 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3112 if (!SWIG_IsOK(res1))
3115 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3116 return self->transformWithIndArrR(tmp,tmp+size);
3120 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3121 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3125 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3128 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3129 if (!SWIG_IsOK(res1))
3132 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3133 if(size!=self->getNumberOfTuples())
3135 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3137 return self->renumberAndReduce(tmp,newNbOfTuple);
3141 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3143 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3144 da2->checkAllocated();
3145 int size=self->getNumberOfTuples();
3146 if(size!=self->getNumberOfTuples())
3148 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3150 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3154 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3157 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3158 if (!SWIG_IsOK(res1))
3161 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3162 if(size!=self->getNumberOfTuples())
3164 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3166 return self->renumber(tmp);
3170 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3172 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3173 da2->checkAllocated();
3174 int size=self->getNumberOfTuples();
3175 if(size!=self->getNumberOfTuples())
3177 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3179 return self->renumber(da2->getConstPointer());
3183 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3186 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3187 if (!SWIG_IsOK(res1))
3190 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3191 if(size!=self->getNumberOfTuples())
3193 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3195 return self->renumberR(tmp);
3199 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3201 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3202 da2->checkAllocated();
3203 int size=self->getNumberOfTuples();
3204 if(size!=self->getNumberOfTuples())
3206 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3208 return self->renumberR(da2->getConstPointer());
3212 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3214 std::vector<int> tmp;
3215 convertPyToNewIntArr3(li,tmp);
3216 self->setSelectedComponents(a,tmp);
3219 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3221 int sz=self->getNumberOfComponents();
3222 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3223 self->getTuple(tupleId,tmp);
3224 return convertIntArrToPyList(tmp,sz);
3227 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3229 DataArrayInt *arr=0;
3230 DataArrayInt *arrI=0;
3231 self->changeSurjectiveFormat(targetNb,arr,arrI);
3232 PyObject *res = PyList_New(2);
3233 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3234 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3238 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3240 std::vector<const DataArrayInt *> tmp;
3241 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3242 return DataArrayInt::Meld(tmp);
3245 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3247 std::vector<const DataArrayInt *> tmp;
3248 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3249 return DataArrayInt::Aggregate(tmp);
3252 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3254 std::vector<const DataArrayInt *> tmp;
3255 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3256 return DataArrayInt::AggregateIndexes(tmp);
3259 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3261 std::vector<const DataArrayInt *> tmp;
3262 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3263 return DataArrayInt::BuildUnion(tmp);
3266 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3268 std::vector<const DataArrayInt *> tmp;
3269 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3270 return DataArrayInt::BuildIntersection(tmp);
3273 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3276 int r1=self->getMaxValue(tmp);
3277 PyObject *ret=PyTuple_New(2);
3278 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3279 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3283 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3286 int r1=self->getMinValue(tmp);
3287 PyObject *ret=PyTuple_New(2);
3288 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3289 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3293 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3295 int nbOfCompo=self->getNumberOfComponents();
3300 if(PyInt_Check(obj))
3302 int val=(int)PyInt_AS_LONG(obj);
3303 return self->findIdFirstEqual(val);
3306 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3310 std::vector<int> arr;
3311 convertPyToNewIntArr3(obj,arr);
3312 return self->findIdFirstEqualTuple(arr);
3317 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3319 int nbOfCompo=self->getNumberOfComponents();
3326 if(PyInt_Check(obj))
3328 int val=(int)PyInt_AS_LONG(obj);
3329 return self->presenceOfValue(val);
3332 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3336 std::vector<int> arr;
3337 convertPyToNewIntArr3(obj,arr);
3338 return self->presenceOfTuple(arr);
3343 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3345 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3346 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3347 self->checkAllocated();
3348 int nbOfTuples=self->getNumberOfTuples();
3349 int nbOfComponents=self->getNumberOfComponents();
3351 std::vector<int> vt1,vc1;
3352 std::pair<int, std::pair<int,int> > pt1,pc1;
3353 DataArrayInt *dt1=0,*dc1=0;
3355 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3356 MCAuto<DataArrayInt> ret;
3361 if(nbOfComponents==1)
3362 return PyInt_FromLong(self->getIJSafe(it1,0));
3363 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3366 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3368 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3370 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3372 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3375 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3376 std::vector<int> v2(1,ic1);
3377 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3381 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3382 std::vector<int> v2(1,ic1);
3383 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3387 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3388 std::vector<int> v2(1,ic1);
3389 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3393 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3394 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3398 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3399 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3403 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3404 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3408 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3409 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3413 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3414 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3415 std::vector<int> v2(nbOfComp);
3416 for(int i=0;i<nbOfComp;i++)
3417 v2[i]=pc1.first+i*pc1.second.second;
3418 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3422 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3423 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3424 std::vector<int> v2(nbOfComp);
3425 for(int i=0;i<nbOfComp;i++)
3426 v2[i]=pc1.first+i*pc1.second.second;
3427 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3431 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3432 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3433 std::vector<int> v2(nbOfComp);
3434 for(int i=0;i<nbOfComp;i++)
3435 v2[i]=pc1.first+i*pc1.second.second;
3436 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3440 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3441 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3442 std::vector<int> v2(nbOfComp);
3443 for(int i=0;i<nbOfComp;i++)
3444 v2[i]=pc1.first+i*pc1.second.second;
3445 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3448 throw INTERP_KERNEL::Exception(msg);
3452 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3454 self->checkAllocated();
3455 const char msg[]="Unexpected situation in __setitem__ !";
3456 int nbOfTuples=self->getNumberOfTuples();
3457 int nbOfComponents=self->getNumberOfComponents();
3460 std::vector<int> v1;
3462 DataArrayIntTuple *dd1=0;
3463 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3465 std::vector<int> vt1,vc1;
3466 std::pair<int, std::pair<int,int> > pt1,pc1;
3467 DataArrayInt *dt1=0,*dc1=0;
3468 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3469 MCAuto<DataArrayInt> tmp;
3477 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3480 tmp=DataArrayInt::New();
3481 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3482 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3485 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3488 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3489 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3492 throw INTERP_KERNEL::Exception(msg);
3501 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3504 tmp=DataArrayInt::New();
3505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3506 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3509 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3512 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3513 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3516 throw INTERP_KERNEL::Exception(msg);
3525 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3528 tmp=DataArrayInt::New();
3529 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3530 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3533 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3536 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3537 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3552 tmp=DataArrayInt::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3557 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3560 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3561 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3564 throw INTERP_KERNEL::Exception(msg);
3573 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3576 tmp=DataArrayInt::New();
3577 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3578 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3581 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3584 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3585 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3588 throw INTERP_KERNEL::Exception(msg);
3597 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3600 tmp=DataArrayInt::New();
3601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3602 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3605 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3608 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3609 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3612 throw INTERP_KERNEL::Exception(msg);
3621 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3624 tmp=DataArrayInt::New();
3625 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3626 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3629 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3632 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3633 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3636 throw INTERP_KERNEL::Exception(msg);
3645 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3648 tmp=DataArrayInt::New();
3649 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3650 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3653 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3656 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3657 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3660 throw INTERP_KERNEL::Exception(msg);
3669 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3672 tmp=DataArrayInt::New();
3673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3674 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3677 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3680 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3681 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3684 throw INTERP_KERNEL::Exception(msg);
3693 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3696 tmp=DataArrayInt::New();
3697 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3698 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3701 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3704 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3705 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3708 throw INTERP_KERNEL::Exception(msg);
3717 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3720 tmp=DataArrayInt::New();
3721 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3722 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3725 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3728 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3729 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3732 throw INTERP_KERNEL::Exception(msg);
3741 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3744 tmp=DataArrayInt::New();
3745 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3746 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3749 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3752 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3753 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3756 throw INTERP_KERNEL::Exception(msg);
3765 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3768 tmp=DataArrayInt::New();
3769 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3770 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3773 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3776 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3777 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3780 throw INTERP_KERNEL::Exception(msg);
3789 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3792 tmp=DataArrayInt::New();
3793 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3794 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3797 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3800 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3801 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3804 throw INTERP_KERNEL::Exception(msg);
3813 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3816 tmp=DataArrayInt::New();
3817 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3818 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3821 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3824 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3825 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3828 throw INTERP_KERNEL::Exception(msg);
3837 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3840 tmp=DataArrayInt::New();
3841 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3842 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3845 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3848 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3849 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3852 throw INTERP_KERNEL::Exception(msg);
3857 throw INTERP_KERNEL::Exception(msg);
3862 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3864 return self->negate();
3867 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3869 const char msg[]="Unexpected situation in __add__ !";
3872 std::vector<int> aa;
3873 DataArrayIntTuple *aaa;
3875 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3880 MCAuto<DataArrayInt> ret=self->deepCopy();
3881 ret->applyLin(1,val);
3886 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3887 return DataArrayInt::Add(self,aaaa);
3891 return DataArrayInt::Add(self,a);
3895 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3896 return DataArrayInt::Add(self,aaaa);
3899 throw INTERP_KERNEL::Exception(msg);
3903 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3905 const char msg[]="Unexpected situation in __radd__ !";
3908 std::vector<int> aa;
3909 DataArrayIntTuple *aaa;
3911 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3916 MCAuto<DataArrayInt> ret=self->deepCopy();
3917 ret->applyLin(1,val);
3922 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3923 return DataArrayInt::Add(self,aaaa);
3927 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3928 return DataArrayInt::Add(self,aaaa);
3931 throw INTERP_KERNEL::Exception(msg);
3935 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3937 const char msg[]="Unexpected situation in __iadd__ !";
3940 std::vector<int> aa;
3941 DataArrayIntTuple *aaa;
3943 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3948 self->applyLin(1,val);
3949 Py_XINCREF(trueSelf);
3954 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3956 Py_XINCREF(trueSelf);
3962 Py_XINCREF(trueSelf);
3967 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3968 self->addEqual(aaaa);
3969 Py_XINCREF(trueSelf);
3973 throw INTERP_KERNEL::Exception(msg);
3977 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3979 const char msg[]="Unexpected situation in __sub__ !";
3982 std::vector<int> aa;
3983 DataArrayIntTuple *aaa;
3985 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3990 MCAuto<DataArrayInt> ret=self->deepCopy();
3991 ret->applyLin(1,-val);
3996 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3997 return DataArrayInt::Substract(self,aaaa);
4001 return DataArrayInt::Substract(self,a);
4005 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4006 return DataArrayInt::Substract(self,aaaa);
4009 throw INTERP_KERNEL::Exception(msg);
4013 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4015 const char msg[]="Unexpected situation in __rsub__ !";
4018 std::vector<int> aa;
4019 DataArrayIntTuple *aaa;
4021 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4026 MCAuto<DataArrayInt> ret=self->deepCopy();
4027 ret->applyLin(-1,val);
4032 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4033 return DataArrayInt::Substract(aaaa,self);
4037 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4038 return DataArrayInt::Substract(aaaa,self);
4041 throw INTERP_KERNEL::Exception(msg);
4045 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4047 const char msg[]="Unexpected situation in __isub__ !";
4050 std::vector<int> aa;
4051 DataArrayIntTuple *aaa;
4053 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4058 self->applyLin(1,-val);
4059 Py_XINCREF(trueSelf);
4064 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4065 self->substractEqual(bb);
4066 Py_XINCREF(trueSelf);
4071 self->substractEqual(a);
4072 Py_XINCREF(trueSelf);
4077 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4078 self->substractEqual(aaaa);
4079 Py_XINCREF(trueSelf);
4083 throw INTERP_KERNEL::Exception(msg);
4087 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4089 const char msg[]="Unexpected situation in __mul__ !";
4092 std::vector<int> aa;
4093 DataArrayIntTuple *aaa;
4095 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4100 MCAuto<DataArrayInt> ret=self->deepCopy();
4101 ret->applyLin(val,0);
4106 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4107 return DataArrayInt::Multiply(self,aaaa);
4111 return DataArrayInt::Multiply(self,a);
4115 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4116 return DataArrayInt::Multiply(self,aaaa);
4119 throw INTERP_KERNEL::Exception(msg);
4123 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4125 const char msg[]="Unexpected situation in __rmul__ !";
4128 std::vector<int> aa;
4129 DataArrayIntTuple *aaa;
4131 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4136 MCAuto<DataArrayInt> ret=self->deepCopy();
4137 ret->applyLin(val,0);
4142 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4143 return DataArrayInt::Multiply(self,aaaa);
4147 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4148 return DataArrayInt::Multiply(self,aaaa);
4151 throw INTERP_KERNEL::Exception(msg);
4155 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4157 const char msg[]="Unexpected situation in __imul__ !";
4160 std::vector<int> aa;
4161 DataArrayIntTuple *aaa;
4163 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4168 self->applyLin(val,0);
4169 Py_XINCREF(trueSelf);
4174 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4175 self->multiplyEqual(bb);
4176 Py_XINCREF(trueSelf);
4181 self->multiplyEqual(a);
4182 Py_XINCREF(trueSelf);
4187 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4188 self->multiplyEqual(aaaa);
4189 Py_XINCREF(trueSelf);
4193 throw INTERP_KERNEL::Exception(msg);
4197 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4199 const char msg[]="Unexpected situation in __div__ !";
4202 std::vector<int> aa;
4203 DataArrayIntTuple *aaa;
4205 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4210 MCAuto<DataArrayInt> ret=self->deepCopy();
4211 ret->applyDivideBy(val);
4216 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4217 return DataArrayInt::Divide(self,aaaa);
4221 return DataArrayInt::Divide(self,a);
4225 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4226 return DataArrayInt::Divide(self,aaaa);
4229 throw INTERP_KERNEL::Exception(msg);
4233 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4235 const char msg[]="Unexpected situation in __rdiv__ !";
4238 std::vector<int> aa;
4239 DataArrayIntTuple *aaa;
4241 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4246 MCAuto<DataArrayInt> ret=self->deepCopy();
4252 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4253 return DataArrayInt::Divide(aaaa,self);
4257 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4258 return DataArrayInt::Divide(aaaa,self);
4261 throw INTERP_KERNEL::Exception(msg);
4265 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4267 const char msg[]="Unexpected situation in __idiv__ !";
4270 std::vector<int> aa;
4271 DataArrayIntTuple *aaa;
4273 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4278 self->applyDivideBy(val);
4279 Py_XINCREF(trueSelf);
4284 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4285 self->divideEqual(bb);
4286 Py_XINCREF(trueSelf);
4291 self->divideEqual(a);
4292 Py_XINCREF(trueSelf);
4297 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4298 self->divideEqual(aaaa);
4299 Py_XINCREF(trueSelf);
4303 throw INTERP_KERNEL::Exception(msg);
4307 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4309 const char msg[]="Unexpected situation in __mod__ !";
4312 std::vector<int> aa;
4313 DataArrayIntTuple *aaa;
4315 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4320 MCAuto<DataArrayInt> ret=self->deepCopy();
4321 ret->applyModulus(val);
4326 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4327 return DataArrayInt::Modulus(self,aaaa);
4331 return DataArrayInt::Modulus(self,a);
4335 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4336 return DataArrayInt::Modulus(self,aaaa);
4339 throw INTERP_KERNEL::Exception(msg);
4343 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4345 const char msg[]="Unexpected situation in __rmod__ !";
4348 std::vector<int> aa;
4349 DataArrayIntTuple *aaa;
4351 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4356 MCAuto<DataArrayInt> ret=self->deepCopy();
4357 ret->applyRModulus(val);
4362 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4363 return DataArrayInt::Modulus(aaaa,self);
4367 return DataArrayInt::Modulus(a,self);
4371 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4372 return DataArrayInt::Modulus(aaaa,self);
4375 throw INTERP_KERNEL::Exception(msg);
4379 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4381 const char msg[]="Unexpected situation in __imod__ !";
4384 std::vector<int> aa;
4385 DataArrayIntTuple *aaa;
4387 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4392 self->applyModulus(val);
4393 Py_XINCREF(trueSelf);
4398 self->modulusEqual(a);
4399 Py_XINCREF(trueSelf);
4404 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4405 self->modulusEqual(aaaa);
4406 Py_XINCREF(trueSelf);
4410 throw INTERP_KERNEL::Exception(msg);
4414 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4416 const char msg[]="Unexpected situation in __pow__ !";
4419 std::vector<int> aa;
4420 DataArrayIntTuple *aaa;
4422 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4427 MCAuto<DataArrayInt> ret=self->deepCopy();
4433 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4434 return DataArrayInt::Pow(self,aaaa);
4438 return DataArrayInt::Pow(self,a);
4442 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4443 return DataArrayInt::Pow(self,aaaa);
4446 throw INTERP_KERNEL::Exception(msg);
4450 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4452 const char msg[]="Unexpected situation in __rpow__ !";
4455 std::vector<int> aa;
4456 DataArrayIntTuple *aaa;
4458 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4463 MCAuto<DataArrayInt> ret=self->deepCopy();
4464 ret->applyRPow(val);
4469 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4470 return DataArrayInt::Pow(aaaa,self);
4474 return DataArrayInt::Pow(a,self);
4478 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4479 return DataArrayInt::Pow(aaaa,self);
4482 throw INTERP_KERNEL::Exception(msg);
4486 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4488 const char msg[]="Unexpected situation in __ipow__ !";
4491 std::vector<int> aa;
4492 DataArrayIntTuple *aaa;
4494 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4499 self->applyPow(val);
4500 Py_XINCREF(trueSelf);
4506 Py_XINCREF(trueSelf);
4511 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4512 self->powEqual(aaaa);
4513 Py_XINCREF(trueSelf);
4517 throw INTERP_KERNEL::Exception(msg);
4521 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4523 std::ostringstream oss;
4524 self->reprQuickOverview(oss);
4528 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4530 int szArr,sw,iTypppArr;
4531 std::vector<int> stdvecTyyppArr;
4532 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4533 self->pushBackValsSilent(tmp,tmp+szArr);
4536 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4538 std::vector<int> ret1;
4539 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4540 std::size_t sz=ret0.size();
4541 PyObject *pyRet=PyTuple_New(2);
4542 PyObject *pyRet0=PyList_New((int)sz);
4543 PyObject *pyRet1=PyList_New((int)sz);
4544 for(std::size_t i=0;i<sz;i++)
4546 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4547 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4549 PyTuple_SetItem(pyRet,0,pyRet0);
4550 PyTuple_SetItem(pyRet,1,pyRet1);
4554 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4556 DataArrayInt *ret0=0,*ret1=0;
4557 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4558 PyObject *pyRet=PyTuple_New(2);
4559 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4560 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4564 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4567 bool ret(self->isRange(a,b,c));
4568 PyObject *pyRet=PyTuple_New(2);
4569 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4571 PyTuple_SetItem(pyRet,0,ret0Py);
4573 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4579 PyTuple_SetItem(pyRet,1,ret1Py);
4584 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4586 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4587 if(!PyTuple_Check(args))
4588 throw INTERP_KERNEL::Exception(MSG);
4589 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4590 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4591 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4593 PyObject *tmp0(PyTuple_New(1));
4594 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4595 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4597 Py_DECREF(selfMeth);
4598 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4599 int sz(PyTuple_Size(args));
4601 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4602 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4603 PyObject *zeNumpyRepr(0);
4604 PyObject *tmp1(PyInt_FromLong(0));
4605 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4607 PyObject *tmp3(PyTuple_New(1));
4608 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4609 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4613 Py_DECREF(initMeth);
4617 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4620 if(!self->isAllocated())
4621 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4622 PyObject *ret(PyTuple_New(1));
4623 PyObject *ret0(PyDict_New());
4624 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4625 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4626 PyObject *tmp1(PyInt_FromLong(0));
4627 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4628 PyTuple_SetItem(ret,0,ret0);
4632 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4638 class DataArrayIntTuple;
4640 class DataArrayIntIterator
4643 DataArrayIntIterator(DataArrayInt *da);
4644 ~DataArrayIntIterator();
4649 DataArrayIntTuple *ret=self->nextt();
4651 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4654 PyErr_SetString(PyExc_StopIteration,"No more data.");
4661 class DataArrayIntTuple
4664 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4665 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4668 std::string __str__() const throw(INTERP_KERNEL::Exception)
4670 return self->repr();
4673 int __int__() const throw(INTERP_KERNEL::Exception)
4675 return self->intValue();
4678 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4680 return self->buildDAInt(1,self->getNumberOfCompo());
4683 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4685 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4686 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4687 Py_XINCREF(trueSelf);
4691 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4693 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4694 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4695 Py_XINCREF(trueSelf);
4699 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4701 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4702 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4703 Py_XINCREF(trueSelf);
4707 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4709 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4710 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4711 Py_XINCREF(trueSelf);
4715 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4717 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4718 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4719 Py_XINCREF(trueSelf);
4723 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4725 return PyInt_FromLong(self->getNumberOfCompo());
4728 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4730 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4733 std::vector<int> multiVal;
4734 std::pair<int, std::pair<int,int> > slic;
4735 MEDCoupling::DataArrayInt *daIntTyypp=0;
4736 const int *pt=self->getConstPointer();
4737 int nbc=self->getNumberOfCompo();
4738 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4745 std::ostringstream oss;
4746 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4747 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4751 return PyInt_FromLong(pt[singleVal]);
4755 return PyInt_FromLong(pt[nbc+singleVal]);
4758 std::ostringstream oss;
4759 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4760 throw INTERP_KERNEL::Exception(oss.str().c_str());
4766 PyObject *t=PyTuple_New(multiVal.size());
4767 for(int j=0;j<(int)multiVal.size();j++)
4769 int cid=multiVal[j];
4772 std::ostringstream oss;
4773 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4774 throw INTERP_KERNEL::Exception(oss.str().c_str());
4776 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4782 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4783 PyObject *t=PyTuple_New(sz);
4784 for(int j=0;j<sz;j++)
4785 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4789 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4793 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4795 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4796 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4799 std::vector<int> multiValV;
4800 std::pair<int, std::pair<int,int> > slicV;
4801 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4802 int nbc=self->getNumberOfCompo();
4803 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4805 std::vector<int> multiVal;
4806 std::pair<int, std::pair<int,int> > slic;
4807 MEDCoupling::DataArrayInt *daIntTyypp=0;
4808 int *pt=self->getPointer();
4809 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4816 std::ostringstream oss;
4817 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4818 throw INTERP_KERNEL::Exception(oss.str().c_str());
4824 pt[singleVal]=singleValV;
4829 if(multiValV.size()!=1)
4831 std::ostringstream oss;
4832 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4833 throw INTERP_KERNEL::Exception(oss.str().c_str());
4835 pt[singleVal]=multiValV[0];
4840 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4844 throw INTERP_KERNEL::Exception(msg);
4853 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4857 std::ostringstream oss;
4858 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4859 throw INTERP_KERNEL::Exception(oss.str().c_str());
4867 if(multiVal.size()!=multiValV.size())
4869 std::ostringstream oss;
4870 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4871 throw INTERP_KERNEL::Exception(oss.str().c_str());
4873 for(int i=0;i<(int)multiVal.size();i++)
4875 int pos=multiVal[i];
4878 std::ostringstream oss;
4879 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4880 throw INTERP_KERNEL::Exception(oss.str().c_str());
4882 pt[multiVal[i]]=multiValV[i];
4888 const int *ptV=daIntTyyppV->getConstPointer();
4889 if(nbc>daIntTyyppV->getNumberOfCompo())
4891 std::ostringstream oss;
4892 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4893 throw INTERP_KERNEL::Exception(oss.str().c_str());
4895 std::copy(ptV,ptV+nbc,pt);
4899 throw INTERP_KERNEL::Exception(msg);
4904 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4909 for(int j=0;j<sz;j++)
4910 pt[slic.first+j*slic.second.second]=singleValV;
4915 if(sz!=(int)multiValV.size())
4917 std::ostringstream oss;
4918 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4919 throw INTERP_KERNEL::Exception(oss.str().c_str());
4921 for(int j=0;j<sz;j++)
4922 pt[slic.first+j*slic.second.second]=multiValV[j];
4927 const int *ptV=daIntTyyppV->getConstPointer();
4928 if(sz>daIntTyyppV->getNumberOfCompo())
4930 std::ostringstream oss;
4931 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4932 throw INTERP_KERNEL::Exception(oss.str().c_str());
4934 for(int j=0;j<sz;j++)
4935 pt[slic.first+j*slic.second.second]=ptV[j];
4939 throw INTERP_KERNEL::Exception(msg);
4943 throw INTERP_KERNEL::Exception(msg);
4949 class DataArrayChar : public DataArray
4952 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4953 int getHashCode() const throw(INTERP_KERNEL::Exception);
4954 bool empty() const throw(INTERP_KERNEL::Exception);
4955 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4956 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4957 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4958 char popBackSilent() throw(INTERP_KERNEL::Exception);
4959 void pack() const throw(INTERP_KERNEL::Exception);
4960 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4961 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4962 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4963 void reverse() throw(INTERP_KERNEL::Exception);
4964 void fillWithZero() throw(INTERP_KERNEL::Exception);
4965 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4966 std::string repr() const throw(INTERP_KERNEL::Exception);
4967 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4968 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4969 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4970 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4971 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4972 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4973 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4974 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4975 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4976 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4977 char front() const throw(INTERP_KERNEL::Exception);
4978 char back() const throw(INTERP_KERNEL::Exception);
4979 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4980 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4981 char *getPointer() throw(INTERP_KERNEL::Exception);
4982 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4983 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4984 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4985 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4986 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4987 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4988 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4989 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4990 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4991 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4992 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4995 int __len__() const throw(INTERP_KERNEL::Exception)
4997 if(self->isAllocated())
4999 return self->getNumberOfTuples();
5003 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5007 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5010 bool ret0=self->isEqualIfNotWhy(other,ret1);
5011 PyObject *ret=PyTuple_New(2);
5012 PyObject *ret0Py=ret0?Py_True:Py_False;
5014 PyTuple_SetItem(ret,0,ret0Py);
5015 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5019 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5022 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5023 if (!SWIG_IsOK(res1))
5026 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5027 if(size!=self->getNumberOfTuples())
5029 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5031 return self->renumber(tmp);
5035 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5037 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5038 da2->checkAllocated();
5039 int size=self->getNumberOfTuples();
5040 if(size!=self->getNumberOfTuples())
5042 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5044 return self->renumber(da2->getConstPointer());
5048 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5051 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5052 if (!SWIG_IsOK(res1))
5055 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5056 if(size!=self->getNumberOfTuples())
5058 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5060 return self->renumberR(tmp);
5064 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5066 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5067 da2->checkAllocated();
5068 int size=self->getNumberOfTuples();
5069 if(size!=self->getNumberOfTuples())
5071 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5073 return self->renumberR(da2->getConstPointer());
5077 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5080 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5081 if (!SWIG_IsOK(res1))
5084 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5085 if(size!=self->getNumberOfTuples())
5087 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5089 return self->renumberAndReduce(tmp,newNbOfTuple);
5093 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5095 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5096 da2->checkAllocated();
5097 int size=self->getNumberOfTuples();
5098 if(size!=self->getNumberOfTuples())
5100 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5102 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5106 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5108 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5109 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5110 return DataArrayChar::Aggregate(tmp);
5113 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5115 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5116 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5117 return DataArrayChar::Meld(tmp);
5122 class DataArrayByteIterator;
5124 class DataArrayByte : public DataArrayChar
5127 static DataArrayByte *New();
5128 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5129 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5130 char byteValue() const throw(INTERP_KERNEL::Exception);
5133 DataArrayByte() throw(INTERP_KERNEL::Exception)
5135 return DataArrayByte::New();
5138 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5140 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) !";
5141 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5145 if(PyInt_Check(nbOfTuples))
5147 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5149 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5152 if(PyInt_Check(nbOfComp))
5153 {//DataArrayByte.New([1,3,4,5],2,2)
5154 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5156 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5157 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5158 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5159 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5163 throw INTERP_KERNEL::Exception(msg);
5166 {//DataArrayByte.New([1,3,4],3)
5167 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5169 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5170 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5175 throw INTERP_KERNEL::Exception(msg);
5178 {// DataArrayByte.New([1,3,4])
5179 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5180 int tmpp1=-1,tmpp2=-1;
5181 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5182 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5186 else if(PyInt_Check(elt0))
5188 int nbOfTuples1=PyInt_AS_LONG(elt0);
5190 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5195 if(PyInt_Check(nbOfTuples))
5196 {//DataArrayByte.New(5,2)
5197 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5199 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5200 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5201 ret->alloc(nbOfTuples1,nbOfCompo);
5205 throw INTERP_KERNEL::Exception(msg);
5208 throw INTERP_KERNEL::Exception(msg);
5211 {//DataArrayByte.New(5)
5212 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5213 ret->alloc(nbOfTuples1,1);
5218 throw INTERP_KERNEL::Exception(msg);
5221 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5223 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5226 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5228 std::ostringstream oss;
5229 self->reprQuickOverview(oss);
5233 int __int__() const throw(INTERP_KERNEL::Exception)
5235 return (int) self->byteValue();
5238 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5240 return self->iterator();
5243 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5245 return (int)self->getIJ(tupleId,compoId);
5248 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5250 return (int)self->getIJSafe(tupleId,compoId);
5253 std::string __str__() const throw(INTERP_KERNEL::Exception)
5255 return self->repr();
5258 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5260 const char *vals=self->getConstPointer();
5261 int nbOfComp=self->getNumberOfComponents();
5262 int nbOfTuples=self->getNumberOfTuples();
5263 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5266 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5269 int ival=-1; std::vector<int> ivval;
5270 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5271 std::vector<char> vals(sz);
5272 std::copy(pt,pt+sz,vals.begin());
5273 return self->presenceOfTuple(vals);
5276 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5279 int ival=-1; std::vector<int> ivval;
5280 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5281 std::vector<char> vals2(sz);
5282 std::copy(pt,pt+sz,vals2.begin());
5283 return self->presenceOfValue(vals2);
5286 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5289 int ival=-1; std::vector<int> ivval;
5290 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5291 std::vector<char> vals2(sz);
5292 std::copy(pt,pt+sz,vals2.begin());
5293 return self->findIdFirstEqual(vals2);
5296 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5299 int ival=-1; std::vector<int> ivval;
5300 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5301 std::vector<char> vals(sz);
5302 std::copy(pt,pt+sz,vals.begin());
5303 return self->findIdFirstEqualTuple(vals);
5306 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5309 int ival=-1; std::vector<int> ivval;
5310 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5311 std::vector<char> vals(sz);
5312 std::copy(pt,pt+sz,vals.begin());
5313 return self->findIdSequence(vals);
5316 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5318 int sz=self->getNumberOfComponents();
5319 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5320 self->getTuple(tupleId,tmp);
5321 PyObject *ret=PyTuple_New(sz);
5322 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5326 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5329 int r1=(int)self->getMaxValue(tmp);
5330 PyObject *ret=PyTuple_New(2);
5331 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5332 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5336 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5339 int r1=(int)self->getMinValue(tmp);
5340 PyObject *ret=PyTuple_New(2);
5341 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5342 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5346 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5348 int nbOfCompo=self->getNumberOfComponents();
5353 if(PyInt_Check(obj))
5355 int val=(int)PyInt_AS_LONG(obj);
5356 return self->findIdFirstEqual(val);
5359 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5362 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5366 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5368 int nbOfCompo=self->getNumberOfComponents();
5375 if(PyInt_Check(obj))
5377 int val=(int)PyInt_AS_LONG(obj);
5378 return self->presenceOfValue(val);
5381 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5384 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5388 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5390 self->checkAllocated();
5391 const char msg[]="Unexpected situation in __setitem__ !";
5392 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5395 std::vector<int> v1;
5397 DataArrayIntTuple *dd1=0;
5398 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5400 std::vector<int> vt1,vc1;
5401 std::pair<int, std::pair<int,int> > pt1,pc1;
5402 DataArrayInt *dt1=0,*dc1=0;
5403 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5404 MCAuto<DataArrayInt> tmp;
5412 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5415 throw INTERP_KERNEL::Exception(msg);
5424 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5427 throw INTERP_KERNEL::Exception(msg);
5436 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5439 throw INTERP_KERNEL::Exception(msg);
5448 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5451 throw INTERP_KERNEL::Exception(msg);
5460 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5463 throw INTERP_KERNEL::Exception(msg);
5472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5475 throw INTERP_KERNEL::Exception(msg);
5484 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5487 throw INTERP_KERNEL::Exception(msg);
5496 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5499 throw INTERP_KERNEL::Exception(msg);
5508 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5511 throw INTERP_KERNEL::Exception(msg);
5520 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5523 throw INTERP_KERNEL::Exception(msg);
5532 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5535 throw INTERP_KERNEL::Exception(msg);
5544 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5547 throw INTERP_KERNEL::Exception(msg);
5556 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5559 throw INTERP_KERNEL::Exception(msg);
5568 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5571 throw INTERP_KERNEL::Exception(msg);
5580 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5583 throw INTERP_KERNEL::Exception(msg);
5592 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5595 throw INTERP_KERNEL::Exception(msg);
5600 throw INTERP_KERNEL::Exception(msg);
5607 class DataArrayByteTuple;
5609 class DataArrayByteIterator
5612 DataArrayByteIterator(DataArrayByte *da);
5613 ~DataArrayByteIterator();
5616 class DataArrayByteTuple
5619 std::string repr() const throw(INTERP_KERNEL::Exception);
5620 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5623 std::string __str__() const throw(INTERP_KERNEL::Exception)
5625 return self->repr();
5628 char __int__() const throw(INTERP_KERNEL::Exception)
5630 return self->byteValue();
5633 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5635 return self->buildDAByte(1,self->getNumberOfCompo());
5640 class DataArrayAsciiCharIterator;
5642 class DataArrayAsciiChar : public DataArrayChar
5645 static DataArrayAsciiChar *New();
5646 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5647 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5648 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5651 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5653 return DataArrayAsciiChar::New();
5656 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5658 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) !";
5659 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5663 if(PyInt_Check(nbOfTuples))
5665 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5667 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5670 if(PyInt_Check(nbOfComp))
5671 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5672 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5674 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5675 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5676 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5677 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5681 throw INTERP_KERNEL::Exception(msg);
5684 {//DataArrayAsciiChar.New([1,3,4],3)
5685 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5687 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5688 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5692 else if(PyString_Check(nbOfTuples))
5694 if(PyString_Size(nbOfTuples)!=1)
5695 throw INTERP_KERNEL::Exception(msg);
5696 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5697 std::vector<std::string> tmp;
5698 if(fillStringVector(elt0,tmp))
5699 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5701 throw INTERP_KERNEL::Exception(msg);
5704 throw INTERP_KERNEL::Exception(msg);
5708 std::vector<std::string> tmmp;
5709 if(fillStringVector(elt0,tmmp))
5710 //DataArrayAsciiChar.New(["abc","de","fghi"])
5711 return DataArrayAsciiChar::New(tmmp,' ');
5714 // DataArrayAsciiChar.New([1,3,4])
5715 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5716 int tmpp1=-1,tmpp2=-1;
5717 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5718 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5723 else if(PyInt_Check(elt0))
5725 int nbOfTuples1=PyInt_AS_LONG(elt0);
5727 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5732 if(PyInt_Check(nbOfTuples))
5733 {//DataArrayAsciiChar.New(5,2)
5734 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5736 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5737 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5738 ret->alloc(nbOfTuples1,nbOfCompo);
5742 throw INTERP_KERNEL::Exception(msg);
5745 throw INTERP_KERNEL::Exception(msg);
5748 {//DataArrayAsciiChar.New(5)
5749 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5750 ret->alloc(nbOfTuples1,1);
5755 throw INTERP_KERNEL::Exception(msg);
5758 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5760 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5763 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5765 std::ostringstream oss;
5766 self->reprQuickOverview(oss);
5770 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5772 return self->iterator();
5775 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5777 char tmp[2]; tmp[1]='\0';
5778 tmp[0]=self->getIJ(tupleId,compoId);
5779 return std::string(tmp);
5782 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5784 char tmp[2]; tmp[1]='\0';
5785 tmp[0]=self->getIJSafe(tupleId,compoId);
5786 return std::string(tmp);
5789 std::string __str__() const throw(INTERP_KERNEL::Exception)
5791 return self->repr();
5794 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5796 const char *vals=self->getConstPointer();
5797 int nbOfComp=self->getNumberOfComponents();
5798 int nbOfTuples=self->getNumberOfTuples();
5799 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5802 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5804 if(PyString_Check(tupl))
5806 Py_ssize_t sz=PyString_Size(tupl);
5807 std::vector<char> vals(sz);
5808 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5809 return self->presenceOfTuple(vals);
5812 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5815 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5817 if(PyString_Check(vals))
5819 Py_ssize_t sz=PyString_Size(vals);
5820 std::vector<char> vals2(sz);
5821 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5822 return self->presenceOfValue(vals2);
5825 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5828 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5830 if(PyString_Check(vals))
5832 Py_ssize_t sz=PyString_Size(vals);
5833 std::vector<char> vals2(sz);
5834 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5835 return self->findIdFirstEqual(vals2);
5838 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5841 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5843 if(PyString_Check(tupl))
5845 Py_ssize_t sz=PyString_Size(tupl);
5846 std::vector<char> vals(sz);
5847 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5848 return self->findIdFirstEqualTuple(vals);
5851 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5854 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5856 if(PyString_Check(strOrListOfInt))
5858 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5859 std::vector<char> vals(sz);
5860 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5861 return self->findIdSequence(vals);
5864 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5867 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5869 int sz=self->getNumberOfComponents();
5870 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5871 self->getTuple(tupleId,tmp);
5872 return PyString_FromString(tmp);
5875 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5878 char tmp2[2]; tmp2[1]='\0';
5879 tmp2[0]=self->getMaxValue(tmp);
5880 PyObject *ret=PyTuple_New(2);
5881 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5882 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5886 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5889 char tmp2[2]; tmp2[1]='\0';
5890 tmp2[0]=self->getMinValue(tmp);
5891 PyObject *ret=PyTuple_New(2);
5892 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5893 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5897 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5899 int nbOfCompo=self->getNumberOfComponents();
5904 if(PyString_Check(obj))
5906 Py_ssize_t sz=PyString_Size(obj);
5907 char *pt=PyString_AsString(obj);
5909 return self->findIdFirstEqual(pt[0]);
5911 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5914 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5917 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5921 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5923 int nbOfCompo=self->getNumberOfComponents();
5930 if(PyString_Check(obj))
5932 Py_ssize_t sz=PyString_Size(obj);
5933 char *pt=PyString_AsString(obj);
5935 return self->presenceOfValue(pt[0]);
5937 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5940 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5943 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5947 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5950 std::vector<int> stdvecTyyppArr;
5951 std::pair<int, std::pair<int,int> > sTyyppArr;
5952 MEDCoupling::DataArrayInt *daIntTyypp=0;
5953 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5957 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5959 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5961 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5963 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5965 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5969 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5971 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.";
5973 std::vector<int> stdvecTyyppArr;
5974 std::pair<int, std::pair<int,int> > sTyyppArr;
5975 MEDCoupling::DataArrayInt *daIntTyypp=0;
5976 int nbOfCompo=self->getNumberOfComponents();
5977 int nbOfTuples=self->getNumberOfTuples();
5978 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5980 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5981 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5990 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5996 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5997 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6000 //value vector<string>
6003 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6004 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6007 //value DataArrayChar
6010 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6014 throw INTERP_KERNEL::Exception(msg);
6018 {//obj list-tuple[int]
6024 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6030 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6031 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6034 //value vector<string>
6037 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6038 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6041 //value DataArrayChar
6044 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6048 throw INTERP_KERNEL::Exception(msg);
6059 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6065 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6066 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6069 //value vector<string>
6072 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6073 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6076 //value DataArrayChar
6079 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6083 throw INTERP_KERNEL::Exception(msg);
6094 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6100 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6101 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6104 //value vector<string>
6107 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6108 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6111 //value DataArrayChar
6114 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6118 throw INTERP_KERNEL::Exception(msg);
6123 throw INTERP_KERNEL::Exception(msg);
6129 class DataArrayAsciiCharTuple;
6131 class DataArrayAsciiCharIterator
6134 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6135 ~DataArrayAsciiCharIterator();
6140 DataArrayAsciiCharTuple *ret=self->nextt();
6142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6145 PyErr_SetString(PyExc_StopIteration,"No more data.");
6152 class DataArrayAsciiCharTuple
6155 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6156 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6159 std::string __str__() const throw(INTERP_KERNEL::Exception)
6161 return self->repr();
6164 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6166 return self->buildDAAsciiChar(1,self->getNumberOfCompo());