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::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayInt::New;
53 %newobject MEDCoupling::DataArrayInt::__iter__;
54 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
55 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
56 %newobject MEDCoupling::DataArrayInt::subArray;
57 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
58 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
59 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
60 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
61 %newobject MEDCoupling::DataArrayInt::renumber;
62 %newobject MEDCoupling::DataArrayInt::renumberR;
63 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
64 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
65 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
66 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
67 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
68 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
69 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
70 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
71 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
72 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
73 %newobject MEDCoupling::DataArrayInt::negate;
74 %newobject MEDCoupling::DataArrayInt::computeAbs;
75 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
76 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
77 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
78 %newobject MEDCoupling::DataArrayInt::Aggregate;
79 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
80 %newobject MEDCoupling::DataArrayInt::Meld;
81 %newobject MEDCoupling::DataArrayInt::Add;
82 %newobject MEDCoupling::DataArrayInt::Substract;
83 %newobject MEDCoupling::DataArrayInt::Multiply;
84 %newobject MEDCoupling::DataArrayInt::Divide;
85 %newobject MEDCoupling::DataArrayInt::Pow;
86 %newobject MEDCoupling::DataArrayInt::BuildUnion;
87 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
88 %newobject MEDCoupling::DataArrayInt::Range;
89 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
90 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
91 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
92 %newobject MEDCoupling::DataArrayInt::buildComplement;
93 %newobject MEDCoupling::DataArrayInt::buildUnion;
94 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
95 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
96 %newobject MEDCoupling::DataArrayInt::buildIntersection;
97 %newobject MEDCoupling::DataArrayInt::buildUnique;
98 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
99 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
100 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
101 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
102 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
103 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
104 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
105 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
106 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
107 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
108 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
109 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
110 %newobject MEDCoupling::DataArrayInt::__neg__;
111 %newobject MEDCoupling::DataArrayInt::__add__;
112 %newobject MEDCoupling::DataArrayInt::__radd__;
113 %newobject MEDCoupling::DataArrayInt::__sub__;
114 %newobject MEDCoupling::DataArrayInt::__rsub__;
115 %newobject MEDCoupling::DataArrayInt::__mul__;
116 %newobject MEDCoupling::DataArrayInt::__rmul__;
117 %newobject MEDCoupling::DataArrayInt::__div__;
118 %newobject MEDCoupling::DataArrayInt::__rdiv__;
119 %newobject MEDCoupling::DataArrayInt::__mod__;
120 %newobject MEDCoupling::DataArrayInt::__rmod__;
121 %newobject MEDCoupling::DataArrayInt::__pow__;
122 %newobject MEDCoupling::DataArrayInt::__rpow__;
123 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
124 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
125 %newobject MEDCoupling::DataArrayChar::renumber;
126 %newobject MEDCoupling::DataArrayChar::renumberR;
127 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
128 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
129 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
130 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
131 %newobject MEDCoupling::DataArrayChar::Aggregate;
132 %newobject MEDCoupling::DataArrayChar::Meld;
133 %newobject MEDCoupling::DataArrayByte::New;
134 %newobject MEDCoupling::DataArrayByte::__iter__;
135 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
136 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
137 %newobject MEDCoupling::DataArrayChar::subArray;
138 %newobject MEDCoupling::DataArrayAsciiChar::New;
139 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
140 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
141 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
142 %newobject MEDCoupling::DataArrayDouble::New;
143 %newobject MEDCoupling::DataArrayDouble::__iter__;
144 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
145 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
146 %newobject MEDCoupling::DataArrayDouble::Aggregate;
147 %newobject MEDCoupling::DataArrayDouble::Meld;
148 %newobject MEDCoupling::DataArrayDouble::Dot;
149 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
150 %newobject MEDCoupling::DataArrayDouble::Add;
151 %newobject MEDCoupling::DataArrayDouble::Substract;
152 %newobject MEDCoupling::DataArrayDouble::Multiply;
153 %newobject MEDCoupling::DataArrayDouble::Divide;
154 %newobject MEDCoupling::DataArrayDouble::Pow;
155 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
156 %newobject MEDCoupling::DataArrayDouble::subArray;
157 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
158 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
159 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
160 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
161 %newobject MEDCoupling::DataArrayDouble::negate;
162 %newobject MEDCoupling::DataArrayDouble::computeAbs;
163 %newobject MEDCoupling::DataArrayDouble::applyFunc;
164 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
165 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
166 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
167 %newobject MEDCoupling::DataArrayDouble::determinant;
168 %newobject MEDCoupling::DataArrayDouble::eigenValues;
169 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
170 %newobject MEDCoupling::DataArrayDouble::inverse;
171 %newobject MEDCoupling::DataArrayDouble::trace;
172 %newobject MEDCoupling::DataArrayDouble::deviator;
173 %newobject MEDCoupling::DataArrayDouble::magnitude;
174 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
175 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
176 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
177 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
178 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
179 %newobject MEDCoupling::DataArrayDouble::renumber;
180 %newobject MEDCoupling::DataArrayDouble::renumberR;
181 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
182 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
183 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
184 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
185 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
186 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
187 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
188 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
189 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
190 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
191 %newobject MEDCoupling::DataArrayDouble::cartesianize;
192 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
193 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
194 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
195 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
196 %newobject MEDCoupling::DataArrayDouble::__neg__;
197 %newobject MEDCoupling::DataArrayDouble::__radd__;
198 %newobject MEDCoupling::DataArrayDouble::__rsub__;
199 %newobject MEDCoupling::DataArrayDouble::__rmul__;
200 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
201 %newobject MEDCoupling::DataArrayDouble::__pow__;
202 %newobject MEDCoupling::DataArrayDouble::__rpow__;
203 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
205 %feature("unref") DataArray "$this->decrRef();"
206 %feature("unref") DataArrayDouble "$this->decrRef();"
207 %feature("unref") DataArrayInt "$this->decrRef();"
208 %feature("unref") DataArrayChar "$this->decrRef();"
209 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
210 %feature("unref") DataArrayByte "$this->decrRef();"
212 namespace MEDCoupling
219 } MEDCouplingAxisType;
221 class DataArray : public RefCountObject, public TimeLabel
224 void setName(const std::string& name);
225 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
226 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
227 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
228 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
229 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
230 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
231 std::string getName() const;
232 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
233 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
234 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
235 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
236 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
237 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
238 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
239 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
240 int getNumberOfComponents() const;
241 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
242 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
243 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
244 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
245 virtual void desallocate() throw(INTERP_KERNEL::Exception);
246 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
247 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
248 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
249 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
250 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
251 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
252 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
253 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
254 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
255 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
256 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
257 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
258 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
259 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
260 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
261 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
262 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
263 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
264 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
265 void updateTime() const;
268 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
270 const std::vector<std::string>& comps=self->getInfoOnComponents();
271 PyObject *ret=PyList_New((int)comps.size());
272 for(int i=0;i<(int)comps.size();i++)
273 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
277 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
279 std::vector<int> tmp;
280 convertPyToNewIntArr3(li,tmp);
281 self->copyPartOfStringInfoFrom(other,tmp);
284 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
286 std::vector<int> tmp;
287 convertPyToNewIntArr3(li,tmp);
288 self->copyPartOfStringInfoFrom2(tmp,other);
291 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
294 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
295 if (!SWIG_IsOK(res1))
298 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
299 if(size!=self->getNumberOfTuples())
301 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
303 self->renumberInPlace(tmp);
307 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
309 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
310 da2->checkAllocated();
311 int size=self->getNumberOfTuples();
312 if(size!=self->getNumberOfTuples())
314 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
316 self->renumberInPlace(da2->getConstPointer());
320 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
323 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
324 if (!SWIG_IsOK(res1))
327 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
328 if(size!=self->getNumberOfTuples())
330 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
332 self->renumberInPlaceR(tmp);
336 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
338 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
339 da2->checkAllocated();
340 int size=self->getNumberOfTuples();
341 if(size!=self->getNumberOfTuples())
343 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
345 self->renumberInPlaceR(da2->getConstPointer());
349 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
350 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
352 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
353 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
354 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
355 DataArrayInt *tuplesSelecPtr2=0;
358 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
360 throw INTERP_KERNEL::Exception(msg);
362 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
365 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
367 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
368 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
371 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
373 std::vector<std::pair<int,int> > ranges;
374 convertPyToVectorPairInt(li,ranges);
375 return self->selectByTupleRanges(ranges);
378 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
381 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
382 if (!SWIG_IsOK(res1))
385 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
386 return self->selectByTupleId(tmp,tmp+size);
390 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
392 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
393 da2->checkAllocated();
394 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
398 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
401 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
402 if (!SWIG_IsOK(res1))
405 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
406 return self->selectByTupleIdSafe(tmp,tmp+size);
410 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
412 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
413 da2->checkAllocated();
414 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
418 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
420 std::vector<int> tmp;
421 convertPyToNewIntArr3(li,tmp);
422 DataArray *ret=self->keepSelectedComponents(tmp);
423 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
426 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
428 if(!PySlice_Check(slic))
429 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
430 Py_ssize_t strt=2,stp=2,step=2;
431 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
432 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
434 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
435 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
438 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
440 if(!PySlice_Check(slic))
441 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
442 Py_ssize_t strt=2,stp=2,step=2;
443 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
444 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
446 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
447 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
450 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
452 if(!PySlice_Check(slic))
453 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
454 Py_ssize_t strt=2,stp=2,step=2;
455 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
456 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
457 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
460 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
462 if(!PySlice_Check(slic))
463 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
464 Py_ssize_t strt=2,stp=2,step=2;
465 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
466 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
467 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
470 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
472 std::vector<const DataArray *> tmp;
473 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
474 return DataArray::Aggregate(tmp);
477 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
479 if(!PySlice_Check(slic))
480 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
481 Py_ssize_t strt=2,stp=2,step=2;
482 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
483 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
484 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
487 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
489 if(!PySlice_Check(slic))
490 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
491 Py_ssize_t strt=2,stp=2,step=2;
492 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
493 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
494 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
497 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
499 PyObject *ret(PyTuple_New(2));
500 std::string a0(self->getName());
501 const std::vector<std::string> &a1(self->getInfoOnComponents());
502 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
505 PyObject *ret1(PyList_New(sz));
506 for(int i=0;i<sz;i++)
507 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
508 PyTuple_SetItem(ret,1,ret1);
513 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
515 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 !";
516 if(!PyTuple_Check(inp))
517 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
518 int sz(PyTuple_Size(inp));
520 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
521 PyObject *a0(PyTuple_GetItem(inp,0));
522 if(!PyString_Check(a0))
523 throw INTERP_KERNEL::Exception(MSG);
524 PyObject *a1(PyTuple_GetItem(inp,1));
525 std::vector<std::string> a1cpp;
526 if(!fillStringVector(a1,a1cpp))
527 throw INTERP_KERNEL::Exception(MSG);
528 self->setName(PyString_AsString(a0));
529 self->setInfoOnComponents(a1cpp);
535 class DataArrayDoubleIterator;
537 class DataArrayDouble : public DataArray
540 static DataArrayDouble *New();
541 double doubleValue() const throw(INTERP_KERNEL::Exception);
542 bool empty() const throw(INTERP_KERNEL::Exception);
543 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
544 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
545 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
546 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
547 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
548 double popBackSilent() throw(INTERP_KERNEL::Exception);
549 void pack() const throw(INTERP_KERNEL::Exception);
550 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
551 void fillWithZero() throw(INTERP_KERNEL::Exception);
552 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
553 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
554 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
555 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
556 void reverse() throw(INTERP_KERNEL::Exception);
557 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
558 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
559 std::string repr() const throw(INTERP_KERNEL::Exception);
560 std::string reprZip() const throw(INTERP_KERNEL::Exception);
561 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
562 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
563 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
564 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
567 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
568 void transpose() throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
570 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
571 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
572 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
573 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
574 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
575 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
576 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
577 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
578 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
579 double front() const throw(INTERP_KERNEL::Exception);
580 double back() const throw(INTERP_KERNEL::Exception);
581 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
582 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
583 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
584 double *getPointer() throw(INTERP_KERNEL::Exception);
585 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
586 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
587 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
588 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
589 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
590 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
591 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
592 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
593 double getAverageValue() const throw(INTERP_KERNEL::Exception);
594 double norm2() const throw(INTERP_KERNEL::Exception);
595 double normMax() const throw(INTERP_KERNEL::Exception);
596 double normMin() const throw(INTERP_KERNEL::Exception);
597 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
609 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
610 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
611 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
612 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
613 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
617 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
618 void abs() throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
620 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
621 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
622 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
623 void applyPow(double val) throw(INTERP_KERNEL::Exception);
624 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
625 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
626 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
627 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
628 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
629 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
630 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
631 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
632 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
633 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
634 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
635 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
636 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
637 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
638 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
639 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
640 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
641 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
642 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
643 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
644 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
645 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
646 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
647 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
648 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
649 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
650 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
651 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
654 DataArrayDouble() throw(INTERP_KERNEL::Exception)
656 return DataArrayDouble::New();
659 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
661 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)";
662 std::string msg(msgBase);
664 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
667 if(PyList_Check(elt0) || PyTuple_Check(elt0))
671 if(PyInt_Check(nbOfTuples))
673 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
675 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
678 if(PyInt_Check(elt2))
679 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
680 int nbOfCompo=PyInt_AS_LONG(elt2);
682 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
683 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
684 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
685 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
689 throw INTERP_KERNEL::Exception(msg.c_str());
692 {//DataArrayDouble.New([1.,3.,4.],3)
693 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
695 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
696 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
701 throw INTERP_KERNEL::Exception(msg.c_str());
704 {// DataArrayDouble.New([1.,3.,4.])
705 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
706 int tmpp1=-1,tmpp2=-1;
707 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
708 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
712 else if(PyInt_Check(elt0))
714 int nbOfTuples1=PyInt_AS_LONG(elt0);
716 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
721 if(PyInt_Check(nbOfTuples))
722 {//DataArrayDouble.New(5,2)
723 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
725 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
726 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
727 ret->alloc(nbOfTuples1,nbOfCompo);
731 throw INTERP_KERNEL::Exception(msg.c_str());
734 throw INTERP_KERNEL::Exception(msg.c_str());
737 {//DataArrayDouble.New(5)
738 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
739 ret->alloc(nbOfTuples1,1);
744 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
745 {//DataArrayDouble.New(numpyArray)
746 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
750 throw INTERP_KERNEL::Exception(msg.c_str());
751 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
754 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
756 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
759 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
762 std::vector<double> bb;
764 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
765 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
766 self->pushBackValsSilent(tmp,tmp+nbTuples);
769 std::string __repr__() const throw(INTERP_KERNEL::Exception)
771 std::ostringstream oss;
772 self->reprQuickOverview(oss);
776 std::string __str__() const throw(INTERP_KERNEL::Exception)
778 return self->reprNotTooLong();
781 double __float__() const throw(INTERP_KERNEL::Exception)
783 return self->doubleValue();
786 int __len__() const throw(INTERP_KERNEL::Exception)
788 if(self->isAllocated())
790 return self->getNumberOfTuples();
794 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
798 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
800 return self->iterator();
803 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
805 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 !";
806 if(PyList_Check(li) || PyTuple_Check(li))
810 if(PyInt_Check(nbOfTuples))
812 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
814 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
817 if(PyInt_Check(nbOfComp))
818 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
819 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
821 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
822 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
823 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
826 throw INTERP_KERNEL::Exception(msg);
829 {//DataArrayDouble.setValues([1.,3.,4.],3)
831 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
832 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
836 throw INTERP_KERNEL::Exception(msg);
839 {// DataArrayDouble.setValues([1.,3.,4.])
840 int tmpp1=-1,tmpp2=-1;
841 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
842 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
846 throw INTERP_KERNEL::Exception(msg);
849 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
851 const double *vals=self->getConstPointer();
852 return convertDblArrToPyList(vals,self->getNbOfElems());
856 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
858 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
862 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
865 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
866 PyObject *ret=PyTuple_New(2);
867 PyObject *ret0Py=ret0?Py_True:Py_False;
869 PyTuple_SetItem(ret,0,ret0Py);
870 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
874 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
876 const double *vals=self->getConstPointer();
877 int nbOfComp=self->getNumberOfComponents();
878 int nbOfTuples=self->getNumberOfTuples();
879 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
882 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
884 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
886 DataArrayDouble *a,*a2;
887 DataArrayDoubleTuple *aa,*aa2;
888 std::vector<double> bb,bb2;
890 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
891 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
892 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
896 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
898 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
900 DataArrayDouble *a,*a2;
901 DataArrayDoubleTuple *aa,*aa2;
902 std::vector<double> bb,bb2;
904 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
906 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
907 return convertDblArrToPyListOfTuple(res,3,3);
910 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
912 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
914 DataArrayDouble *a,*a2;
915 DataArrayDoubleTuple *aa,*aa2;
916 std::vector<double> bb,bb2;
918 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
919 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
920 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
923 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
926 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
927 if (!SWIG_IsOK(res1))
930 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
931 if(size!=self->getNumberOfTuples())
933 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
935 return self->renumber(tmp);
939 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
941 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
942 da2->checkAllocated();
943 int size=self->getNumberOfTuples();
944 if(size!=self->getNumberOfTuples())
946 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
948 return self->renumber(da2->getConstPointer());
952 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
955 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
956 if (!SWIG_IsOK(res1))
959 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
960 if(size!=self->getNumberOfTuples())
962 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
964 return self->renumberR(tmp);
968 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
970 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
971 da2->checkAllocated();
972 int size=self->getNumberOfTuples();
973 if(size!=self->getNumberOfTuples())
975 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
977 return self->renumberR(da2->getConstPointer());
981 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
984 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
985 if (!SWIG_IsOK(res1))
988 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
989 if(size!=self->getNumberOfTuples())
991 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
993 return self->renumberAndReduce(tmp,newNbOfTuple);
997 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
999 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1000 da2->checkAllocated();
1001 int size=self->getNumberOfTuples();
1002 if(size!=self->getNumberOfTuples())
1004 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1006 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1010 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1012 int thisTupleId,otherTupleId;
1013 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1014 PyObject *ret=PyTuple_New(3);
1015 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1016 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1017 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1021 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1024 double r1=self->getMaxValue(tmp);
1025 PyObject *ret=PyTuple_New(2);
1026 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1027 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1031 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1034 double r1=self->getMaxValue2(tmp);
1035 PyObject *ret=PyTuple_New(2);
1036 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1037 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1041 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1044 double r1=self->getMinValue(tmp);
1045 PyObject *ret=PyTuple_New(2);
1046 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1047 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1051 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1054 double r1=self->getMinValue2(tmp);
1055 PyObject *ret=PyTuple_New(2);
1056 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1057 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1061 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1063 int nbOfCompo=self->getNumberOfComponents();
1064 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1065 self->getMinMaxPerComponent(tmp);
1066 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1070 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1072 int sz=self->getNumberOfComponents();
1073 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1074 self->accumulate(tmp);
1075 return convertDblArrToPyList(tmp,sz);
1078 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1081 std::vector<int> val2;
1082 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1083 return self->accumulatePerChunck(bg,bg+sz);
1086 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1088 DataArrayInt *comm, *commIndex;
1089 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1090 PyObject *res = PyList_New(2);
1091 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1092 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1096 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1100 DataArrayDoubleTuple *aa;
1101 std::vector<double> bb;
1103 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1104 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1106 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1107 PyObject *ret=PyTuple_New(2);
1108 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1109 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1113 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1115 std::vector<int> tmp;
1116 convertPyToNewIntArr3(li,tmp);
1117 self->setSelectedComponents(a,tmp);
1120 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1122 int sz=self->getNumberOfComponents();
1123 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1124 self->getTuple(tupleId,tmp);
1125 return convertDblArrToPyList(tmp,sz);
1128 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1130 std::vector<const DataArrayDouble *> tmp;
1131 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1132 return DataArrayDouble::Aggregate(tmp);
1135 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1137 std::vector<const DataArrayDouble *> tmp;
1138 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1139 return DataArrayDouble::Meld(tmp);
1142 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1146 DataArrayDoubleTuple *aa;
1147 std::vector<double> bb;
1149 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1150 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1151 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1152 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1153 DataArrayInt *c=0,*cI=0;
1154 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1155 PyObject *ret=PyTuple_New(2);
1156 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1157 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1161 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1163 DataArrayInt *ret1=0;
1164 bool ret0=self->areIncludedInMe(other,prec,ret1);
1165 PyObject *ret=PyTuple_New(2);
1166 PyObject *ret0Py=ret0?Py_True:Py_False;
1168 PyTuple_SetItem(ret,0,ret0Py);
1169 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1173 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1175 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1176 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1177 self->checkAllocated();
1178 int nbOfTuples=self->getNumberOfTuples();
1179 int nbOfComponents=self->getNumberOfComponents();
1181 std::vector<int> vt1,vc1;
1182 std::pair<int, std::pair<int,int> > pt1,pc1;
1183 DataArrayInt *dt1=0,*dc1=0;
1185 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1186 MCAuto<DataArrayDouble> ret;
1190 if(nbOfComponents==1)
1191 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1192 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1194 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1196 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1198 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1200 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1203 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1204 std::vector<int> v2(1,ic1);
1205 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1209 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1210 std::vector<int> v2(1,ic1);
1211 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1215 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1216 std::vector<int> v2(1,ic1);
1217 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1221 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1222 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1226 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1227 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1231 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1232 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1236 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1237 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1241 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1242 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1243 std::vector<int> v2(nbOfComp);
1244 for(int i=0;i<nbOfComp;i++)
1245 v2[i]=pc1.first+i*pc1.second.second;
1246 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1250 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1251 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1252 std::vector<int> v2(nbOfComp);
1253 for(int i=0;i<nbOfComp;i++)
1254 v2[i]=pc1.first+i*pc1.second.second;
1255 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1259 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1260 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1261 std::vector<int> v2(nbOfComp);
1262 for(int i=0;i<nbOfComp;i++)
1263 v2[i]=pc1.first+i*pc1.second.second;
1264 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1268 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1269 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1270 std::vector<int> v2(nbOfComp);
1271 for(int i=0;i<nbOfComp;i++)
1272 v2[i]=pc1.first+i*pc1.second.second;
1273 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1276 throw INTERP_KERNEL::Exception(msg);
1280 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1282 self->checkAllocated();
1283 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1284 int nbOfTuples=self->getNumberOfTuples();
1285 int nbOfComponents=self->getNumberOfComponents();
1288 std::vector<double> v1;
1289 DataArrayDouble *d1=0;
1290 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1292 std::vector<int> vt1,vc1;
1293 std::pair<int, std::pair<int,int> > pt1,pc1;
1294 DataArrayInt *dt1=0,*dc1=0;
1295 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1296 MCAuto<DataArrayDouble> tmp;
1304 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1307 tmp=DataArrayDouble::New();
1308 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1309 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1312 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1315 throw INTERP_KERNEL::Exception(msg);
1324 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1327 tmp=DataArrayDouble::New();
1328 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1329 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1332 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1335 throw INTERP_KERNEL::Exception(msg);
1344 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1347 tmp=DataArrayDouble::New();
1348 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1349 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1352 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1355 throw INTERP_KERNEL::Exception(msg);
1364 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1367 tmp=DataArrayDouble::New();
1368 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1369 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1372 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1375 throw INTERP_KERNEL::Exception(msg);
1384 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1387 tmp=DataArrayDouble::New();
1388 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1389 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1392 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1395 throw INTERP_KERNEL::Exception(msg);
1404 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1407 tmp=DataArrayDouble::New();
1408 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1409 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1412 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1415 throw INTERP_KERNEL::Exception(msg);
1424 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1427 tmp=DataArrayDouble::New();
1428 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1429 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1432 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1435 throw INTERP_KERNEL::Exception(msg);
1444 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1447 tmp=DataArrayDouble::New();
1448 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1449 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1452 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1455 throw INTERP_KERNEL::Exception(msg);
1464 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1467 tmp=DataArrayDouble::New();
1468 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1469 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1472 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1475 throw INTERP_KERNEL::Exception(msg);
1484 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1487 tmp=DataArrayDouble::New();
1488 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1489 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1492 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1495 throw INTERP_KERNEL::Exception(msg);
1504 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1507 tmp=DataArrayDouble::New();
1508 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1509 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1512 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1515 throw INTERP_KERNEL::Exception(msg);
1524 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1527 tmp=DataArrayDouble::New();
1528 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1529 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1532 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1535 throw INTERP_KERNEL::Exception(msg);
1544 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1547 tmp=DataArrayDouble::New();
1548 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1549 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1552 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1555 throw INTERP_KERNEL::Exception(msg);
1564 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1567 tmp=DataArrayDouble::New();
1568 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1569 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1572 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1575 throw INTERP_KERNEL::Exception(msg);
1584 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1587 tmp=DataArrayDouble::New();
1588 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1589 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1592 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1595 throw INTERP_KERNEL::Exception(msg);
1604 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1607 tmp=DataArrayDouble::New();
1608 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1609 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1612 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1615 throw INTERP_KERNEL::Exception(msg);
1620 throw INTERP_KERNEL::Exception(msg);
1625 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1627 return self->negate();
1630 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1632 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1635 DataArrayDoubleTuple *aa;
1636 std::vector<double> bb;
1639 #ifndef WITHOUT_AUTOFIELD
1641 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1643 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1646 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1647 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1649 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1652 throw INTERP_KERNEL::Exception(msg);
1656 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1661 MCAuto<DataArrayDouble> ret=self->deepCopy();
1662 ret->applyLin(1.,val);
1663 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1667 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1671 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1672 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1676 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1677 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1680 throw INTERP_KERNEL::Exception(msg);
1684 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1686 const char msg[]="Unexpected situation in __radd__ !";
1689 DataArrayDoubleTuple *aa;
1690 std::vector<double> bb;
1692 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1697 MCAuto<DataArrayDouble> ret=self->deepCopy();
1698 ret->applyLin(1.,val);
1703 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1704 return DataArrayDouble::Add(self,aaa);
1708 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1709 return DataArrayDouble::Add(self,aaa);
1712 throw INTERP_KERNEL::Exception(msg);
1716 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1718 const char msg[]="Unexpected situation in __iadd__ !";
1721 DataArrayDoubleTuple *aa;
1722 std::vector<double> bb;
1724 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1729 self->applyLin(1.,val);
1730 Py_XINCREF(trueSelf);
1736 Py_XINCREF(trueSelf);
1741 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1742 self->addEqual(aaa);
1743 Py_XINCREF(trueSelf);
1748 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1749 self->addEqual(aaa);
1750 Py_XINCREF(trueSelf);
1754 throw INTERP_KERNEL::Exception(msg);
1758 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1760 const char msg[]="Unexpected situation in __sub__ !";
1763 DataArrayDoubleTuple *aa;
1764 std::vector<double> bb;
1767 #ifndef WITHOUT_AUTOFIELD
1769 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1771 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1774 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1775 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1777 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1780 throw INTERP_KERNEL::Exception(msg);
1784 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1789 MCAuto<DataArrayDouble> ret=self->deepCopy();
1790 ret->applyLin(1.,-val);
1791 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1795 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1799 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1800 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1804 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1805 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1808 throw INTERP_KERNEL::Exception(msg);
1812 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1814 const char msg[]="Unexpected situation in __rsub__ !";
1817 DataArrayDoubleTuple *aa;
1818 std::vector<double> bb;
1820 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1825 MCAuto<DataArrayDouble> ret=self->deepCopy();
1826 ret->applyLin(-1.,val);
1831 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1832 return DataArrayDouble::Substract(aaa,self);
1836 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1837 return DataArrayDouble::Substract(aaa,self);
1840 throw INTERP_KERNEL::Exception(msg);
1844 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1846 const char msg[]="Unexpected situation in __isub__ !";
1849 DataArrayDoubleTuple *aa;
1850 std::vector<double> bb;
1852 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1857 self->applyLin(1,-val);
1858 Py_XINCREF(trueSelf);
1863 self->substractEqual(a);
1864 Py_XINCREF(trueSelf);
1869 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1870 self->substractEqual(aaa);
1871 Py_XINCREF(trueSelf);
1876 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1877 self->substractEqual(aaa);
1878 Py_XINCREF(trueSelf);
1882 throw INTERP_KERNEL::Exception(msg);
1886 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1888 const char msg[]="Unexpected situation in __mul__ !";
1891 DataArrayDoubleTuple *aa;
1892 std::vector<double> bb;
1895 #ifndef WITHOUT_AUTOFIELD
1897 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1899 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1902 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1903 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1905 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1908 throw INTERP_KERNEL::Exception(msg);
1912 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1917 MCAuto<DataArrayDouble> ret=self->deepCopy();
1918 ret->applyLin(val,0.);
1919 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1923 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1927 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1928 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1932 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1933 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1936 throw INTERP_KERNEL::Exception(msg);
1940 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1942 const char msg[]="Unexpected situation in __rmul__ !";
1945 DataArrayDoubleTuple *aa;
1946 std::vector<double> bb;
1948 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1953 MCAuto<DataArrayDouble> ret=self->deepCopy();
1954 ret->applyLin(val,0.);
1959 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1960 return DataArrayDouble::Multiply(self,aaa);
1964 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1965 return DataArrayDouble::Multiply(self,aaa);
1968 throw INTERP_KERNEL::Exception(msg);
1972 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1974 const char msg[]="Unexpected situation in __imul__ !";
1977 DataArrayDoubleTuple *aa;
1978 std::vector<double> bb;
1980 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1985 self->applyLin(val,0.);
1986 Py_XINCREF(trueSelf);
1991 self->multiplyEqual(a);
1992 Py_XINCREF(trueSelf);
1997 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1998 self->multiplyEqual(aaa);
1999 Py_XINCREF(trueSelf);
2004 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2005 self->multiplyEqual(aaa);
2006 Py_XINCREF(trueSelf);
2010 throw INTERP_KERNEL::Exception(msg);
2014 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2016 const char msg[]="Unexpected situation in __div__ !";
2019 DataArrayDoubleTuple *aa;
2020 std::vector<double> bb;
2023 #ifndef WITHOUT_AUTOFIELD
2025 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2027 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2030 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2031 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2033 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2036 throw INTERP_KERNEL::Exception(msg);
2040 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2046 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2047 MCAuto<DataArrayDouble> ret=self->deepCopy();
2048 ret->applyLin(1/val,0.);
2049 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2053 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2057 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2058 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2062 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2063 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2066 throw INTERP_KERNEL::Exception(msg);
2070 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2072 const char msg[]="Unexpected situation in __rdiv__ !";
2075 DataArrayDoubleTuple *aa;
2076 std::vector<double> bb;
2078 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2083 MCAuto<DataArrayDouble> ret=self->deepCopy();
2089 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2090 return DataArrayDouble::Divide(aaa,self);
2094 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2095 return DataArrayDouble::Divide(aaa,self);
2098 throw INTERP_KERNEL::Exception(msg);
2102 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2104 const char msg[]="Unexpected situation in __idiv__ !";
2107 DataArrayDoubleTuple *aa;
2108 std::vector<double> bb;
2110 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2116 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2117 self->applyLin(1./val,0.);
2118 Py_XINCREF(trueSelf);
2123 self->divideEqual(a);
2124 Py_XINCREF(trueSelf);
2129 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2130 self->divideEqual(aaa);
2131 Py_XINCREF(trueSelf);
2136 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2137 self->divideEqual(aaa);
2138 Py_XINCREF(trueSelf);
2142 throw INTERP_KERNEL::Exception(msg);
2146 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2148 const char msg[]="Unexpected situation in __pow__ !";
2151 DataArrayDoubleTuple *aa;
2152 std::vector<double> bb;
2154 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2159 MCAuto<DataArrayDouble> ret=self->deepCopy();
2165 return DataArrayDouble::Pow(self,a);
2169 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2170 return DataArrayDouble::Pow(self,aaa);
2174 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2175 return DataArrayDouble::Pow(self,aaa);
2178 throw INTERP_KERNEL::Exception(msg);
2182 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2184 const char msg[]="Unexpected situation in __rpow__ !";
2187 DataArrayDoubleTuple *aa;
2188 std::vector<double> bb;
2190 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2195 MCAuto<DataArrayDouble> ret=self->deepCopy();
2196 ret->applyRPow(val);
2201 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2202 return DataArrayDouble::Pow(aaa,self);
2206 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2207 return DataArrayDouble::Pow(aaa,self);
2210 throw INTERP_KERNEL::Exception(msg);
2214 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2216 const char msg[]="Unexpected situation in __ipow__ !";
2219 DataArrayDoubleTuple *aa;
2220 std::vector<double> bb;
2222 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2227 self->applyPow(val);
2228 Py_XINCREF(trueSelf);
2234 Py_XINCREF(trueSelf);
2239 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2240 self->powEqual(aaa);
2241 Py_XINCREF(trueSelf);
2246 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2247 self->powEqual(aaa);
2248 Py_XINCREF(trueSelf);
2252 throw INTERP_KERNEL::Exception(msg);
2256 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2258 DataArrayInt *c=0,*cI=0;
2260 self->computeTupleIdsNearTuples(other,eps,c,cI);
2261 PyObject *ret=PyTuple_New(2);
2262 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2263 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2267 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2269 DataArrayInt *ret1=0;
2270 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2271 PyObject *ret=PyTuple_New(2);
2272 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2273 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2278 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2280 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2283 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2286 if(!self->isAllocated())
2287 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2288 PyObject *ret(PyTuple_New(1));
2289 PyObject *ret0(PyDict_New());
2290 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2291 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2292 PyObject *tmp1(PyInt_FromLong(0));
2293 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2294 PyTuple_SetItem(ret,0,ret0);
2298 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2304 class DataArrayDoubleTuple;
2306 class DataArrayDoubleIterator
2309 DataArrayDoubleIterator(DataArrayDouble *da);
2310 ~DataArrayDoubleIterator();
2315 DataArrayDoubleTuple *ret=self->nextt();
2317 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2320 PyErr_SetString(PyExc_StopIteration,"No more data.");
2327 class DataArrayDoubleTuple
2330 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2331 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2334 std::string __str__() const throw(INTERP_KERNEL::Exception)
2336 return self->repr();
2339 double __float__() const throw(INTERP_KERNEL::Exception)
2341 return self->doubleValue();
2344 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2346 return self->buildDADouble(1,self->getNumberOfCompo());
2349 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2351 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2352 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2353 Py_XINCREF(trueSelf);
2357 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2359 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2360 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2361 Py_XINCREF(trueSelf);
2365 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2367 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2368 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2369 Py_XINCREF(trueSelf);
2373 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2375 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2376 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2377 Py_XINCREF(trueSelf);
2381 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2383 return PyInt_FromLong(self->getNumberOfCompo());
2386 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2388 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2391 std::vector<int> multiVal;
2392 std::pair<int, std::pair<int,int> > slic;
2393 MEDCoupling::DataArrayInt *daIntTyypp=0;
2394 const double *pt=self->getConstPointer();
2395 int nbc=self->getNumberOfCompo();
2396 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2403 std::ostringstream oss;
2404 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2405 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2409 return PyFloat_FromDouble(pt[singleVal]);
2413 return PyFloat_FromDouble(pt[nbc+singleVal]);
2416 std::ostringstream oss;
2417 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2418 throw INTERP_KERNEL::Exception(oss.str().c_str());
2424 PyObject *t=PyTuple_New(multiVal.size());
2425 for(int j=0;j<(int)multiVal.size();j++)
2427 int cid=multiVal[j];
2430 std::ostringstream oss;
2431 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2432 throw INTERP_KERNEL::Exception(oss.str().c_str());
2434 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2440 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2441 PyObject *t=PyTuple_New(sz);
2442 for(int j=0;j<sz;j++)
2443 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2447 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2451 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2453 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2454 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2457 std::vector<double> multiValV;
2458 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2459 int nbc=self->getNumberOfCompo();
2460 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2462 std::vector<int> multiVal;
2463 std::pair<int, std::pair<int,int> > slic;
2464 MEDCoupling::DataArrayInt *daIntTyypp=0;
2465 double *pt=self->getPointer();
2466 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2473 std::ostringstream oss;
2474 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2475 throw INTERP_KERNEL::Exception(oss.str().c_str());
2481 pt[singleVal]=singleValV;
2486 if(multiValV.size()!=1)
2488 std::ostringstream oss;
2489 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2490 throw INTERP_KERNEL::Exception(oss.str().c_str());
2492 pt[singleVal]=multiValV[0];
2497 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2501 throw INTERP_KERNEL::Exception(msg);
2510 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2514 std::ostringstream oss;
2515 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2516 throw INTERP_KERNEL::Exception(oss.str().c_str());
2524 if(multiVal.size()!=multiValV.size())
2526 std::ostringstream oss;
2527 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2528 throw INTERP_KERNEL::Exception(oss.str().c_str());
2530 for(int i=0;i<(int)multiVal.size();i++)
2532 int pos=multiVal[i];
2535 std::ostringstream oss;
2536 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2537 throw INTERP_KERNEL::Exception(oss.str().c_str());
2539 pt[multiVal[i]]=multiValV[i];
2545 const double *ptV=daIntTyyppV->getConstPointer();
2546 if(nbc>daIntTyyppV->getNumberOfCompo())
2548 std::ostringstream oss;
2549 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2550 throw INTERP_KERNEL::Exception(oss.str().c_str());
2552 std::copy(ptV,ptV+nbc,pt);
2556 throw INTERP_KERNEL::Exception(msg);
2561 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2566 for(int j=0;j<sz;j++)
2567 pt[slic.first+j*slic.second.second]=singleValV;
2572 if(sz!=(int)multiValV.size())
2574 std::ostringstream oss;
2575 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2576 throw INTERP_KERNEL::Exception(oss.str().c_str());
2578 for(int j=0;j<sz;j++)
2579 pt[slic.first+j*slic.second.second]=multiValV[j];
2584 const double *ptV=daIntTyyppV->getConstPointer();
2585 if(sz>daIntTyyppV->getNumberOfCompo())
2587 std::ostringstream oss;
2588 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2589 throw INTERP_KERNEL::Exception(oss.str().c_str());
2591 for(int j=0;j<sz;j++)
2592 pt[slic.first+j*slic.second.second]=ptV[j];
2596 throw INTERP_KERNEL::Exception(msg);
2600 throw INTERP_KERNEL::Exception(msg);
2606 class DataArrayIntIterator;
2608 class DataArrayInt : public DataArray
2611 static DataArrayInt *New();
2612 int intValue() const throw(INTERP_KERNEL::Exception);
2613 int getHashCode() const throw(INTERP_KERNEL::Exception);
2614 bool empty() const throw(INTERP_KERNEL::Exception);
2615 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2616 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2617 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2618 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2619 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2620 int popBackSilent() throw(INTERP_KERNEL::Exception);
2621 void pack() const throw(INTERP_KERNEL::Exception);
2622 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2623 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2624 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2625 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2626 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2627 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2628 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2629 void reverse() throw(INTERP_KERNEL::Exception);
2630 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2631 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2632 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2633 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2634 void fillWithZero() throw(INTERP_KERNEL::Exception);
2635 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2636 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2637 std::string repr() const throw(INTERP_KERNEL::Exception);
2638 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2639 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2640 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2641 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2642 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2643 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2644 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2645 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2646 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2647 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2648 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2649 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2650 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2651 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2652 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2653 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2654 void transpose() throw(INTERP_KERNEL::Exception);
2655 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2656 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2657 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2658 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2659 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2660 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2661 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2662 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2663 int front() const throw(INTERP_KERNEL::Exception);
2664 int back() const throw(INTERP_KERNEL::Exception);
2665 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2666 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2667 int *getPointer() throw(INTERP_KERNEL::Exception);
2668 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2669 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2670 const int *begin() const throw(INTERP_KERNEL::Exception);
2671 const int *end() const throw(INTERP_KERNEL::Exception);
2672 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2673 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2674 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2675 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2676 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2677 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2678 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2679 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2680 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2681 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2682 int count(int value) const throw(INTERP_KERNEL::Exception);
2683 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2684 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2685 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2686 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2687 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2688 void abs() throw(INTERP_KERNEL::Exception);
2689 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2690 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2691 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2692 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2693 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2694 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2695 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2696 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2697 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2698 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2699 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2700 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2701 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2702 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2703 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2704 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2705 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2706 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2707 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2708 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2709 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2710 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2711 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2712 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2713 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2714 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2715 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2716 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2717 void computeOffsets() throw(INTERP_KERNEL::Exception);
2718 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2719 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2720 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2721 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2722 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2723 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2724 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2725 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2726 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2727 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2728 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2729 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2730 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2731 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2732 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2733 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2734 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2735 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2736 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2738 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2741 DataArrayInt() throw(INTERP_KERNEL::Exception)
2743 return DataArrayInt::New();
2746 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2748 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)";
2749 std::string msg(msgBase);
2751 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2754 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2758 if(PyInt_Check(nbOfTuples))
2760 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2762 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2765 if(PyInt_Check(nbOfComp))
2766 {//DataArrayInt.New([1,3,4,5],2,2)
2767 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2769 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2770 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2771 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2772 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2776 throw INTERP_KERNEL::Exception(msg.c_str());
2779 {//DataArrayInt.New([1,3,4],3)
2780 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2782 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2783 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2788 throw INTERP_KERNEL::Exception(msg.c_str());
2791 {// DataArrayInt.New([1,3,4])
2792 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2793 int tmpp1=-1,tmpp2=-1;
2794 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2795 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2799 else if(PyInt_Check(elt0))
2801 int nbOfTuples1=PyInt_AS_LONG(elt0);
2803 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2808 if(PyInt_Check(nbOfTuples))
2809 {//DataArrayInt.New(5,2)
2810 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2812 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2813 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2814 ret->alloc(nbOfTuples1,nbOfCompo);
2818 throw INTERP_KERNEL::Exception(msg.c_str());
2821 throw INTERP_KERNEL::Exception(msg.c_str());
2824 {//DataArrayInt.New(5)
2825 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2826 ret->alloc(nbOfTuples1,1);
2831 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2832 {//DataArrayInt.New(numpyArray)
2833 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2837 throw INTERP_KERNEL::Exception(msg.c_str());
2838 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2841 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2843 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2846 std::string __str__() const throw(INTERP_KERNEL::Exception)
2848 return self->reprNotTooLong();
2851 int __len__() const throw(INTERP_KERNEL::Exception)
2853 if(self->isAllocated())
2855 return self->getNumberOfTuples();
2859 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2863 int __int__() const throw(INTERP_KERNEL::Exception)
2865 return self->intValue();
2868 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2870 return self->iterator();
2873 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2875 int sz=self->getNumberOfComponents();
2876 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2877 self->accumulate(tmp);
2878 return convertIntArrToPyList(tmp,sz);
2881 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2884 std::vector<int> val2;
2885 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2886 return self->accumulatePerChunck(bg,bg+sz);
2889 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2892 std::vector<int> val2;
2893 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2894 return self->findIdsEqualTuple(bg,bg+sz);
2897 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2899 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2900 PyObject *ret=PyList_New(slcs.size());
2901 for(std::size_t i=0;i<slcs.size();i++)
2902 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2906 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2908 if(!PySlice_Check(slic))
2909 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2910 Py_ssize_t strt=2,stp=2,step=2;
2911 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2912 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2913 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2914 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 !");
2915 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2918 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2921 self->getMinMaxValues(a,b);
2922 PyObject *ret=PyTuple_New(2);
2923 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2924 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2928 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2930 int newNbOfTuples=-1;
2931 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2932 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2933 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2934 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2935 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2936 PyObject *ret=PyTuple_New(2);
2937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2938 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2942 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2944 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2945 int szArr,sw,iTypppArr;
2946 std::vector<int> stdvecTyyppArr;
2947 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2948 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2949 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2953 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2955 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 !";
2956 if(PyList_Check(li) || PyTuple_Check(li))
2958 if(nbOfTuples && nbOfTuples != Py_None)
2960 if(PyInt_Check(nbOfTuples))
2962 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2964 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2965 if(nbOfComp && nbOfComp != Py_None)
2967 if(PyInt_Check(nbOfComp))
2968 {//DataArrayInt.setValues([1,3,4,5],2,2)
2969 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2971 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2972 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2973 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2976 throw INTERP_KERNEL::Exception(msg);
2979 {//DataArrayInt.setValues([1,3,4],3)
2981 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2982 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2986 throw INTERP_KERNEL::Exception(msg);
2989 {// DataArrayInt.setValues([1,3,4])
2990 int tmpp1=-1,tmpp2=-1;
2991 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2992 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2996 throw INTERP_KERNEL::Exception(msg);
2999 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3001 const int *vals=self->getConstPointer();
3002 return convertIntArrToPyList(vals,self->getNbOfElems());
3006 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3008 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3012 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3015 bool ret0=self->isEqualIfNotWhy(other,ret1);
3016 PyObject *ret=PyTuple_New(2);
3017 PyObject *ret0Py=ret0?Py_True:Py_False;
3019 PyTuple_SetItem(ret,0,ret0Py);
3020 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3024 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3026 const int *vals=self->getConstPointer();
3027 int nbOfComp=self->getNumberOfComponents();
3028 int nbOfTuples=self->getNumberOfTuples();
3029 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3032 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3034 std::vector<const DataArrayInt *> groups;
3035 std::vector< std::vector<int> > fidsOfGroups;
3036 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3037 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3038 PyObject *ret = PyList_New(2);
3039 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3040 int sz=fidsOfGroups.size();
3041 PyObject *ret1 = PyList_New(sz);
3042 for(int i=0;i<sz;i++)
3043 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3044 PyList_SetItem(ret,1,ret1);
3048 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3051 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3052 if (!SWIG_IsOK(res1))
3055 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3056 self->transformWithIndArr(tmp,tmp+size);
3060 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3061 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3065 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3069 std::vector<int> multiVal;
3070 std::pair<int, std::pair<int,int> > slic;
3071 MEDCoupling::DataArrayInt *daIntTyypp=0;
3072 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3076 return self->findIdsEqualList(&singleVal,&singleVal+1);
3078 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3080 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3082 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3086 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3090 std::vector<int> multiVal;
3091 std::pair<int, std::pair<int,int> > slic;
3092 MEDCoupling::DataArrayInt *daIntTyypp=0;
3093 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3097 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3099 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3101 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3103 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3107 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3109 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
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 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3120 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3122 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3123 da2->checkAllocated();
3124 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3126 PyObject *ret = PyList_New(3);
3127 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3128 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3129 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3133 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3136 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3137 if (!SWIG_IsOK(res1))
3140 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3141 return self->transformWithIndArrR(tmp,tmp+size);
3145 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3146 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3150 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3153 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3154 if (!SWIG_IsOK(res1))
3157 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3158 if(size!=self->getNumberOfTuples())
3160 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3162 return self->renumberAndReduce(tmp,newNbOfTuple);
3166 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3168 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3169 da2->checkAllocated();
3170 int size=self->getNumberOfTuples();
3171 if(size!=self->getNumberOfTuples())
3173 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3175 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3179 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3182 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3183 if (!SWIG_IsOK(res1))
3186 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3187 if(size!=self->getNumberOfTuples())
3189 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3191 return self->renumber(tmp);
3195 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3197 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3198 da2->checkAllocated();
3199 int size=self->getNumberOfTuples();
3200 if(size!=self->getNumberOfTuples())
3202 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3204 return self->renumber(da2->getConstPointer());
3208 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3211 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3212 if (!SWIG_IsOK(res1))
3215 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3216 if(size!=self->getNumberOfTuples())
3218 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3220 return self->renumberR(tmp);
3224 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3226 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3227 da2->checkAllocated();
3228 int size=self->getNumberOfTuples();
3229 if(size!=self->getNumberOfTuples())
3231 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3233 return self->renumberR(da2->getConstPointer());
3237 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3239 std::vector<int> tmp;
3240 convertPyToNewIntArr3(li,tmp);
3241 self->setSelectedComponents(a,tmp);
3244 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3246 int sz=self->getNumberOfComponents();
3247 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3248 self->getTuple(tupleId,tmp);
3249 return convertIntArrToPyList(tmp,sz);
3252 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3254 DataArrayInt *arr=0;
3255 DataArrayInt *arrI=0;
3256 self->changeSurjectiveFormat(targetNb,arr,arrI);
3257 PyObject *res = PyList_New(2);
3258 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3259 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3263 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3265 std::vector<const DataArrayInt *> tmp;
3266 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3267 return DataArrayInt::Meld(tmp);
3270 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3272 std::vector<const DataArrayInt *> tmp;
3273 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3274 return DataArrayInt::Aggregate(tmp);
3277 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3279 std::vector<const DataArrayInt *> tmp;
3280 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3281 return DataArrayInt::AggregateIndexes(tmp);
3284 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3286 std::vector<const DataArrayInt *> tmp;
3287 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3288 return DataArrayInt::BuildUnion(tmp);
3291 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3293 std::vector<const DataArrayInt *> tmp;
3294 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3295 return DataArrayInt::BuildIntersection(tmp);
3298 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3301 int r1=self->getMaxValue(tmp);
3302 PyObject *ret=PyTuple_New(2);
3303 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3304 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3308 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3311 int r1=self->getMinValue(tmp);
3312 PyObject *ret=PyTuple_New(2);
3313 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3314 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3318 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3320 int nbOfCompo=self->getNumberOfComponents();
3325 if(PyInt_Check(obj))
3327 int val=(int)PyInt_AS_LONG(obj);
3328 return self->findIdFirstEqual(val);
3331 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3335 std::vector<int> arr;
3336 convertPyToNewIntArr3(obj,arr);
3337 return self->findIdFirstEqualTuple(arr);
3342 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3344 int nbOfCompo=self->getNumberOfComponents();
3351 if(PyInt_Check(obj))
3353 int val=(int)PyInt_AS_LONG(obj);
3354 return self->presenceOfValue(val);
3357 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3361 std::vector<int> arr;
3362 convertPyToNewIntArr3(obj,arr);
3363 return self->presenceOfTuple(arr);
3368 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3370 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3371 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3372 self->checkAllocated();
3373 int nbOfTuples=self->getNumberOfTuples();
3374 int nbOfComponents=self->getNumberOfComponents();
3376 std::vector<int> vt1,vc1;
3377 std::pair<int, std::pair<int,int> > pt1,pc1;
3378 DataArrayInt *dt1=0,*dc1=0;
3380 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3381 MCAuto<DataArrayInt> ret;
3386 if(nbOfComponents==1)
3387 return PyInt_FromLong(self->getIJSafe(it1,0));
3388 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3391 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3393 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3395 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3397 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3400 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3401 std::vector<int> v2(1,ic1);
3402 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3406 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3407 std::vector<int> v2(1,ic1);
3408 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3412 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3413 std::vector<int> v2(1,ic1);
3414 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3418 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3419 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3423 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3424 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3428 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3429 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3433 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3434 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3438 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3439 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3440 std::vector<int> v2(nbOfComp);
3441 for(int i=0;i<nbOfComp;i++)
3442 v2[i]=pc1.first+i*pc1.second.second;
3443 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3447 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3448 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3449 std::vector<int> v2(nbOfComp);
3450 for(int i=0;i<nbOfComp;i++)
3451 v2[i]=pc1.first+i*pc1.second.second;
3452 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3456 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3457 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3458 std::vector<int> v2(nbOfComp);
3459 for(int i=0;i<nbOfComp;i++)
3460 v2[i]=pc1.first+i*pc1.second.second;
3461 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3465 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3466 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3467 std::vector<int> v2(nbOfComp);
3468 for(int i=0;i<nbOfComp;i++)
3469 v2[i]=pc1.first+i*pc1.second.second;
3470 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3473 throw INTERP_KERNEL::Exception(msg);
3477 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3479 self->checkAllocated();
3480 const char msg[]="Unexpected situation in __setitem__ !";
3481 int nbOfTuples=self->getNumberOfTuples();
3482 int nbOfComponents=self->getNumberOfComponents();
3485 std::vector<int> v1;
3487 DataArrayIntTuple *dd1=0;
3488 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3490 std::vector<int> vt1,vc1;
3491 std::pair<int, std::pair<int,int> > pt1,pc1;
3492 DataArrayInt *dt1=0,*dc1=0;
3493 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3494 MCAuto<DataArrayInt> tmp;
3502 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3505 tmp=DataArrayInt::New();
3506 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3507 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3510 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3513 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3514 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3517 throw INTERP_KERNEL::Exception(msg);
3526 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3529 tmp=DataArrayInt::New();
3530 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3531 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3534 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3537 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3538 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3541 throw INTERP_KERNEL::Exception(msg);
3550 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3553 tmp=DataArrayInt::New();
3554 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3555 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3558 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3561 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3562 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3565 throw INTERP_KERNEL::Exception(msg);
3574 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3577 tmp=DataArrayInt::New();
3578 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3579 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3582 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3585 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3586 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3589 throw INTERP_KERNEL::Exception(msg);
3598 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3601 tmp=DataArrayInt::New();
3602 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3603 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3606 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3609 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3610 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3613 throw INTERP_KERNEL::Exception(msg);
3622 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3625 tmp=DataArrayInt::New();
3626 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3627 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3630 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3633 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3634 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3637 throw INTERP_KERNEL::Exception(msg);
3646 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3649 tmp=DataArrayInt::New();
3650 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3651 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3654 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3657 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3658 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3661 throw INTERP_KERNEL::Exception(msg);
3670 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3673 tmp=DataArrayInt::New();
3674 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3675 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3678 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3681 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3682 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3685 throw INTERP_KERNEL::Exception(msg);
3694 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3697 tmp=DataArrayInt::New();
3698 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3699 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3702 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3705 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3706 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3709 throw INTERP_KERNEL::Exception(msg);
3718 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3721 tmp=DataArrayInt::New();
3722 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3723 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3726 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3729 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3730 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3733 throw INTERP_KERNEL::Exception(msg);
3742 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3745 tmp=DataArrayInt::New();
3746 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3747 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3750 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3753 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3754 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3757 throw INTERP_KERNEL::Exception(msg);
3766 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3769 tmp=DataArrayInt::New();
3770 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3771 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3774 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3777 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3778 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3781 throw INTERP_KERNEL::Exception(msg);
3790 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3793 tmp=DataArrayInt::New();
3794 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3795 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3798 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3801 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3802 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3805 throw INTERP_KERNEL::Exception(msg);
3814 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3817 tmp=DataArrayInt::New();
3818 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3819 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3822 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3825 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3826 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3829 throw INTERP_KERNEL::Exception(msg);
3838 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3841 tmp=DataArrayInt::New();
3842 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3843 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3846 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3849 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3850 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3853 throw INTERP_KERNEL::Exception(msg);
3862 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3865 tmp=DataArrayInt::New();
3866 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3867 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3870 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3873 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3874 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3877 throw INTERP_KERNEL::Exception(msg);
3882 throw INTERP_KERNEL::Exception(msg);
3887 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3889 return self->negate();
3892 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3894 const char msg[]="Unexpected situation in __add__ !";
3897 std::vector<int> aa;
3898 DataArrayIntTuple *aaa;
3900 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3905 MCAuto<DataArrayInt> ret=self->deepCopy();
3906 ret->applyLin(1,val);
3911 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3912 return DataArrayInt::Add(self,aaaa);
3916 return DataArrayInt::Add(self,a);
3920 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3921 return DataArrayInt::Add(self,aaaa);
3924 throw INTERP_KERNEL::Exception(msg);
3928 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3930 const char msg[]="Unexpected situation in __radd__ !";
3933 std::vector<int> aa;
3934 DataArrayIntTuple *aaa;
3936 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3941 MCAuto<DataArrayInt> ret=self->deepCopy();
3942 ret->applyLin(1,val);
3947 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3948 return DataArrayInt::Add(self,aaaa);
3952 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3953 return DataArrayInt::Add(self,aaaa);
3956 throw INTERP_KERNEL::Exception(msg);
3960 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3962 const char msg[]="Unexpected situation in __iadd__ !";
3965 std::vector<int> aa;
3966 DataArrayIntTuple *aaa;
3968 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3973 self->applyLin(1,val);
3974 Py_XINCREF(trueSelf);
3979 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3981 Py_XINCREF(trueSelf);
3987 Py_XINCREF(trueSelf);
3992 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3993 self->addEqual(aaaa);
3994 Py_XINCREF(trueSelf);
3998 throw INTERP_KERNEL::Exception(msg);
4002 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4004 const char msg[]="Unexpected situation in __sub__ !";
4007 std::vector<int> aa;
4008 DataArrayIntTuple *aaa;
4010 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4015 MCAuto<DataArrayInt> ret=self->deepCopy();
4016 ret->applyLin(1,-val);
4021 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4022 return DataArrayInt::Substract(self,aaaa);
4026 return DataArrayInt::Substract(self,a);
4030 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4031 return DataArrayInt::Substract(self,aaaa);
4034 throw INTERP_KERNEL::Exception(msg);
4038 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4040 const char msg[]="Unexpected situation in __rsub__ !";
4043 std::vector<int> aa;
4044 DataArrayIntTuple *aaa;
4046 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4051 MCAuto<DataArrayInt> ret=self->deepCopy();
4052 ret->applyLin(-1,val);
4057 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4058 return DataArrayInt::Substract(aaaa,self);
4062 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4063 return DataArrayInt::Substract(aaaa,self);
4066 throw INTERP_KERNEL::Exception(msg);
4070 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4072 const char msg[]="Unexpected situation in __isub__ !";
4075 std::vector<int> aa;
4076 DataArrayIntTuple *aaa;
4078 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4083 self->applyLin(1,-val);
4084 Py_XINCREF(trueSelf);
4089 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4090 self->substractEqual(bb);
4091 Py_XINCREF(trueSelf);
4096 self->substractEqual(a);
4097 Py_XINCREF(trueSelf);
4102 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4103 self->substractEqual(aaaa);
4104 Py_XINCREF(trueSelf);
4108 throw INTERP_KERNEL::Exception(msg);
4112 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4114 const char msg[]="Unexpected situation in __mul__ !";
4117 std::vector<int> aa;
4118 DataArrayIntTuple *aaa;
4120 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4125 MCAuto<DataArrayInt> ret=self->deepCopy();
4126 ret->applyLin(val,0);
4131 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4132 return DataArrayInt::Multiply(self,aaaa);
4136 return DataArrayInt::Multiply(self,a);
4140 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4141 return DataArrayInt::Multiply(self,aaaa);
4144 throw INTERP_KERNEL::Exception(msg);
4148 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4150 const char msg[]="Unexpected situation in __rmul__ !";
4153 std::vector<int> aa;
4154 DataArrayIntTuple *aaa;
4156 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4161 MCAuto<DataArrayInt> ret=self->deepCopy();
4162 ret->applyLin(val,0);
4167 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4168 return DataArrayInt::Multiply(self,aaaa);
4172 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4173 return DataArrayInt::Multiply(self,aaaa);
4176 throw INTERP_KERNEL::Exception(msg);
4180 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4182 const char msg[]="Unexpected situation in __imul__ !";
4185 std::vector<int> aa;
4186 DataArrayIntTuple *aaa;
4188 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4193 self->applyLin(val,0);
4194 Py_XINCREF(trueSelf);
4199 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4200 self->multiplyEqual(bb);
4201 Py_XINCREF(trueSelf);
4206 self->multiplyEqual(a);
4207 Py_XINCREF(trueSelf);
4212 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4213 self->multiplyEqual(aaaa);
4214 Py_XINCREF(trueSelf);
4218 throw INTERP_KERNEL::Exception(msg);
4222 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4224 const char msg[]="Unexpected situation in __div__ !";
4227 std::vector<int> aa;
4228 DataArrayIntTuple *aaa;
4230 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4235 MCAuto<DataArrayInt> ret=self->deepCopy();
4236 ret->applyDivideBy(val);
4241 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4242 return DataArrayInt::Divide(self,aaaa);
4246 return DataArrayInt::Divide(self,a);
4250 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4251 return DataArrayInt::Divide(self,aaaa);
4254 throw INTERP_KERNEL::Exception(msg);
4258 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4260 const char msg[]="Unexpected situation in __rdiv__ !";
4263 std::vector<int> aa;
4264 DataArrayIntTuple *aaa;
4266 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4271 MCAuto<DataArrayInt> ret=self->deepCopy();
4277 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4278 return DataArrayInt::Divide(aaaa,self);
4282 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4283 return DataArrayInt::Divide(aaaa,self);
4286 throw INTERP_KERNEL::Exception(msg);
4290 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4292 const char msg[]="Unexpected situation in __idiv__ !";
4295 std::vector<int> aa;
4296 DataArrayIntTuple *aaa;
4298 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4303 self->applyDivideBy(val);
4304 Py_XINCREF(trueSelf);
4309 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4310 self->divideEqual(bb);
4311 Py_XINCREF(trueSelf);
4316 self->divideEqual(a);
4317 Py_XINCREF(trueSelf);
4322 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4323 self->divideEqual(aaaa);
4324 Py_XINCREF(trueSelf);
4328 throw INTERP_KERNEL::Exception(msg);
4332 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4334 const char msg[]="Unexpected situation in __mod__ !";
4337 std::vector<int> aa;
4338 DataArrayIntTuple *aaa;
4340 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4345 MCAuto<DataArrayInt> ret=self->deepCopy();
4346 ret->applyModulus(val);
4351 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4352 return DataArrayInt::Modulus(self,aaaa);
4356 return DataArrayInt::Modulus(self,a);
4360 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4361 return DataArrayInt::Modulus(self,aaaa);
4364 throw INTERP_KERNEL::Exception(msg);
4368 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4370 const char msg[]="Unexpected situation in __rmod__ !";
4373 std::vector<int> aa;
4374 DataArrayIntTuple *aaa;
4376 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4381 MCAuto<DataArrayInt> ret=self->deepCopy();
4382 ret->applyRModulus(val);
4387 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4388 return DataArrayInt::Modulus(aaaa,self);
4392 return DataArrayInt::Modulus(a,self);
4396 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4397 return DataArrayInt::Modulus(aaaa,self);
4400 throw INTERP_KERNEL::Exception(msg);
4404 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4406 const char msg[]="Unexpected situation in __imod__ !";
4409 std::vector<int> aa;
4410 DataArrayIntTuple *aaa;
4412 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4417 self->applyModulus(val);
4418 Py_XINCREF(trueSelf);
4423 self->modulusEqual(a);
4424 Py_XINCREF(trueSelf);
4429 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4430 self->modulusEqual(aaaa);
4431 Py_XINCREF(trueSelf);
4435 throw INTERP_KERNEL::Exception(msg);
4439 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4441 const char msg[]="Unexpected situation in __pow__ !";
4444 std::vector<int> aa;
4445 DataArrayIntTuple *aaa;
4447 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4452 MCAuto<DataArrayInt> ret=self->deepCopy();
4458 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4459 return DataArrayInt::Pow(self,aaaa);
4463 return DataArrayInt::Pow(self,a);
4467 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4468 return DataArrayInt::Pow(self,aaaa);
4471 throw INTERP_KERNEL::Exception(msg);
4475 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4477 const char msg[]="Unexpected situation in __rpow__ !";
4480 std::vector<int> aa;
4481 DataArrayIntTuple *aaa;
4483 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4488 MCAuto<DataArrayInt> ret=self->deepCopy();
4489 ret->applyRPow(val);
4494 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4495 return DataArrayInt::Pow(aaaa,self);
4499 return DataArrayInt::Pow(a,self);
4503 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4504 return DataArrayInt::Pow(aaaa,self);
4507 throw INTERP_KERNEL::Exception(msg);
4511 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4513 const char msg[]="Unexpected situation in __ipow__ !";
4516 std::vector<int> aa;
4517 DataArrayIntTuple *aaa;
4519 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4524 self->applyPow(val);
4525 Py_XINCREF(trueSelf);
4531 Py_XINCREF(trueSelf);
4536 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4537 self->powEqual(aaaa);
4538 Py_XINCREF(trueSelf);
4542 throw INTERP_KERNEL::Exception(msg);
4546 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4548 std::ostringstream oss;
4549 self->reprQuickOverview(oss);
4553 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4555 int szArr,sw,iTypppArr;
4556 std::vector<int> stdvecTyyppArr;
4557 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4558 self->pushBackValsSilent(tmp,tmp+szArr);
4561 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4563 std::vector<int> ret1;
4564 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4565 std::size_t sz=ret0.size();
4566 PyObject *pyRet=PyTuple_New(2);
4567 PyObject *pyRet0=PyList_New((int)sz);
4568 PyObject *pyRet1=PyList_New((int)sz);
4569 for(std::size_t i=0;i<sz;i++)
4571 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4572 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4574 PyTuple_SetItem(pyRet,0,pyRet0);
4575 PyTuple_SetItem(pyRet,1,pyRet1);
4579 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4581 DataArrayInt *ret0=0,*ret1=0;
4582 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4583 PyObject *pyRet=PyTuple_New(2);
4584 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4585 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4589 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4592 bool ret(self->isRange(a,b,c));
4593 PyObject *pyRet=PyTuple_New(2);
4594 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4596 PyTuple_SetItem(pyRet,0,ret0Py);
4598 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4604 PyTuple_SetItem(pyRet,1,ret1Py);
4609 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4611 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4614 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4617 if(!self->isAllocated())
4618 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4619 PyObject *ret(PyTuple_New(1));
4620 PyObject *ret0(PyDict_New());
4621 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4622 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4623 PyObject *tmp1(PyInt_FromLong(0));
4624 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4625 PyTuple_SetItem(ret,0,ret0);
4629 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4635 class DataArrayIntTuple;
4637 class DataArrayIntIterator
4640 DataArrayIntIterator(DataArrayInt *da);
4641 ~DataArrayIntIterator();
4646 DataArrayIntTuple *ret=self->nextt();
4648 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4651 PyErr_SetString(PyExc_StopIteration,"No more data.");
4658 class DataArrayIntTuple
4661 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4662 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4665 std::string __str__() const throw(INTERP_KERNEL::Exception)
4667 return self->repr();
4670 int __int__() const throw(INTERP_KERNEL::Exception)
4672 return self->intValue();
4675 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4677 return self->buildDAInt(1,self->getNumberOfCompo());
4680 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4682 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4683 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4684 Py_XINCREF(trueSelf);
4688 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4690 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4691 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4692 Py_XINCREF(trueSelf);
4696 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4698 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4699 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4700 Py_XINCREF(trueSelf);
4704 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4706 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4707 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4708 Py_XINCREF(trueSelf);
4712 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4714 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4715 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4716 Py_XINCREF(trueSelf);
4720 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4722 return PyInt_FromLong(self->getNumberOfCompo());
4725 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4727 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4730 std::vector<int> multiVal;
4731 std::pair<int, std::pair<int,int> > slic;
4732 MEDCoupling::DataArrayInt *daIntTyypp=0;
4733 const int *pt=self->getConstPointer();
4734 int nbc=self->getNumberOfCompo();
4735 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4742 std::ostringstream oss;
4743 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4744 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4748 return PyInt_FromLong(pt[singleVal]);
4752 return PyInt_FromLong(pt[nbc+singleVal]);
4755 std::ostringstream oss;
4756 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4757 throw INTERP_KERNEL::Exception(oss.str().c_str());
4763 PyObject *t=PyTuple_New(multiVal.size());
4764 for(int j=0;j<(int)multiVal.size();j++)
4766 int cid=multiVal[j];
4769 std::ostringstream oss;
4770 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4771 throw INTERP_KERNEL::Exception(oss.str().c_str());
4773 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4779 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4780 PyObject *t=PyTuple_New(sz);
4781 for(int j=0;j<sz;j++)
4782 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4786 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4790 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4792 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4793 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4796 std::vector<int> multiValV;
4797 std::pair<int, std::pair<int,int> > slicV;
4798 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4799 int nbc=self->getNumberOfCompo();
4800 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4802 std::vector<int> multiVal;
4803 std::pair<int, std::pair<int,int> > slic;
4804 MEDCoupling::DataArrayInt *daIntTyypp=0;
4805 int *pt=self->getPointer();
4806 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4813 std::ostringstream oss;
4814 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4815 throw INTERP_KERNEL::Exception(oss.str().c_str());
4821 pt[singleVal]=singleValV;
4826 if(multiValV.size()!=1)
4828 std::ostringstream oss;
4829 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4830 throw INTERP_KERNEL::Exception(oss.str().c_str());
4832 pt[singleVal]=multiValV[0];
4837 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4841 throw INTERP_KERNEL::Exception(msg);
4850 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4854 std::ostringstream oss;
4855 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4856 throw INTERP_KERNEL::Exception(oss.str().c_str());
4864 if(multiVal.size()!=multiValV.size())
4866 std::ostringstream oss;
4867 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4868 throw INTERP_KERNEL::Exception(oss.str().c_str());
4870 for(int i=0;i<(int)multiVal.size();i++)
4872 int pos=multiVal[i];
4875 std::ostringstream oss;
4876 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4877 throw INTERP_KERNEL::Exception(oss.str().c_str());
4879 pt[multiVal[i]]=multiValV[i];
4885 const int *ptV=daIntTyyppV->getConstPointer();
4886 if(nbc>daIntTyyppV->getNumberOfCompo())
4888 std::ostringstream oss;
4889 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4890 throw INTERP_KERNEL::Exception(oss.str().c_str());
4892 std::copy(ptV,ptV+nbc,pt);
4896 throw INTERP_KERNEL::Exception(msg);
4901 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4906 for(int j=0;j<sz;j++)
4907 pt[slic.first+j*slic.second.second]=singleValV;
4912 if(sz!=(int)multiValV.size())
4914 std::ostringstream oss;
4915 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4916 throw INTERP_KERNEL::Exception(oss.str().c_str());
4918 for(int j=0;j<sz;j++)
4919 pt[slic.first+j*slic.second.second]=multiValV[j];
4924 const int *ptV=daIntTyyppV->getConstPointer();
4925 if(sz>daIntTyyppV->getNumberOfCompo())
4927 std::ostringstream oss;
4928 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4929 throw INTERP_KERNEL::Exception(oss.str().c_str());
4931 for(int j=0;j<sz;j++)
4932 pt[slic.first+j*slic.second.second]=ptV[j];
4936 throw INTERP_KERNEL::Exception(msg);
4940 throw INTERP_KERNEL::Exception(msg);
4946 class DataArrayChar : public DataArray
4949 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4950 int getHashCode() const throw(INTERP_KERNEL::Exception);
4951 bool empty() const throw(INTERP_KERNEL::Exception);
4952 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4953 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4954 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4955 char popBackSilent() throw(INTERP_KERNEL::Exception);
4956 void pack() const throw(INTERP_KERNEL::Exception);
4957 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4958 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4959 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4960 void reverse() throw(INTERP_KERNEL::Exception);
4961 void fillWithZero() throw(INTERP_KERNEL::Exception);
4962 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4963 std::string repr() const throw(INTERP_KERNEL::Exception);
4964 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4965 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4966 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4967 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4968 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4969 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4970 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4971 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4972 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4973 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4974 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4975 char front() const throw(INTERP_KERNEL::Exception);
4976 char back() const throw(INTERP_KERNEL::Exception);
4977 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4978 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4979 char *getPointer() throw(INTERP_KERNEL::Exception);
4980 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4981 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4982 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4983 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4984 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4985 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4986 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4987 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4988 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4989 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4990 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4993 int __len__() const throw(INTERP_KERNEL::Exception)
4995 if(self->isAllocated())
4997 return self->getNumberOfTuples();
5001 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5005 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5008 bool ret0=self->isEqualIfNotWhy(other,ret1);
5009 PyObject *ret=PyTuple_New(2);
5010 PyObject *ret0Py=ret0?Py_True:Py_False;
5012 PyTuple_SetItem(ret,0,ret0Py);
5013 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5017 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5020 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5021 if (!SWIG_IsOK(res1))
5024 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5025 if(size!=self->getNumberOfTuples())
5027 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5029 return self->renumber(tmp);
5033 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5035 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5036 da2->checkAllocated();
5037 int size=self->getNumberOfTuples();
5038 if(size!=self->getNumberOfTuples())
5040 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5042 return self->renumber(da2->getConstPointer());
5046 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5049 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5050 if (!SWIG_IsOK(res1))
5053 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5054 if(size!=self->getNumberOfTuples())
5056 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5058 return self->renumberR(tmp);
5062 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5064 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5065 da2->checkAllocated();
5066 int size=self->getNumberOfTuples();
5067 if(size!=self->getNumberOfTuples())
5069 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5071 return self->renumberR(da2->getConstPointer());
5075 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5078 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5079 if (!SWIG_IsOK(res1))
5082 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5083 if(size!=self->getNumberOfTuples())
5085 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5087 return self->renumberAndReduce(tmp,newNbOfTuple);
5091 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5093 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5094 da2->checkAllocated();
5095 int size=self->getNumberOfTuples();
5096 if(size!=self->getNumberOfTuples())
5098 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5100 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5104 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5106 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5107 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5108 return DataArrayChar::Aggregate(tmp);
5111 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5113 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5114 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5115 return DataArrayChar::Meld(tmp);
5120 class DataArrayByteIterator;
5122 class DataArrayByte : public DataArrayChar
5125 static DataArrayByte *New();
5126 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5127 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5128 char byteValue() const throw(INTERP_KERNEL::Exception);
5131 DataArrayByte() throw(INTERP_KERNEL::Exception)
5133 return DataArrayByte::New();
5136 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5138 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) !";
5139 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5143 if(PyInt_Check(nbOfTuples))
5145 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5147 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5150 if(PyInt_Check(nbOfComp))
5151 {//DataArrayByte.New([1,3,4,5],2,2)
5152 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5154 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5155 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5156 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5157 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5161 throw INTERP_KERNEL::Exception(msg);
5164 {//DataArrayByte.New([1,3,4],3)
5165 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5167 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5168 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5173 throw INTERP_KERNEL::Exception(msg);
5176 {// DataArrayByte.New([1,3,4])
5177 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5178 int tmpp1=-1,tmpp2=-1;
5179 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5180 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5184 else if(PyInt_Check(elt0))
5186 int nbOfTuples1=PyInt_AS_LONG(elt0);
5188 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5193 if(PyInt_Check(nbOfTuples))
5194 {//DataArrayByte.New(5,2)
5195 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5197 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5198 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5199 ret->alloc(nbOfTuples1,nbOfCompo);
5203 throw INTERP_KERNEL::Exception(msg);
5206 throw INTERP_KERNEL::Exception(msg);
5209 {//DataArrayByte.New(5)
5210 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5211 ret->alloc(nbOfTuples1,1);
5216 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5217 {//DataArrayDouble.New(numpyArray)
5218 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5222 throw INTERP_KERNEL::Exception(msg);
5225 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5227 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5230 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5232 std::ostringstream oss;
5233 self->reprQuickOverview(oss);
5237 int __int__() const throw(INTERP_KERNEL::Exception)
5239 return (int) self->byteValue();
5242 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5244 return self->iterator();
5247 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5249 return (int)self->getIJ(tupleId,compoId);
5252 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5254 return (int)self->getIJSafe(tupleId,compoId);
5257 std::string __str__() const throw(INTERP_KERNEL::Exception)
5259 return self->repr();
5262 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5264 const char *vals=self->getConstPointer();
5265 int nbOfComp=self->getNumberOfComponents();
5266 int nbOfTuples=self->getNumberOfTuples();
5267 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5270 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5273 int ival=-1; std::vector<int> ivval;
5274 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5275 std::vector<char> vals(sz);
5276 std::copy(pt,pt+sz,vals.begin());
5277 return self->presenceOfTuple(vals);
5280 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5283 int ival=-1; std::vector<int> ivval;
5284 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5285 std::vector<char> vals2(sz);
5286 std::copy(pt,pt+sz,vals2.begin());
5287 return self->presenceOfValue(vals2);
5290 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5293 int ival=-1; std::vector<int> ivval;
5294 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5295 std::vector<char> vals2(sz);
5296 std::copy(pt,pt+sz,vals2.begin());
5297 return self->findIdFirstEqual(vals2);
5300 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5303 int ival=-1; std::vector<int> ivval;
5304 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5305 std::vector<char> vals(sz);
5306 std::copy(pt,pt+sz,vals.begin());
5307 return self->findIdFirstEqualTuple(vals);
5310 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5313 int ival=-1; std::vector<int> ivval;
5314 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5315 std::vector<char> vals(sz);
5316 std::copy(pt,pt+sz,vals.begin());
5317 return self->findIdSequence(vals);
5320 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5322 int sz=self->getNumberOfComponents();
5323 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5324 self->getTuple(tupleId,tmp);
5325 PyObject *ret=PyTuple_New(sz);
5326 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5330 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5333 int r1=(int)self->getMaxValue(tmp);
5334 PyObject *ret=PyTuple_New(2);
5335 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5336 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5340 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5343 int r1=(int)self->getMinValue(tmp);
5344 PyObject *ret=PyTuple_New(2);
5345 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5346 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5350 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5352 int nbOfCompo=self->getNumberOfComponents();
5357 if(PyInt_Check(obj))
5359 int val=(int)PyInt_AS_LONG(obj);
5360 return self->findIdFirstEqual(val);
5363 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5366 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5370 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5372 int nbOfCompo=self->getNumberOfComponents();
5379 if(PyInt_Check(obj))
5381 int val=(int)PyInt_AS_LONG(obj);
5382 return self->presenceOfValue(val);
5385 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5388 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5393 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5395 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5400 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5402 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5405 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5408 if(!self->isAllocated())
5409 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5410 PyObject *ret(PyTuple_New(1));
5411 PyObject *ret0(PyDict_New());
5412 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5413 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5414 PyObject *tmp1(PyInt_FromLong(0));
5415 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5416 PyTuple_SetItem(ret,0,ret0);
5420 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5424 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5426 self->checkAllocated();
5427 const char msg[]="Unexpected situation in __setitem__ !";
5428 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5431 std::vector<int> v1;
5433 DataArrayIntTuple *dd1=0;
5434 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5436 std::vector<int> vt1,vc1;
5437 std::pair<int, std::pair<int,int> > pt1,pc1;
5438 DataArrayInt *dt1=0,*dc1=0;
5439 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5440 MCAuto<DataArrayInt> tmp;
5448 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5451 throw INTERP_KERNEL::Exception(msg);
5460 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5463 throw INTERP_KERNEL::Exception(msg);
5472 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5475 throw INTERP_KERNEL::Exception(msg);
5484 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5487 throw INTERP_KERNEL::Exception(msg);
5496 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5499 throw INTERP_KERNEL::Exception(msg);
5508 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5511 throw INTERP_KERNEL::Exception(msg);
5520 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5523 throw INTERP_KERNEL::Exception(msg);
5532 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5535 throw INTERP_KERNEL::Exception(msg);
5544 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5547 throw INTERP_KERNEL::Exception(msg);
5556 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5559 throw INTERP_KERNEL::Exception(msg);
5568 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5571 throw INTERP_KERNEL::Exception(msg);
5580 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5583 throw INTERP_KERNEL::Exception(msg);
5592 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5595 throw INTERP_KERNEL::Exception(msg);
5604 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5607 throw INTERP_KERNEL::Exception(msg);
5616 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5619 throw INTERP_KERNEL::Exception(msg);
5628 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5631 throw INTERP_KERNEL::Exception(msg);
5636 throw INTERP_KERNEL::Exception(msg);
5643 class DataArrayByteTuple;
5645 class DataArrayByteIterator
5648 DataArrayByteIterator(DataArrayByte *da);
5649 ~DataArrayByteIterator();
5652 class DataArrayByteTuple
5655 std::string repr() const throw(INTERP_KERNEL::Exception);
5656 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5659 std::string __str__() const throw(INTERP_KERNEL::Exception)
5661 return self->repr();
5664 char __int__() const throw(INTERP_KERNEL::Exception)
5666 return self->byteValue();
5669 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5671 return self->buildDAByte(1,self->getNumberOfCompo());
5676 class DataArrayAsciiCharIterator;
5678 class DataArrayAsciiChar : public DataArrayChar
5681 static DataArrayAsciiChar *New();
5682 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5683 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5684 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5687 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5689 return DataArrayAsciiChar::New();
5692 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5694 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) !";
5695 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5699 if(PyInt_Check(nbOfTuples))
5701 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5703 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5706 if(PyInt_Check(nbOfComp))
5707 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5708 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5710 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5711 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5712 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5713 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5717 throw INTERP_KERNEL::Exception(msg);
5720 {//DataArrayAsciiChar.New([1,3,4],3)
5721 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5723 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5724 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5728 else if(PyString_Check(nbOfTuples))
5730 if(PyString_Size(nbOfTuples)!=1)
5731 throw INTERP_KERNEL::Exception(msg);
5732 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5733 std::vector<std::string> tmp;
5734 if(fillStringVector(elt0,tmp))
5735 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5737 throw INTERP_KERNEL::Exception(msg);
5740 throw INTERP_KERNEL::Exception(msg);
5744 std::vector<std::string> tmmp;
5745 if(fillStringVector(elt0,tmmp))
5746 //DataArrayAsciiChar.New(["abc","de","fghi"])
5747 return DataArrayAsciiChar::New(tmmp,' ');
5750 // DataArrayAsciiChar.New([1,3,4])
5751 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5752 int tmpp1=-1,tmpp2=-1;
5753 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5754 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5759 else if(PyInt_Check(elt0))
5761 int nbOfTuples1=PyInt_AS_LONG(elt0);
5763 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5768 if(PyInt_Check(nbOfTuples))
5769 {//DataArrayAsciiChar.New(5,2)
5770 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5772 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5773 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5774 ret->alloc(nbOfTuples1,nbOfCompo);
5778 throw INTERP_KERNEL::Exception(msg);
5781 throw INTERP_KERNEL::Exception(msg);
5784 {//DataArrayAsciiChar.New(5)
5785 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5786 ret->alloc(nbOfTuples1,1);
5791 throw INTERP_KERNEL::Exception(msg);
5794 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5796 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5799 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5801 std::ostringstream oss;
5802 self->reprQuickOverview(oss);
5806 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5808 return self->iterator();
5811 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5813 char tmp[2]; tmp[1]='\0';
5814 tmp[0]=self->getIJ(tupleId,compoId);
5815 return std::string(tmp);
5818 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5820 char tmp[2]; tmp[1]='\0';
5821 tmp[0]=self->getIJSafe(tupleId,compoId);
5822 return std::string(tmp);
5825 std::string __str__() const throw(INTERP_KERNEL::Exception)
5827 return self->repr();
5830 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5832 const char *vals=self->getConstPointer();
5833 int nbOfComp=self->getNumberOfComponents();
5834 int nbOfTuples=self->getNumberOfTuples();
5835 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5838 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5840 if(PyString_Check(tupl))
5842 Py_ssize_t sz=PyString_Size(tupl);
5843 std::vector<char> vals(sz);
5844 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5845 return self->presenceOfTuple(vals);
5848 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5851 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5853 if(PyString_Check(vals))
5855 Py_ssize_t sz=PyString_Size(vals);
5856 std::vector<char> vals2(sz);
5857 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5858 return self->presenceOfValue(vals2);
5861 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5864 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5866 if(PyString_Check(vals))
5868 Py_ssize_t sz=PyString_Size(vals);
5869 std::vector<char> vals2(sz);
5870 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5871 return self->findIdFirstEqual(vals2);
5874 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5877 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5879 if(PyString_Check(tupl))
5881 Py_ssize_t sz=PyString_Size(tupl);
5882 std::vector<char> vals(sz);
5883 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5884 return self->findIdFirstEqualTuple(vals);
5887 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5890 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5892 if(PyString_Check(strOrListOfInt))
5894 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5895 std::vector<char> vals(sz);
5896 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5897 return self->findIdSequence(vals);
5900 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5903 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5905 int sz=self->getNumberOfComponents();
5906 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5907 self->getTuple(tupleId,tmp);
5908 return PyString_FromString(tmp);
5911 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5914 char tmp2[2]; tmp2[1]='\0';
5915 tmp2[0]=self->getMaxValue(tmp);
5916 PyObject *ret=PyTuple_New(2);
5917 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5918 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5922 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5925 char tmp2[2]; tmp2[1]='\0';
5926 tmp2[0]=self->getMinValue(tmp);
5927 PyObject *ret=PyTuple_New(2);
5928 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5929 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5933 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5935 int nbOfCompo=self->getNumberOfComponents();
5940 if(PyString_Check(obj))
5942 Py_ssize_t sz=PyString_Size(obj);
5943 char *pt=PyString_AsString(obj);
5945 return self->findIdFirstEqual(pt[0]);
5947 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5950 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5953 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5957 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5959 int nbOfCompo=self->getNumberOfComponents();
5966 if(PyString_Check(obj))
5968 Py_ssize_t sz=PyString_Size(obj);
5969 char *pt=PyString_AsString(obj);
5971 return self->presenceOfValue(pt[0]);
5973 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5976 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5979 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5983 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5986 std::vector<int> stdvecTyyppArr;
5987 std::pair<int, std::pair<int,int> > sTyyppArr;
5988 MEDCoupling::DataArrayInt *daIntTyypp=0;
5989 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5993 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5995 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5997 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5999 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
6001 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6005 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6007 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.";
6009 std::vector<int> stdvecTyyppArr;
6010 std::pair<int, std::pair<int,int> > sTyyppArr;
6011 MEDCoupling::DataArrayInt *daIntTyypp=0;
6012 int nbOfCompo=self->getNumberOfComponents();
6013 int nbOfTuples=self->getNumberOfTuples();
6014 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6016 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6017 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6026 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6032 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6033 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6036 //value vector<string>
6039 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6040 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6043 //value DataArrayChar
6046 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6050 throw INTERP_KERNEL::Exception(msg);
6054 {//obj list-tuple[int]
6060 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6066 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6067 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6070 //value vector<string>
6073 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6074 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6077 //value DataArrayChar
6080 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6084 throw INTERP_KERNEL::Exception(msg);
6095 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6101 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6102 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6105 //value vector<string>
6108 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6109 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6112 //value DataArrayChar
6115 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6119 throw INTERP_KERNEL::Exception(msg);
6130 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6136 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6137 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6140 //value vector<string>
6143 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6144 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6147 //value DataArrayChar
6150 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6154 throw INTERP_KERNEL::Exception(msg);
6159 throw INTERP_KERNEL::Exception(msg);
6165 class DataArrayAsciiCharTuple;
6167 class DataArrayAsciiCharIterator
6170 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6171 ~DataArrayAsciiCharIterator();
6176 DataArrayAsciiCharTuple *ret=self->nextt();
6178 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6181 PyErr_SetString(PyExc_StopIteration,"No more data.");
6188 class DataArrayAsciiCharTuple
6191 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6192 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6195 std::string __str__() const throw(INTERP_KERNEL::Exception)
6197 return self->repr();
6200 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6202 return self->buildDAAsciiChar(1,self->getNumberOfCompo());