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 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
254 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
255 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
256 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
257 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
258 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
259 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
260 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
261 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
262 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
263 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
264 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
265 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
266 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
267 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
268 void updateTime() const;
271 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
273 const std::vector<std::string>& comps=self->getInfoOnComponents();
274 PyObject *ret=PyList_New((int)comps.size());
275 for(int i=0;i<(int)comps.size();i++)
276 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
280 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
282 std::vector<int> tmp;
283 convertPyToNewIntArr3(li,tmp);
284 self->copyPartOfStringInfoFrom(other,tmp);
287 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
289 std::vector<int> tmp;
290 convertPyToNewIntArr3(li,tmp);
291 self->copyPartOfStringInfoFrom2(tmp,other);
294 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
297 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
298 if (!SWIG_IsOK(res1))
301 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
302 if(size!=self->getNumberOfTuples())
304 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
306 self->renumberInPlace(tmp);
310 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
312 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
313 da2->checkAllocated();
314 int size=self->getNumberOfTuples();
315 if(size!=self->getNumberOfTuples())
317 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
319 self->renumberInPlace(da2->getConstPointer());
323 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
326 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
327 if (!SWIG_IsOK(res1))
330 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
331 if(size!=self->getNumberOfTuples())
333 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
335 self->renumberInPlaceR(tmp);
339 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
341 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
342 da2->checkAllocated();
343 int size=self->getNumberOfTuples();
344 if(size!=self->getNumberOfTuples())
346 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
348 self->renumberInPlaceR(da2->getConstPointer());
352 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
353 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
355 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
356 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
357 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
358 DataArrayInt *tuplesSelecPtr2=0;
361 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
363 throw INTERP_KERNEL::Exception(msg);
365 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
368 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
370 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
371 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
374 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
376 std::vector<std::pair<int,int> > ranges;
377 convertPyToVectorPairInt(li,ranges);
378 return self->selectByTupleRanges(ranges);
381 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
384 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
385 if (!SWIG_IsOK(res1))
388 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
389 return self->selectByTupleId(tmp,tmp+size);
393 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
395 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
396 da2->checkAllocated();
397 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
401 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
404 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
405 if (!SWIG_IsOK(res1))
408 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
409 return self->selectByTupleIdSafe(tmp,tmp+size);
413 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
415 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
416 da2->checkAllocated();
417 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
421 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
423 std::vector<int> tmp;
424 convertPyToNewIntArr3(li,tmp);
425 DataArray *ret=self->keepSelectedComponents(tmp);
426 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
429 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
431 if(!PySlice_Check(slic))
432 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
433 Py_ssize_t strt=2,stp=2,step=2;
434 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
435 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
437 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
438 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
441 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
443 if(!PySlice_Check(slic))
444 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
445 Py_ssize_t strt=2,stp=2,step=2;
446 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
447 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
449 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
450 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
453 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
455 if(!PySlice_Check(slic))
456 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
457 Py_ssize_t strt=2,stp=2,step=2;
458 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
459 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
460 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
463 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
465 if(!PySlice_Check(slic))
466 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
467 Py_ssize_t strt=2,stp=2,step=2;
468 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
469 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
470 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
473 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
475 std::vector<const DataArray *> tmp;
476 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
477 return DataArray::Aggregate(tmp);
480 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
482 if(!PySlice_Check(slic))
483 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
484 Py_ssize_t strt=2,stp=2,step=2;
485 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
486 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
487 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
490 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
492 if(!PySlice_Check(slic))
493 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
494 Py_ssize_t strt=2,stp=2,step=2;
495 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
496 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
497 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
500 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
502 PyObject *ret(PyTuple_New(2));
503 std::string a0(self->getName());
504 const std::vector<std::string> &a1(self->getInfoOnComponents());
505 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
508 PyObject *ret1(PyList_New(sz));
509 for(int i=0;i<sz;i++)
510 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
511 PyTuple_SetItem(ret,1,ret1);
516 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
518 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 !";
519 if(!PyTuple_Check(inp))
520 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
521 int sz(PyTuple_Size(inp));
523 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
524 PyObject *a0(PyTuple_GetItem(inp,0));
525 if(!PyString_Check(a0))
526 throw INTERP_KERNEL::Exception(MSG);
527 PyObject *a1(PyTuple_GetItem(inp,1));
528 std::vector<std::string> a1cpp;
529 if(!fillStringVector(a1,a1cpp))
530 throw INTERP_KERNEL::Exception(MSG);
531 self->setName(PyString_AsString(a0));
532 self->setInfoOnComponents(a1cpp);
538 class DataArrayDoubleIterator;
540 class DataArrayDouble : public DataArray
543 static DataArrayDouble *New();
544 double doubleValue() const throw(INTERP_KERNEL::Exception);
545 bool empty() const throw(INTERP_KERNEL::Exception);
546 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
548 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
549 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
550 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
551 double popBackSilent() throw(INTERP_KERNEL::Exception);
552 void pack() const throw(INTERP_KERNEL::Exception);
553 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
554 void fillWithZero() throw(INTERP_KERNEL::Exception);
555 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
556 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
557 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
558 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
559 void reverse() throw(INTERP_KERNEL::Exception);
560 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
561 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
562 std::string repr() const throw(INTERP_KERNEL::Exception);
563 std::string reprZip() const throw(INTERP_KERNEL::Exception);
564 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
565 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
566 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
567 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
570 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
571 void transpose() throw(INTERP_KERNEL::Exception);
572 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
573 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
574 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
575 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
576 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
577 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
578 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
579 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
580 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
581 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
582 double front() const throw(INTERP_KERNEL::Exception);
583 double back() const throw(INTERP_KERNEL::Exception);
584 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
585 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
586 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
587 double *getPointer() throw(INTERP_KERNEL::Exception);
588 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
590 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
591 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
592 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
593 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
594 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
595 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
596 double getAverageValue() const throw(INTERP_KERNEL::Exception);
597 double norm2() const throw(INTERP_KERNEL::Exception);
598 double normMax() const throw(INTERP_KERNEL::Exception);
599 double normMin() const throw(INTERP_KERNEL::Exception);
600 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
609 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
610 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
611 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
612 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
613 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
617 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
620 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
621 void abs() throw(INTERP_KERNEL::Exception);
622 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
623 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
624 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
625 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
626 void applyPow(double val) throw(INTERP_KERNEL::Exception);
627 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
628 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
629 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
630 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
631 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
632 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
633 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
634 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
635 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
636 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
637 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
638 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
639 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
640 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
641 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
642 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
643 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
644 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
645 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
646 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
647 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
648 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
649 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
650 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
651 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
652 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
653 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
654 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
657 DataArrayDouble() throw(INTERP_KERNEL::Exception)
659 return DataArrayDouble::New();
662 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
664 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)";
665 std::string msg(msgBase);
667 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
670 if(PyList_Check(elt0) || PyTuple_Check(elt0))
674 if(PyInt_Check(nbOfTuples))
676 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
678 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
681 if(PyInt_Check(elt2))
682 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
683 int nbOfCompo=PyInt_AS_LONG(elt2);
685 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
686 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
687 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
688 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
692 throw INTERP_KERNEL::Exception(msg.c_str());
695 {//DataArrayDouble.New([1.,3.,4.],3)
696 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
698 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
699 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
704 throw INTERP_KERNEL::Exception(msg.c_str());
707 {// DataArrayDouble.New([1.,3.,4.])
708 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
709 int tmpp1=-1,tmpp2=-1;
710 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
711 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
715 else if(PyInt_Check(elt0))
717 int nbOfTuples1=PyInt_AS_LONG(elt0);
719 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
724 if(PyInt_Check(nbOfTuples))
725 {//DataArrayDouble.New(5,2)
726 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
728 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
729 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
730 ret->alloc(nbOfTuples1,nbOfCompo);
734 throw INTERP_KERNEL::Exception(msg.c_str());
737 throw INTERP_KERNEL::Exception(msg.c_str());
740 {//DataArrayDouble.New(5)
741 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
742 ret->alloc(nbOfTuples1,1);
747 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
748 {//DataArrayDouble.New(numpyArray)
749 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
753 throw INTERP_KERNEL::Exception(msg.c_str());
754 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
757 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
759 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
762 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
765 std::vector<double> bb;
767 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
768 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
769 self->pushBackValsSilent(tmp,tmp+nbTuples);
772 std::string __repr__() const throw(INTERP_KERNEL::Exception)
774 std::ostringstream oss;
775 self->reprQuickOverview(oss);
779 std::string __str__() const throw(INTERP_KERNEL::Exception)
781 return self->reprNotTooLong();
784 double __float__() const throw(INTERP_KERNEL::Exception)
786 return self->doubleValue();
789 int __len__() const throw(INTERP_KERNEL::Exception)
791 if(self->isAllocated())
793 return self->getNumberOfTuples();
797 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
801 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
803 return self->iterator();
806 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
808 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 !";
809 if(PyList_Check(li) || PyTuple_Check(li))
813 if(PyInt_Check(nbOfTuples))
815 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
817 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
820 if(PyInt_Check(nbOfComp))
821 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
822 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
824 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
825 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
826 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
829 throw INTERP_KERNEL::Exception(msg);
832 {//DataArrayDouble.setValues([1.,3.,4.],3)
834 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
835 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
839 throw INTERP_KERNEL::Exception(msg);
842 {// DataArrayDouble.setValues([1.,3.,4.])
843 int tmpp1=-1,tmpp2=-1;
844 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
845 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
849 throw INTERP_KERNEL::Exception(msg);
852 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
854 const double *vals=self->getConstPointer();
855 return convertDblArrToPyList(vals,self->getNbOfElems());
859 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
861 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
865 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
868 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
869 PyObject *ret=PyTuple_New(2);
870 PyObject *ret0Py=ret0?Py_True:Py_False;
872 PyTuple_SetItem(ret,0,ret0Py);
873 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
877 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
879 const double *vals=self->getConstPointer();
880 int nbOfComp=self->getNumberOfComponents();
881 int nbOfTuples=self->getNumberOfTuples();
882 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
885 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
887 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
889 DataArrayDouble *a,*a2;
890 DataArrayDoubleTuple *aa,*aa2;
891 std::vector<double> bb,bb2;
893 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
894 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
895 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
899 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
901 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
903 DataArrayDouble *a,*a2;
904 DataArrayDoubleTuple *aa,*aa2;
905 std::vector<double> bb,bb2;
907 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
909 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
910 return convertDblArrToPyListOfTuple(res,3,3);
913 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
915 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
917 DataArrayDouble *a,*a2;
918 DataArrayDoubleTuple *aa,*aa2;
919 std::vector<double> bb,bb2;
921 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
922 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
923 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
926 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
929 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
930 if (!SWIG_IsOK(res1))
933 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
934 if(size!=self->getNumberOfTuples())
936 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
938 return self->renumber(tmp);
942 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
944 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
945 da2->checkAllocated();
946 int size=self->getNumberOfTuples();
947 if(size!=self->getNumberOfTuples())
949 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
951 return self->renumber(da2->getConstPointer());
955 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
958 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
959 if (!SWIG_IsOK(res1))
962 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
963 if(size!=self->getNumberOfTuples())
965 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
967 return self->renumberR(tmp);
971 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
973 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
974 da2->checkAllocated();
975 int size=self->getNumberOfTuples();
976 if(size!=self->getNumberOfTuples())
978 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
980 return self->renumberR(da2->getConstPointer());
984 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
987 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
988 if (!SWIG_IsOK(res1))
991 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
992 if(size!=self->getNumberOfTuples())
994 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
996 return self->renumberAndReduce(tmp,newNbOfTuple);
1000 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1002 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1003 da2->checkAllocated();
1004 int size=self->getNumberOfTuples();
1005 if(size!=self->getNumberOfTuples())
1007 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1009 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1013 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1015 int thisTupleId,otherTupleId;
1016 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1017 PyObject *ret=PyTuple_New(3);
1018 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1019 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1020 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1024 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1027 double r1=self->getMaxValue(tmp);
1028 PyObject *ret=PyTuple_New(2);
1029 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1030 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1034 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1037 double r1=self->getMaxValue2(tmp);
1038 PyObject *ret=PyTuple_New(2);
1039 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1040 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1044 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1047 double r1=self->getMinValue(tmp);
1048 PyObject *ret=PyTuple_New(2);
1049 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1050 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1054 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1057 double r1=self->getMinValue2(tmp);
1058 PyObject *ret=PyTuple_New(2);
1059 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1060 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1064 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1066 int nbOfCompo=self->getNumberOfComponents();
1067 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1068 self->getMinMaxPerComponent(tmp);
1069 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1073 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1075 int sz=self->getNumberOfComponents();
1076 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1077 self->accumulate(tmp);
1078 return convertDblArrToPyList(tmp,sz);
1081 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1084 std::vector<int> val2;
1085 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1086 return self->accumulatePerChunck(bg,bg+sz);
1089 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1091 DataArrayInt *comm, *commIndex;
1092 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1093 PyObject *res = PyList_New(2);
1094 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1095 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1099 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1103 DataArrayDoubleTuple *aa;
1104 std::vector<double> bb;
1106 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1107 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1109 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1110 PyObject *ret=PyTuple_New(2);
1111 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1112 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1116 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1118 std::vector<int> tmp;
1119 convertPyToNewIntArr3(li,tmp);
1120 self->setSelectedComponents(a,tmp);
1123 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1125 int sz=self->getNumberOfComponents();
1126 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1127 self->getTuple(tupleId,tmp);
1128 return convertDblArrToPyList(tmp,sz);
1131 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1133 std::vector<const DataArrayDouble *> tmp;
1134 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1135 return DataArrayDouble::Aggregate(tmp);
1138 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1140 std::vector<const DataArrayDouble *> tmp;
1141 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1142 return DataArrayDouble::Meld(tmp);
1145 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1149 DataArrayDoubleTuple *aa;
1150 std::vector<double> bb;
1152 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1153 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1154 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1155 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1156 DataArrayInt *c=0,*cI=0;
1157 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1158 PyObject *ret=PyTuple_New(2);
1159 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1160 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1164 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1166 DataArrayInt *ret1=0;
1167 bool ret0=self->areIncludedInMe(other,prec,ret1);
1168 PyObject *ret=PyTuple_New(2);
1169 PyObject *ret0Py=ret0?Py_True:Py_False;
1171 PyTuple_SetItem(ret,0,ret0Py);
1172 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1176 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1178 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1179 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1180 self->checkAllocated();
1181 int nbOfTuples=self->getNumberOfTuples();
1182 int nbOfComponents=self->getNumberOfComponents();
1184 std::vector<int> vt1,vc1;
1185 std::pair<int, std::pair<int,int> > pt1,pc1;
1186 DataArrayInt *dt1=0,*dc1=0;
1188 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1189 MCAuto<DataArrayDouble> ret;
1193 if(nbOfComponents==1)
1194 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1195 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1197 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1199 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1201 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1203 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1206 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1207 std::vector<int> v2(1,ic1);
1208 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1212 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1213 std::vector<int> v2(1,ic1);
1214 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1218 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1219 std::vector<int> v2(1,ic1);
1220 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1224 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1225 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1229 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1230 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1234 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1235 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1239 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1240 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1244 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1245 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1246 std::vector<int> v2(nbOfComp);
1247 for(int i=0;i<nbOfComp;i++)
1248 v2[i]=pc1.first+i*pc1.second.second;
1249 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1253 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1254 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1255 std::vector<int> v2(nbOfComp);
1256 for(int i=0;i<nbOfComp;i++)
1257 v2[i]=pc1.first+i*pc1.second.second;
1258 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1262 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1263 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1264 std::vector<int> v2(nbOfComp);
1265 for(int i=0;i<nbOfComp;i++)
1266 v2[i]=pc1.first+i*pc1.second.second;
1267 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1271 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1272 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1273 std::vector<int> v2(nbOfComp);
1274 for(int i=0;i<nbOfComp;i++)
1275 v2[i]=pc1.first+i*pc1.second.second;
1276 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1279 throw INTERP_KERNEL::Exception(msg);
1283 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1285 self->checkAllocated();
1286 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1287 int nbOfTuples=self->getNumberOfTuples();
1288 int nbOfComponents=self->getNumberOfComponents();
1291 std::vector<double> v1;
1292 DataArrayDouble *d1=0;
1293 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1295 std::vector<int> vt1,vc1;
1296 std::pair<int, std::pair<int,int> > pt1,pc1;
1297 DataArrayInt *dt1=0,*dc1=0;
1298 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1299 MCAuto<DataArrayDouble> tmp;
1307 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1310 tmp=DataArrayDouble::New();
1311 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1312 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1315 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1318 throw INTERP_KERNEL::Exception(msg);
1327 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1330 tmp=DataArrayDouble::New();
1331 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1332 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1335 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1338 throw INTERP_KERNEL::Exception(msg);
1347 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1350 tmp=DataArrayDouble::New();
1351 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1352 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1355 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1358 throw INTERP_KERNEL::Exception(msg);
1367 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1370 tmp=DataArrayDouble::New();
1371 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1372 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1375 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1378 throw INTERP_KERNEL::Exception(msg);
1387 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1390 tmp=DataArrayDouble::New();
1391 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1392 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1395 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1398 throw INTERP_KERNEL::Exception(msg);
1407 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1410 tmp=DataArrayDouble::New();
1411 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1412 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1415 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1418 throw INTERP_KERNEL::Exception(msg);
1427 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1430 tmp=DataArrayDouble::New();
1431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1432 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1435 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1438 throw INTERP_KERNEL::Exception(msg);
1447 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1450 tmp=DataArrayDouble::New();
1451 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1452 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1455 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1458 throw INTERP_KERNEL::Exception(msg);
1467 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1470 tmp=DataArrayDouble::New();
1471 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1472 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1475 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1478 throw INTERP_KERNEL::Exception(msg);
1487 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1490 tmp=DataArrayDouble::New();
1491 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1492 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1495 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1498 throw INTERP_KERNEL::Exception(msg);
1507 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1510 tmp=DataArrayDouble::New();
1511 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1512 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1515 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1518 throw INTERP_KERNEL::Exception(msg);
1527 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1530 tmp=DataArrayDouble::New();
1531 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1532 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1535 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1538 throw INTERP_KERNEL::Exception(msg);
1547 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1550 tmp=DataArrayDouble::New();
1551 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1552 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1555 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1558 throw INTERP_KERNEL::Exception(msg);
1567 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1570 tmp=DataArrayDouble::New();
1571 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1572 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1575 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1578 throw INTERP_KERNEL::Exception(msg);
1587 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1590 tmp=DataArrayDouble::New();
1591 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1592 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1595 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1598 throw INTERP_KERNEL::Exception(msg);
1607 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1610 tmp=DataArrayDouble::New();
1611 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1612 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1615 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1618 throw INTERP_KERNEL::Exception(msg);
1623 throw INTERP_KERNEL::Exception(msg);
1628 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1630 return self->negate();
1633 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1635 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1638 DataArrayDoubleTuple *aa;
1639 std::vector<double> bb;
1642 #ifndef WITHOUT_AUTOFIELD
1644 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1646 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1649 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1650 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1652 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1655 throw INTERP_KERNEL::Exception(msg);
1659 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1664 MCAuto<DataArrayDouble> ret=self->deepCopy();
1665 ret->applyLin(1.,val);
1666 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1670 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1674 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1675 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1679 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1680 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1683 throw INTERP_KERNEL::Exception(msg);
1687 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1689 const char msg[]="Unexpected situation in __radd__ !";
1692 DataArrayDoubleTuple *aa;
1693 std::vector<double> bb;
1695 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1700 MCAuto<DataArrayDouble> ret=self->deepCopy();
1701 ret->applyLin(1.,val);
1706 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1707 return DataArrayDouble::Add(self,aaa);
1711 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1712 return DataArrayDouble::Add(self,aaa);
1715 throw INTERP_KERNEL::Exception(msg);
1719 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1721 const char msg[]="Unexpected situation in __iadd__ !";
1724 DataArrayDoubleTuple *aa;
1725 std::vector<double> bb;
1727 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1732 self->applyLin(1.,val);
1733 Py_XINCREF(trueSelf);
1739 Py_XINCREF(trueSelf);
1744 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1745 self->addEqual(aaa);
1746 Py_XINCREF(trueSelf);
1751 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1752 self->addEqual(aaa);
1753 Py_XINCREF(trueSelf);
1757 throw INTERP_KERNEL::Exception(msg);
1761 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1763 const char msg[]="Unexpected situation in __sub__ !";
1766 DataArrayDoubleTuple *aa;
1767 std::vector<double> bb;
1770 #ifndef WITHOUT_AUTOFIELD
1772 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1774 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1777 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1778 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1780 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1783 throw INTERP_KERNEL::Exception(msg);
1787 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1792 MCAuto<DataArrayDouble> ret=self->deepCopy();
1793 ret->applyLin(1.,-val);
1794 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1798 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1802 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1803 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1807 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1808 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1811 throw INTERP_KERNEL::Exception(msg);
1815 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1817 const char msg[]="Unexpected situation in __rsub__ !";
1820 DataArrayDoubleTuple *aa;
1821 std::vector<double> bb;
1823 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1828 MCAuto<DataArrayDouble> ret=self->deepCopy();
1829 ret->applyLin(-1.,val);
1834 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1835 return DataArrayDouble::Substract(aaa,self);
1839 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1840 return DataArrayDouble::Substract(aaa,self);
1843 throw INTERP_KERNEL::Exception(msg);
1847 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1849 const char msg[]="Unexpected situation in __isub__ !";
1852 DataArrayDoubleTuple *aa;
1853 std::vector<double> bb;
1855 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1860 self->applyLin(1,-val);
1861 Py_XINCREF(trueSelf);
1866 self->substractEqual(a);
1867 Py_XINCREF(trueSelf);
1872 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1873 self->substractEqual(aaa);
1874 Py_XINCREF(trueSelf);
1879 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1880 self->substractEqual(aaa);
1881 Py_XINCREF(trueSelf);
1885 throw INTERP_KERNEL::Exception(msg);
1889 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1891 const char msg[]="Unexpected situation in __mul__ !";
1894 DataArrayDoubleTuple *aa;
1895 std::vector<double> bb;
1898 #ifndef WITHOUT_AUTOFIELD
1900 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1902 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1905 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1906 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1908 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1911 throw INTERP_KERNEL::Exception(msg);
1915 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1920 MCAuto<DataArrayDouble> ret=self->deepCopy();
1921 ret->applyLin(val,0.);
1922 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1926 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1930 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1931 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1935 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1936 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1939 throw INTERP_KERNEL::Exception(msg);
1943 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1945 const char msg[]="Unexpected situation in __rmul__ !";
1948 DataArrayDoubleTuple *aa;
1949 std::vector<double> bb;
1951 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1956 MCAuto<DataArrayDouble> ret=self->deepCopy();
1957 ret->applyLin(val,0.);
1962 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1963 return DataArrayDouble::Multiply(self,aaa);
1967 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1968 return DataArrayDouble::Multiply(self,aaa);
1971 throw INTERP_KERNEL::Exception(msg);
1975 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1977 const char msg[]="Unexpected situation in __imul__ !";
1980 DataArrayDoubleTuple *aa;
1981 std::vector<double> bb;
1983 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1988 self->applyLin(val,0.);
1989 Py_XINCREF(trueSelf);
1994 self->multiplyEqual(a);
1995 Py_XINCREF(trueSelf);
2000 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2001 self->multiplyEqual(aaa);
2002 Py_XINCREF(trueSelf);
2007 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2008 self->multiplyEqual(aaa);
2009 Py_XINCREF(trueSelf);
2013 throw INTERP_KERNEL::Exception(msg);
2017 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2019 const char msg[]="Unexpected situation in __div__ !";
2022 DataArrayDoubleTuple *aa;
2023 std::vector<double> bb;
2026 #ifndef WITHOUT_AUTOFIELD
2028 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2030 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2033 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2034 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2036 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2039 throw INTERP_KERNEL::Exception(msg);
2043 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2049 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2050 MCAuto<DataArrayDouble> ret=self->deepCopy();
2051 ret->applyLin(1/val,0.);
2052 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2056 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2060 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2061 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2065 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2066 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2069 throw INTERP_KERNEL::Exception(msg);
2073 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2075 const char msg[]="Unexpected situation in __rdiv__ !";
2078 DataArrayDoubleTuple *aa;
2079 std::vector<double> bb;
2081 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2086 MCAuto<DataArrayDouble> ret=self->deepCopy();
2092 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2093 return DataArrayDouble::Divide(aaa,self);
2097 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2098 return DataArrayDouble::Divide(aaa,self);
2101 throw INTERP_KERNEL::Exception(msg);
2105 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2107 const char msg[]="Unexpected situation in __idiv__ !";
2110 DataArrayDoubleTuple *aa;
2111 std::vector<double> bb;
2113 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2119 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2120 self->applyLin(1./val,0.);
2121 Py_XINCREF(trueSelf);
2126 self->divideEqual(a);
2127 Py_XINCREF(trueSelf);
2132 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2133 self->divideEqual(aaa);
2134 Py_XINCREF(trueSelf);
2139 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2140 self->divideEqual(aaa);
2141 Py_XINCREF(trueSelf);
2145 throw INTERP_KERNEL::Exception(msg);
2149 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2151 const char msg[]="Unexpected situation in __pow__ !";
2154 DataArrayDoubleTuple *aa;
2155 std::vector<double> bb;
2157 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2162 MCAuto<DataArrayDouble> ret=self->deepCopy();
2168 return DataArrayDouble::Pow(self,a);
2172 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2173 return DataArrayDouble::Pow(self,aaa);
2177 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2178 return DataArrayDouble::Pow(self,aaa);
2181 throw INTERP_KERNEL::Exception(msg);
2185 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2187 const char msg[]="Unexpected situation in __rpow__ !";
2190 DataArrayDoubleTuple *aa;
2191 std::vector<double> bb;
2193 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2198 MCAuto<DataArrayDouble> ret=self->deepCopy();
2199 ret->applyRPow(val);
2204 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2205 return DataArrayDouble::Pow(aaa,self);
2209 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2210 return DataArrayDouble::Pow(aaa,self);
2213 throw INTERP_KERNEL::Exception(msg);
2217 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2219 const char msg[]="Unexpected situation in __ipow__ !";
2222 DataArrayDoubleTuple *aa;
2223 std::vector<double> bb;
2225 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2230 self->applyPow(val);
2231 Py_XINCREF(trueSelf);
2237 Py_XINCREF(trueSelf);
2242 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2243 self->powEqual(aaa);
2244 Py_XINCREF(trueSelf);
2249 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2250 self->powEqual(aaa);
2251 Py_XINCREF(trueSelf);
2255 throw INTERP_KERNEL::Exception(msg);
2259 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2261 DataArrayInt *c=0,*cI=0;
2263 self->computeTupleIdsNearTuples(other,eps,c,cI);
2264 PyObject *ret=PyTuple_New(2);
2265 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2266 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2270 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2272 DataArrayInt *ret1=0;
2273 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2274 PyObject *ret=PyTuple_New(2);
2275 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2276 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2281 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2283 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2286 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2289 if(!self->isAllocated())
2290 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2291 PyObject *ret(PyTuple_New(1));
2292 PyObject *ret0(PyDict_New());
2293 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2294 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2295 PyObject *tmp1(PyInt_FromLong(0));
2296 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2297 PyTuple_SetItem(ret,0,ret0);
2301 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2307 class DataArrayDoubleTuple;
2309 class DataArrayDoubleIterator
2312 DataArrayDoubleIterator(DataArrayDouble *da);
2313 ~DataArrayDoubleIterator();
2318 DataArrayDoubleTuple *ret=self->nextt();
2320 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2323 PyErr_SetString(PyExc_StopIteration,"No more data.");
2330 class DataArrayDoubleTuple
2333 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2334 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2337 std::string __str__() const throw(INTERP_KERNEL::Exception)
2339 return self->repr();
2342 double __float__() const throw(INTERP_KERNEL::Exception)
2344 return self->doubleValue();
2347 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2349 return self->buildDADouble(1,self->getNumberOfCompo());
2352 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2354 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2355 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2356 Py_XINCREF(trueSelf);
2360 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2362 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2363 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2364 Py_XINCREF(trueSelf);
2368 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2370 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2371 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2372 Py_XINCREF(trueSelf);
2376 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2378 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2379 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2380 Py_XINCREF(trueSelf);
2384 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2386 return PyInt_FromLong(self->getNumberOfCompo());
2389 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2391 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2394 std::vector<int> multiVal;
2395 std::pair<int, std::pair<int,int> > slic;
2396 MEDCoupling::DataArrayInt *daIntTyypp=0;
2397 const double *pt=self->getConstPointer();
2398 int nbc=self->getNumberOfCompo();
2399 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2406 std::ostringstream oss;
2407 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2408 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2412 return PyFloat_FromDouble(pt[singleVal]);
2416 return PyFloat_FromDouble(pt[nbc+singleVal]);
2419 std::ostringstream oss;
2420 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2421 throw INTERP_KERNEL::Exception(oss.str().c_str());
2427 PyObject *t=PyTuple_New(multiVal.size());
2428 for(int j=0;j<(int)multiVal.size();j++)
2430 int cid=multiVal[j];
2433 std::ostringstream oss;
2434 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2435 throw INTERP_KERNEL::Exception(oss.str().c_str());
2437 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2443 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2444 PyObject *t=PyTuple_New(sz);
2445 for(int j=0;j<sz;j++)
2446 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2450 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2454 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2456 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2457 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2460 std::vector<double> multiValV;
2461 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2462 int nbc=self->getNumberOfCompo();
2463 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2465 std::vector<int> multiVal;
2466 std::pair<int, std::pair<int,int> > slic;
2467 MEDCoupling::DataArrayInt *daIntTyypp=0;
2468 double *pt=self->getPointer();
2469 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2476 std::ostringstream oss;
2477 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2478 throw INTERP_KERNEL::Exception(oss.str().c_str());
2484 pt[singleVal]=singleValV;
2489 if(multiValV.size()!=1)
2491 std::ostringstream oss;
2492 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2493 throw INTERP_KERNEL::Exception(oss.str().c_str());
2495 pt[singleVal]=multiValV[0];
2500 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2504 throw INTERP_KERNEL::Exception(msg);
2513 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2517 std::ostringstream oss;
2518 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2519 throw INTERP_KERNEL::Exception(oss.str().c_str());
2527 if(multiVal.size()!=multiValV.size())
2529 std::ostringstream oss;
2530 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2531 throw INTERP_KERNEL::Exception(oss.str().c_str());
2533 for(int i=0;i<(int)multiVal.size();i++)
2535 int pos=multiVal[i];
2538 std::ostringstream oss;
2539 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2540 throw INTERP_KERNEL::Exception(oss.str().c_str());
2542 pt[multiVal[i]]=multiValV[i];
2548 const double *ptV=daIntTyyppV->getConstPointer();
2549 if(nbc>daIntTyyppV->getNumberOfCompo())
2551 std::ostringstream oss;
2552 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2553 throw INTERP_KERNEL::Exception(oss.str().c_str());
2555 std::copy(ptV,ptV+nbc,pt);
2559 throw INTERP_KERNEL::Exception(msg);
2564 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2569 for(int j=0;j<sz;j++)
2570 pt[slic.first+j*slic.second.second]=singleValV;
2575 if(sz!=(int)multiValV.size())
2577 std::ostringstream oss;
2578 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2579 throw INTERP_KERNEL::Exception(oss.str().c_str());
2581 for(int j=0;j<sz;j++)
2582 pt[slic.first+j*slic.second.second]=multiValV[j];
2587 const double *ptV=daIntTyyppV->getConstPointer();
2588 if(sz>daIntTyyppV->getNumberOfCompo())
2590 std::ostringstream oss;
2591 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2592 throw INTERP_KERNEL::Exception(oss.str().c_str());
2594 for(int j=0;j<sz;j++)
2595 pt[slic.first+j*slic.second.second]=ptV[j];
2599 throw INTERP_KERNEL::Exception(msg);
2603 throw INTERP_KERNEL::Exception(msg);
2609 class DataArrayIntIterator;
2611 class DataArrayInt : public DataArray
2614 static DataArrayInt *New();
2615 int intValue() const throw(INTERP_KERNEL::Exception);
2616 int getHashCode() const throw(INTERP_KERNEL::Exception);
2617 bool empty() const throw(INTERP_KERNEL::Exception);
2618 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2619 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2620 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2621 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2622 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2623 int popBackSilent() throw(INTERP_KERNEL::Exception);
2624 void pack() const throw(INTERP_KERNEL::Exception);
2625 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2626 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2627 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2628 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2629 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2630 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2631 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2632 void reverse() throw(INTERP_KERNEL::Exception);
2633 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2634 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2635 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2636 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2637 void fillWithZero() throw(INTERP_KERNEL::Exception);
2638 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2639 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2640 std::string repr() const throw(INTERP_KERNEL::Exception);
2641 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2642 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2643 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2644 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2645 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2646 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2647 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2648 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2649 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2650 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2651 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2652 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2653 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2654 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2655 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2656 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2657 void transpose() throw(INTERP_KERNEL::Exception);
2658 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2659 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2660 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2661 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2662 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2663 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2664 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2665 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2666 int front() const throw(INTERP_KERNEL::Exception);
2667 int back() const throw(INTERP_KERNEL::Exception);
2668 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2669 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2670 int *getPointer() throw(INTERP_KERNEL::Exception);
2671 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2672 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2673 const int *begin() const throw(INTERP_KERNEL::Exception);
2674 const int *end() const throw(INTERP_KERNEL::Exception);
2675 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2677 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2678 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2679 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2680 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2681 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2682 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2683 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2684 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2685 int count(int value) const throw(INTERP_KERNEL::Exception);
2686 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2687 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2688 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2689 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2690 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2691 void abs() throw(INTERP_KERNEL::Exception);
2692 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2693 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2694 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2695 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2696 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2697 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2698 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2699 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2700 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2701 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2702 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2703 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2704 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2705 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2706 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2707 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2708 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2709 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2710 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2711 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2712 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2713 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2714 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2715 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2716 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2717 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2718 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2719 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2720 void computeOffsets() throw(INTERP_KERNEL::Exception);
2721 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2722 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2723 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2724 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2725 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2726 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2727 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2728 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2729 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2730 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2731 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2732 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2733 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2734 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2735 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2736 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2737 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2738 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2739 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2741 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2744 DataArrayInt() throw(INTERP_KERNEL::Exception)
2746 return DataArrayInt::New();
2749 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2751 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)";
2752 std::string msg(msgBase);
2754 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2757 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2761 if(PyInt_Check(nbOfTuples))
2763 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2765 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2768 if(PyInt_Check(nbOfComp))
2769 {//DataArrayInt.New([1,3,4,5],2,2)
2770 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2772 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2773 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2774 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2775 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2779 throw INTERP_KERNEL::Exception(msg.c_str());
2782 {//DataArrayInt.New([1,3,4],3)
2783 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2785 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2786 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2791 throw INTERP_KERNEL::Exception(msg.c_str());
2794 {// DataArrayInt.New([1,3,4])
2795 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2796 int tmpp1=-1,tmpp2=-1;
2797 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2798 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2802 else if(PyInt_Check(elt0))
2804 int nbOfTuples1=PyInt_AS_LONG(elt0);
2806 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2811 if(PyInt_Check(nbOfTuples))
2812 {//DataArrayInt.New(5,2)
2813 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2815 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2816 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2817 ret->alloc(nbOfTuples1,nbOfCompo);
2821 throw INTERP_KERNEL::Exception(msg.c_str());
2824 throw INTERP_KERNEL::Exception(msg.c_str());
2827 {//DataArrayInt.New(5)
2828 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2829 ret->alloc(nbOfTuples1,1);
2834 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2835 {//DataArrayInt.New(numpyArray)
2836 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2840 throw INTERP_KERNEL::Exception(msg.c_str());
2841 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2844 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2846 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2849 std::string __str__() const throw(INTERP_KERNEL::Exception)
2851 return self->reprNotTooLong();
2854 int __len__() const throw(INTERP_KERNEL::Exception)
2856 if(self->isAllocated())
2858 return self->getNumberOfTuples();
2862 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2866 int __int__() const throw(INTERP_KERNEL::Exception)
2868 return self->intValue();
2871 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2873 return self->iterator();
2876 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2878 int sz=self->getNumberOfComponents();
2879 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2880 self->accumulate(tmp);
2881 return convertIntArrToPyList(tmp,sz);
2884 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2887 std::vector<int> val2;
2888 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2889 return self->accumulatePerChunck(bg,bg+sz);
2892 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2895 std::vector<int> val2;
2896 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2897 return self->findIdsEqualTuple(bg,bg+sz);
2900 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2902 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2903 PyObject *ret=PyList_New(slcs.size());
2904 for(std::size_t i=0;i<slcs.size();i++)
2905 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2909 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2911 if(!PySlice_Check(slic))
2912 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2913 Py_ssize_t strt=2,stp=2,step=2;
2914 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2915 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2916 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2917 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 !");
2918 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2921 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2924 self->getMinMaxValues(a,b);
2925 PyObject *ret=PyTuple_New(2);
2926 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2927 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2931 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2933 int newNbOfTuples=-1;
2934 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2935 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2936 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2937 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2938 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2939 PyObject *ret=PyTuple_New(2);
2940 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2941 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2945 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2947 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2948 int szArr,sw,iTypppArr;
2949 std::vector<int> stdvecTyyppArr;
2950 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2951 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2952 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2956 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2958 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 !";
2959 if(PyList_Check(li) || PyTuple_Check(li))
2961 if(nbOfTuples && nbOfTuples != Py_None)
2963 if(PyInt_Check(nbOfTuples))
2965 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2967 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2968 if(nbOfComp && nbOfComp != Py_None)
2970 if(PyInt_Check(nbOfComp))
2971 {//DataArrayInt.setValues([1,3,4,5],2,2)
2972 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2974 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2975 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2976 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2979 throw INTERP_KERNEL::Exception(msg);
2982 {//DataArrayInt.setValues([1,3,4],3)
2984 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2985 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2989 throw INTERP_KERNEL::Exception(msg);
2992 {// DataArrayInt.setValues([1,3,4])
2993 int tmpp1=-1,tmpp2=-1;
2994 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2995 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2999 throw INTERP_KERNEL::Exception(msg);
3002 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3004 const int *vals=self->getConstPointer();
3005 return convertIntArrToPyList(vals,self->getNbOfElems());
3009 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3011 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3015 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3018 bool ret0=self->isEqualIfNotWhy(other,ret1);
3019 PyObject *ret=PyTuple_New(2);
3020 PyObject *ret0Py=ret0?Py_True:Py_False;
3022 PyTuple_SetItem(ret,0,ret0Py);
3023 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3027 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3029 const int *vals=self->getConstPointer();
3030 int nbOfComp=self->getNumberOfComponents();
3031 int nbOfTuples=self->getNumberOfTuples();
3032 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3035 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3037 std::vector<const DataArrayInt *> groups;
3038 std::vector< std::vector<int> > fidsOfGroups;
3039 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3040 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3041 PyObject *ret = PyList_New(2);
3042 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3043 int sz=fidsOfGroups.size();
3044 PyObject *ret1 = PyList_New(sz);
3045 for(int i=0;i<sz;i++)
3046 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3047 PyList_SetItem(ret,1,ret1);
3051 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3054 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3055 if (!SWIG_IsOK(res1))
3058 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3059 self->transformWithIndArr(tmp,tmp+size);
3063 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3064 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3068 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3072 std::vector<int> multiVal;
3073 std::pair<int, std::pair<int,int> > slic;
3074 MEDCoupling::DataArrayInt *daIntTyypp=0;
3075 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3079 return self->findIdsEqualList(&singleVal,&singleVal+1);
3081 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3083 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3085 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3089 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3093 std::vector<int> multiVal;
3094 std::pair<int, std::pair<int,int> > slic;
3095 MEDCoupling::DataArrayInt *daIntTyypp=0;
3096 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3100 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3102 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3104 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3106 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3110 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3112 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3114 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3115 if (!SWIG_IsOK(res1))
3118 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3119 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3123 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3125 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3126 da2->checkAllocated();
3127 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3129 PyObject *ret = PyList_New(3);
3130 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3131 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3132 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3136 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3139 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3140 if (!SWIG_IsOK(res1))
3143 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3144 return self->transformWithIndArrR(tmp,tmp+size);
3148 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3149 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3153 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3156 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3157 if (!SWIG_IsOK(res1))
3160 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3161 if(size!=self->getNumberOfTuples())
3163 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3165 return self->renumberAndReduce(tmp,newNbOfTuple);
3169 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3171 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3172 da2->checkAllocated();
3173 int size=self->getNumberOfTuples();
3174 if(size!=self->getNumberOfTuples())
3176 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3178 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3182 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3185 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3186 if (!SWIG_IsOK(res1))
3189 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3190 if(size!=self->getNumberOfTuples())
3192 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3194 return self->renumber(tmp);
3198 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3200 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3201 da2->checkAllocated();
3202 int size=self->getNumberOfTuples();
3203 if(size!=self->getNumberOfTuples())
3205 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3207 return self->renumber(da2->getConstPointer());
3211 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3214 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3215 if (!SWIG_IsOK(res1))
3218 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3219 if(size!=self->getNumberOfTuples())
3221 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3223 return self->renumberR(tmp);
3227 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3229 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3230 da2->checkAllocated();
3231 int size=self->getNumberOfTuples();
3232 if(size!=self->getNumberOfTuples())
3234 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3236 return self->renumberR(da2->getConstPointer());
3240 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3242 std::vector<int> tmp;
3243 convertPyToNewIntArr3(li,tmp);
3244 self->setSelectedComponents(a,tmp);
3247 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3249 int sz=self->getNumberOfComponents();
3250 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3251 self->getTuple(tupleId,tmp);
3252 return convertIntArrToPyList(tmp,sz);
3255 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3257 DataArrayInt *arr=0;
3258 DataArrayInt *arrI=0;
3259 self->changeSurjectiveFormat(targetNb,arr,arrI);
3260 PyObject *res = PyList_New(2);
3261 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3262 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3266 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3268 std::vector<const DataArrayInt *> tmp;
3269 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3270 return DataArrayInt::Meld(tmp);
3273 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3275 std::vector<const DataArrayInt *> tmp;
3276 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3277 return DataArrayInt::Aggregate(tmp);
3280 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3282 std::vector<const DataArrayInt *> tmp;
3283 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3284 return DataArrayInt::AggregateIndexes(tmp);
3287 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3289 std::vector<const DataArrayInt *> tmp;
3290 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3291 return DataArrayInt::BuildUnion(tmp);
3294 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3296 std::vector<const DataArrayInt *> tmp;
3297 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3298 return DataArrayInt::BuildIntersection(tmp);
3301 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3304 int r1=self->getMaxValue(tmp);
3305 PyObject *ret=PyTuple_New(2);
3306 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3307 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3311 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3314 int r1=self->getMinValue(tmp);
3315 PyObject *ret=PyTuple_New(2);
3316 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3317 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3321 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3323 int nbOfCompo=self->getNumberOfComponents();
3328 if(PyInt_Check(obj))
3330 int val=(int)PyInt_AS_LONG(obj);
3331 return self->findIdFirstEqual(val);
3334 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3338 std::vector<int> arr;
3339 convertPyToNewIntArr3(obj,arr);
3340 return self->findIdFirstEqualTuple(arr);
3345 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3347 int nbOfCompo=self->getNumberOfComponents();
3354 if(PyInt_Check(obj))
3356 int val=(int)PyInt_AS_LONG(obj);
3357 return self->presenceOfValue(val);
3360 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3364 std::vector<int> arr;
3365 convertPyToNewIntArr3(obj,arr);
3366 return self->presenceOfTuple(arr);
3371 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3373 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3374 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3375 self->checkAllocated();
3376 int nbOfTuples=self->getNumberOfTuples();
3377 int nbOfComponents=self->getNumberOfComponents();
3379 std::vector<int> vt1,vc1;
3380 std::pair<int, std::pair<int,int> > pt1,pc1;
3381 DataArrayInt *dt1=0,*dc1=0;
3383 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3384 MCAuto<DataArrayInt> ret;
3389 if(nbOfComponents==1)
3390 return PyInt_FromLong(self->getIJSafe(it1,0));
3391 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3394 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3396 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3398 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3400 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3403 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3404 std::vector<int> v2(1,ic1);
3405 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3409 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3410 std::vector<int> v2(1,ic1);
3411 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3415 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3416 std::vector<int> v2(1,ic1);
3417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3421 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3422 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3426 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3427 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3431 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3432 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3436 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3437 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3441 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3442 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3443 std::vector<int> v2(nbOfComp);
3444 for(int i=0;i<nbOfComp;i++)
3445 v2[i]=pc1.first+i*pc1.second.second;
3446 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3450 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3451 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3452 std::vector<int> v2(nbOfComp);
3453 for(int i=0;i<nbOfComp;i++)
3454 v2[i]=pc1.first+i*pc1.second.second;
3455 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3459 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3460 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3461 std::vector<int> v2(nbOfComp);
3462 for(int i=0;i<nbOfComp;i++)
3463 v2[i]=pc1.first+i*pc1.second.second;
3464 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3468 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3469 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3470 std::vector<int> v2(nbOfComp);
3471 for(int i=0;i<nbOfComp;i++)
3472 v2[i]=pc1.first+i*pc1.second.second;
3473 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3476 throw INTERP_KERNEL::Exception(msg);
3480 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3482 self->checkAllocated();
3483 const char msg[]="Unexpected situation in __setitem__ !";
3484 int nbOfTuples=self->getNumberOfTuples();
3485 int nbOfComponents=self->getNumberOfComponents();
3488 std::vector<int> v1;
3490 DataArrayIntTuple *dd1=0;
3491 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3493 std::vector<int> vt1,vc1;
3494 std::pair<int, std::pair<int,int> > pt1,pc1;
3495 DataArrayInt *dt1=0,*dc1=0;
3496 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3497 MCAuto<DataArrayInt> tmp;
3505 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3508 tmp=DataArrayInt::New();
3509 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3510 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3513 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3516 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3517 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3520 throw INTERP_KERNEL::Exception(msg);
3529 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3532 tmp=DataArrayInt::New();
3533 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3534 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3537 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3540 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3541 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3544 throw INTERP_KERNEL::Exception(msg);
3553 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3556 tmp=DataArrayInt::New();
3557 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3558 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3561 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3564 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3565 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3568 throw INTERP_KERNEL::Exception(msg);
3577 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3580 tmp=DataArrayInt::New();
3581 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3582 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3585 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3588 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3589 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3592 throw INTERP_KERNEL::Exception(msg);
3601 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3604 tmp=DataArrayInt::New();
3605 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3606 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3609 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3612 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3613 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3616 throw INTERP_KERNEL::Exception(msg);
3625 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3628 tmp=DataArrayInt::New();
3629 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3630 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3633 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3636 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3637 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3640 throw INTERP_KERNEL::Exception(msg);
3649 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3652 tmp=DataArrayInt::New();
3653 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3654 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3657 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3660 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3661 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3664 throw INTERP_KERNEL::Exception(msg);
3673 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3676 tmp=DataArrayInt::New();
3677 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3678 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3681 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3684 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3685 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3688 throw INTERP_KERNEL::Exception(msg);
3697 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3700 tmp=DataArrayInt::New();
3701 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3702 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3705 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3708 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3709 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3712 throw INTERP_KERNEL::Exception(msg);
3721 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3724 tmp=DataArrayInt::New();
3725 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3726 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3729 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3732 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3733 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3736 throw INTERP_KERNEL::Exception(msg);
3745 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3748 tmp=DataArrayInt::New();
3749 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3750 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3753 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3756 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3757 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3760 throw INTERP_KERNEL::Exception(msg);
3769 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3772 tmp=DataArrayInt::New();
3773 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3774 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3777 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3780 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3781 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3784 throw INTERP_KERNEL::Exception(msg);
3793 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3796 tmp=DataArrayInt::New();
3797 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3798 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3801 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3804 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3805 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3808 throw INTERP_KERNEL::Exception(msg);
3817 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3820 tmp=DataArrayInt::New();
3821 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3822 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3825 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3828 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3829 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3832 throw INTERP_KERNEL::Exception(msg);
3841 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3844 tmp=DataArrayInt::New();
3845 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3846 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3849 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3852 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3853 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3856 throw INTERP_KERNEL::Exception(msg);
3865 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3868 tmp=DataArrayInt::New();
3869 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3870 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3873 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3876 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3877 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3880 throw INTERP_KERNEL::Exception(msg);
3885 throw INTERP_KERNEL::Exception(msg);
3890 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3892 return self->negate();
3895 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3897 const char msg[]="Unexpected situation in __add__ !";
3900 std::vector<int> aa;
3901 DataArrayIntTuple *aaa;
3903 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3908 MCAuto<DataArrayInt> ret=self->deepCopy();
3909 ret->applyLin(1,val);
3914 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3915 return DataArrayInt::Add(self,aaaa);
3919 return DataArrayInt::Add(self,a);
3923 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3924 return DataArrayInt::Add(self,aaaa);
3927 throw INTERP_KERNEL::Exception(msg);
3931 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3933 const char msg[]="Unexpected situation in __radd__ !";
3936 std::vector<int> aa;
3937 DataArrayIntTuple *aaa;
3939 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3944 MCAuto<DataArrayInt> ret=self->deepCopy();
3945 ret->applyLin(1,val);
3950 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3951 return DataArrayInt::Add(self,aaaa);
3955 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3956 return DataArrayInt::Add(self,aaaa);
3959 throw INTERP_KERNEL::Exception(msg);
3963 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3965 const char msg[]="Unexpected situation in __iadd__ !";
3968 std::vector<int> aa;
3969 DataArrayIntTuple *aaa;
3971 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3976 self->applyLin(1,val);
3977 Py_XINCREF(trueSelf);
3982 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3984 Py_XINCREF(trueSelf);
3990 Py_XINCREF(trueSelf);
3995 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3996 self->addEqual(aaaa);
3997 Py_XINCREF(trueSelf);
4001 throw INTERP_KERNEL::Exception(msg);
4005 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4007 const char msg[]="Unexpected situation in __sub__ !";
4010 std::vector<int> aa;
4011 DataArrayIntTuple *aaa;
4013 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4018 MCAuto<DataArrayInt> ret=self->deepCopy();
4019 ret->applyLin(1,-val);
4024 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4025 return DataArrayInt::Substract(self,aaaa);
4029 return DataArrayInt::Substract(self,a);
4033 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4034 return DataArrayInt::Substract(self,aaaa);
4037 throw INTERP_KERNEL::Exception(msg);
4041 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4043 const char msg[]="Unexpected situation in __rsub__ !";
4046 std::vector<int> aa;
4047 DataArrayIntTuple *aaa;
4049 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4054 MCAuto<DataArrayInt> ret=self->deepCopy();
4055 ret->applyLin(-1,val);
4060 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4061 return DataArrayInt::Substract(aaaa,self);
4065 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4066 return DataArrayInt::Substract(aaaa,self);
4069 throw INTERP_KERNEL::Exception(msg);
4073 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4075 const char msg[]="Unexpected situation in __isub__ !";
4078 std::vector<int> aa;
4079 DataArrayIntTuple *aaa;
4081 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4086 self->applyLin(1,-val);
4087 Py_XINCREF(trueSelf);
4092 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4093 self->substractEqual(bb);
4094 Py_XINCREF(trueSelf);
4099 self->substractEqual(a);
4100 Py_XINCREF(trueSelf);
4105 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4106 self->substractEqual(aaaa);
4107 Py_XINCREF(trueSelf);
4111 throw INTERP_KERNEL::Exception(msg);
4115 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4117 const char msg[]="Unexpected situation in __mul__ !";
4120 std::vector<int> aa;
4121 DataArrayIntTuple *aaa;
4123 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4128 MCAuto<DataArrayInt> ret=self->deepCopy();
4129 ret->applyLin(val,0);
4134 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4135 return DataArrayInt::Multiply(self,aaaa);
4139 return DataArrayInt::Multiply(self,a);
4143 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4144 return DataArrayInt::Multiply(self,aaaa);
4147 throw INTERP_KERNEL::Exception(msg);
4151 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4153 const char msg[]="Unexpected situation in __rmul__ !";
4156 std::vector<int> aa;
4157 DataArrayIntTuple *aaa;
4159 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4164 MCAuto<DataArrayInt> ret=self->deepCopy();
4165 ret->applyLin(val,0);
4170 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4171 return DataArrayInt::Multiply(self,aaaa);
4175 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4176 return DataArrayInt::Multiply(self,aaaa);
4179 throw INTERP_KERNEL::Exception(msg);
4183 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4185 const char msg[]="Unexpected situation in __imul__ !";
4188 std::vector<int> aa;
4189 DataArrayIntTuple *aaa;
4191 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4196 self->applyLin(val,0);
4197 Py_XINCREF(trueSelf);
4202 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4203 self->multiplyEqual(bb);
4204 Py_XINCREF(trueSelf);
4209 self->multiplyEqual(a);
4210 Py_XINCREF(trueSelf);
4215 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4216 self->multiplyEqual(aaaa);
4217 Py_XINCREF(trueSelf);
4221 throw INTERP_KERNEL::Exception(msg);
4225 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4227 const char msg[]="Unexpected situation in __div__ !";
4230 std::vector<int> aa;
4231 DataArrayIntTuple *aaa;
4233 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4238 MCAuto<DataArrayInt> ret=self->deepCopy();
4239 ret->applyDivideBy(val);
4244 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4245 return DataArrayInt::Divide(self,aaaa);
4249 return DataArrayInt::Divide(self,a);
4253 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4254 return DataArrayInt::Divide(self,aaaa);
4257 throw INTERP_KERNEL::Exception(msg);
4261 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4263 const char msg[]="Unexpected situation in __rdiv__ !";
4266 std::vector<int> aa;
4267 DataArrayIntTuple *aaa;
4269 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4274 MCAuto<DataArrayInt> ret=self->deepCopy();
4280 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4281 return DataArrayInt::Divide(aaaa,self);
4285 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4286 return DataArrayInt::Divide(aaaa,self);
4289 throw INTERP_KERNEL::Exception(msg);
4293 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4295 const char msg[]="Unexpected situation in __idiv__ !";
4298 std::vector<int> aa;
4299 DataArrayIntTuple *aaa;
4301 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4306 self->applyDivideBy(val);
4307 Py_XINCREF(trueSelf);
4312 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4313 self->divideEqual(bb);
4314 Py_XINCREF(trueSelf);
4319 self->divideEqual(a);
4320 Py_XINCREF(trueSelf);
4325 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4326 self->divideEqual(aaaa);
4327 Py_XINCREF(trueSelf);
4331 throw INTERP_KERNEL::Exception(msg);
4335 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4337 const char msg[]="Unexpected situation in __mod__ !";
4340 std::vector<int> aa;
4341 DataArrayIntTuple *aaa;
4343 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4348 MCAuto<DataArrayInt> ret=self->deepCopy();
4349 ret->applyModulus(val);
4354 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4355 return DataArrayInt::Modulus(self,aaaa);
4359 return DataArrayInt::Modulus(self,a);
4363 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4364 return DataArrayInt::Modulus(self,aaaa);
4367 throw INTERP_KERNEL::Exception(msg);
4371 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4373 const char msg[]="Unexpected situation in __rmod__ !";
4376 std::vector<int> aa;
4377 DataArrayIntTuple *aaa;
4379 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4384 MCAuto<DataArrayInt> ret=self->deepCopy();
4385 ret->applyRModulus(val);
4390 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4391 return DataArrayInt::Modulus(aaaa,self);
4395 return DataArrayInt::Modulus(a,self);
4399 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4400 return DataArrayInt::Modulus(aaaa,self);
4403 throw INTERP_KERNEL::Exception(msg);
4407 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4409 const char msg[]="Unexpected situation in __imod__ !";
4412 std::vector<int> aa;
4413 DataArrayIntTuple *aaa;
4415 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4420 self->applyModulus(val);
4421 Py_XINCREF(trueSelf);
4426 self->modulusEqual(a);
4427 Py_XINCREF(trueSelf);
4432 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4433 self->modulusEqual(aaaa);
4434 Py_XINCREF(trueSelf);
4438 throw INTERP_KERNEL::Exception(msg);
4442 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4444 const char msg[]="Unexpected situation in __pow__ !";
4447 std::vector<int> aa;
4448 DataArrayIntTuple *aaa;
4450 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4455 MCAuto<DataArrayInt> ret=self->deepCopy();
4461 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4462 return DataArrayInt::Pow(self,aaaa);
4466 return DataArrayInt::Pow(self,a);
4470 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4471 return DataArrayInt::Pow(self,aaaa);
4474 throw INTERP_KERNEL::Exception(msg);
4478 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4480 const char msg[]="Unexpected situation in __rpow__ !";
4483 std::vector<int> aa;
4484 DataArrayIntTuple *aaa;
4486 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4491 MCAuto<DataArrayInt> ret=self->deepCopy();
4492 ret->applyRPow(val);
4497 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4498 return DataArrayInt::Pow(aaaa,self);
4502 return DataArrayInt::Pow(a,self);
4506 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4507 return DataArrayInt::Pow(aaaa,self);
4510 throw INTERP_KERNEL::Exception(msg);
4514 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4516 const char msg[]="Unexpected situation in __ipow__ !";
4519 std::vector<int> aa;
4520 DataArrayIntTuple *aaa;
4522 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4527 self->applyPow(val);
4528 Py_XINCREF(trueSelf);
4534 Py_XINCREF(trueSelf);
4539 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4540 self->powEqual(aaaa);
4541 Py_XINCREF(trueSelf);
4545 throw INTERP_KERNEL::Exception(msg);
4549 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4551 std::ostringstream oss;
4552 self->reprQuickOverview(oss);
4556 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4558 int szArr,sw,iTypppArr;
4559 std::vector<int> stdvecTyyppArr;
4560 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4561 self->pushBackValsSilent(tmp,tmp+szArr);
4564 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4566 std::vector<int> ret1;
4567 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4568 std::size_t sz=ret0.size();
4569 PyObject *pyRet=PyTuple_New(2);
4570 PyObject *pyRet0=PyList_New((int)sz);
4571 PyObject *pyRet1=PyList_New((int)sz);
4572 for(std::size_t i=0;i<sz;i++)
4574 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4575 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4577 PyTuple_SetItem(pyRet,0,pyRet0);
4578 PyTuple_SetItem(pyRet,1,pyRet1);
4582 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4584 DataArrayInt *ret0=0,*ret1=0;
4585 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4586 PyObject *pyRet=PyTuple_New(2);
4587 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4588 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4592 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4595 bool ret(self->isRange(a,b,c));
4596 PyObject *pyRet=PyTuple_New(2);
4597 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4599 PyTuple_SetItem(pyRet,0,ret0Py);
4601 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4607 PyTuple_SetItem(pyRet,1,ret1Py);
4612 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4614 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4617 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4620 if(!self->isAllocated())
4621 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4622 PyObject *ret(PyTuple_New(1));
4623 PyObject *ret0(PyDict_New());
4624 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4625 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4626 PyObject *tmp1(PyInt_FromLong(0));
4627 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4628 PyTuple_SetItem(ret,0,ret0);
4632 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4638 class DataArrayIntTuple;
4640 class DataArrayIntIterator
4643 DataArrayIntIterator(DataArrayInt *da);
4644 ~DataArrayIntIterator();
4649 DataArrayIntTuple *ret=self->nextt();
4651 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4654 PyErr_SetString(PyExc_StopIteration,"No more data.");
4661 class DataArrayIntTuple
4664 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4665 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4668 std::string __str__() const throw(INTERP_KERNEL::Exception)
4670 return self->repr();
4673 int __int__() const throw(INTERP_KERNEL::Exception)
4675 return self->intValue();
4678 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4680 return self->buildDAInt(1,self->getNumberOfCompo());
4683 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4685 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4686 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4687 Py_XINCREF(trueSelf);
4691 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4693 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4694 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4695 Py_XINCREF(trueSelf);
4699 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4701 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4702 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4703 Py_XINCREF(trueSelf);
4707 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4709 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4710 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4711 Py_XINCREF(trueSelf);
4715 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4717 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4718 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4719 Py_XINCREF(trueSelf);
4723 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4725 return PyInt_FromLong(self->getNumberOfCompo());
4728 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4730 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4733 std::vector<int> multiVal;
4734 std::pair<int, std::pair<int,int> > slic;
4735 MEDCoupling::DataArrayInt *daIntTyypp=0;
4736 const int *pt=self->getConstPointer();
4737 int nbc=self->getNumberOfCompo();
4738 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4745 std::ostringstream oss;
4746 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4747 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4751 return PyInt_FromLong(pt[singleVal]);
4755 return PyInt_FromLong(pt[nbc+singleVal]);
4758 std::ostringstream oss;
4759 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4760 throw INTERP_KERNEL::Exception(oss.str().c_str());
4766 PyObject *t=PyTuple_New(multiVal.size());
4767 for(int j=0;j<(int)multiVal.size();j++)
4769 int cid=multiVal[j];
4772 std::ostringstream oss;
4773 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4774 throw INTERP_KERNEL::Exception(oss.str().c_str());
4776 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4782 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4783 PyObject *t=PyTuple_New(sz);
4784 for(int j=0;j<sz;j++)
4785 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4789 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4793 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4795 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4796 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4799 std::vector<int> multiValV;
4800 std::pair<int, std::pair<int,int> > slicV;
4801 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4802 int nbc=self->getNumberOfCompo();
4803 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4805 std::vector<int> multiVal;
4806 std::pair<int, std::pair<int,int> > slic;
4807 MEDCoupling::DataArrayInt *daIntTyypp=0;
4808 int *pt=self->getPointer();
4809 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4816 std::ostringstream oss;
4817 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4818 throw INTERP_KERNEL::Exception(oss.str().c_str());
4824 pt[singleVal]=singleValV;
4829 if(multiValV.size()!=1)
4831 std::ostringstream oss;
4832 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4833 throw INTERP_KERNEL::Exception(oss.str().c_str());
4835 pt[singleVal]=multiValV[0];
4840 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4844 throw INTERP_KERNEL::Exception(msg);
4853 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4857 std::ostringstream oss;
4858 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4859 throw INTERP_KERNEL::Exception(oss.str().c_str());
4867 if(multiVal.size()!=multiValV.size())
4869 std::ostringstream oss;
4870 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4871 throw INTERP_KERNEL::Exception(oss.str().c_str());
4873 for(int i=0;i<(int)multiVal.size();i++)
4875 int pos=multiVal[i];
4878 std::ostringstream oss;
4879 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4880 throw INTERP_KERNEL::Exception(oss.str().c_str());
4882 pt[multiVal[i]]=multiValV[i];
4888 const int *ptV=daIntTyyppV->getConstPointer();
4889 if(nbc>daIntTyyppV->getNumberOfCompo())
4891 std::ostringstream oss;
4892 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4893 throw INTERP_KERNEL::Exception(oss.str().c_str());
4895 std::copy(ptV,ptV+nbc,pt);
4899 throw INTERP_KERNEL::Exception(msg);
4904 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4909 for(int j=0;j<sz;j++)
4910 pt[slic.first+j*slic.second.second]=singleValV;
4915 if(sz!=(int)multiValV.size())
4917 std::ostringstream oss;
4918 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4919 throw INTERP_KERNEL::Exception(oss.str().c_str());
4921 for(int j=0;j<sz;j++)
4922 pt[slic.first+j*slic.second.second]=multiValV[j];
4927 const int *ptV=daIntTyyppV->getConstPointer();
4928 if(sz>daIntTyyppV->getNumberOfCompo())
4930 std::ostringstream oss;
4931 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4932 throw INTERP_KERNEL::Exception(oss.str().c_str());
4934 for(int j=0;j<sz;j++)
4935 pt[slic.first+j*slic.second.second]=ptV[j];
4939 throw INTERP_KERNEL::Exception(msg);
4943 throw INTERP_KERNEL::Exception(msg);
4949 class DataArrayChar : public DataArray
4952 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4953 int getHashCode() const throw(INTERP_KERNEL::Exception);
4954 bool empty() const throw(INTERP_KERNEL::Exception);
4955 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4956 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4957 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4958 char popBackSilent() throw(INTERP_KERNEL::Exception);
4959 void pack() const throw(INTERP_KERNEL::Exception);
4960 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4961 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4962 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4963 void reverse() throw(INTERP_KERNEL::Exception);
4964 void fillWithZero() throw(INTERP_KERNEL::Exception);
4965 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4966 std::string repr() const throw(INTERP_KERNEL::Exception);
4967 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4968 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4969 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4970 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4971 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4972 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4973 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4974 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4975 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4976 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4977 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4978 char front() const throw(INTERP_KERNEL::Exception);
4979 char back() const throw(INTERP_KERNEL::Exception);
4980 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4981 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4982 char *getPointer() throw(INTERP_KERNEL::Exception);
4983 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4984 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4985 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4986 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4987 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4988 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4989 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4990 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4991 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4992 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4993 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4996 int __len__() const throw(INTERP_KERNEL::Exception)
4998 if(self->isAllocated())
5000 return self->getNumberOfTuples();
5004 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5008 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5011 bool ret0=self->isEqualIfNotWhy(other,ret1);
5012 PyObject *ret=PyTuple_New(2);
5013 PyObject *ret0Py=ret0?Py_True:Py_False;
5015 PyTuple_SetItem(ret,0,ret0Py);
5016 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5020 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5023 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5024 if (!SWIG_IsOK(res1))
5027 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5028 if(size!=self->getNumberOfTuples())
5030 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5032 return self->renumber(tmp);
5036 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5038 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5039 da2->checkAllocated();
5040 int size=self->getNumberOfTuples();
5041 if(size!=self->getNumberOfTuples())
5043 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5045 return self->renumber(da2->getConstPointer());
5049 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5052 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5053 if (!SWIG_IsOK(res1))
5056 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5057 if(size!=self->getNumberOfTuples())
5059 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5061 return self->renumberR(tmp);
5065 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5067 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5068 da2->checkAllocated();
5069 int size=self->getNumberOfTuples();
5070 if(size!=self->getNumberOfTuples())
5072 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5074 return self->renumberR(da2->getConstPointer());
5078 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5081 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5082 if (!SWIG_IsOK(res1))
5085 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5086 if(size!=self->getNumberOfTuples())
5088 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5090 return self->renumberAndReduce(tmp,newNbOfTuple);
5094 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5096 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5097 da2->checkAllocated();
5098 int size=self->getNumberOfTuples();
5099 if(size!=self->getNumberOfTuples())
5101 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5103 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5107 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5109 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5110 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5111 return DataArrayChar::Aggregate(tmp);
5114 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5116 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5117 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5118 return DataArrayChar::Meld(tmp);
5123 class DataArrayByteIterator;
5125 class DataArrayByte : public DataArrayChar
5128 static DataArrayByte *New();
5129 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5130 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5131 char byteValue() const throw(INTERP_KERNEL::Exception);
5134 DataArrayByte() throw(INTERP_KERNEL::Exception)
5136 return DataArrayByte::New();
5139 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5141 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) !";
5142 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5146 if(PyInt_Check(nbOfTuples))
5148 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5150 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5153 if(PyInt_Check(nbOfComp))
5154 {//DataArrayByte.New([1,3,4,5],2,2)
5155 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5157 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5158 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5159 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5160 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5164 throw INTERP_KERNEL::Exception(msg);
5167 {//DataArrayByte.New([1,3,4],3)
5168 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5170 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5171 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5176 throw INTERP_KERNEL::Exception(msg);
5179 {// DataArrayByte.New([1,3,4])
5180 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5181 int tmpp1=-1,tmpp2=-1;
5182 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5183 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5187 else if(PyInt_Check(elt0))
5189 int nbOfTuples1=PyInt_AS_LONG(elt0);
5191 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5196 if(PyInt_Check(nbOfTuples))
5197 {//DataArrayByte.New(5,2)
5198 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5200 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5201 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5202 ret->alloc(nbOfTuples1,nbOfCompo);
5206 throw INTERP_KERNEL::Exception(msg);
5209 throw INTERP_KERNEL::Exception(msg);
5212 {//DataArrayByte.New(5)
5213 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5214 ret->alloc(nbOfTuples1,1);
5219 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5220 {//DataArrayDouble.New(numpyArray)
5221 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5225 throw INTERP_KERNEL::Exception(msg);
5228 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5230 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5233 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5235 std::ostringstream oss;
5236 self->reprQuickOverview(oss);
5240 int __int__() const throw(INTERP_KERNEL::Exception)
5242 return (int) self->byteValue();
5245 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5247 return self->iterator();
5250 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5252 return (int)self->getIJ(tupleId,compoId);
5255 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5257 return (int)self->getIJSafe(tupleId,compoId);
5260 std::string __str__() const throw(INTERP_KERNEL::Exception)
5262 return self->repr();
5265 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5267 const char *vals=self->getConstPointer();
5268 int nbOfComp=self->getNumberOfComponents();
5269 int nbOfTuples=self->getNumberOfTuples();
5270 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5273 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5276 int ival=-1; std::vector<int> ivval;
5277 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5278 std::vector<char> vals(sz);
5279 std::copy(pt,pt+sz,vals.begin());
5280 return self->presenceOfTuple(vals);
5283 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5286 int ival=-1; std::vector<int> ivval;
5287 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5288 std::vector<char> vals2(sz);
5289 std::copy(pt,pt+sz,vals2.begin());
5290 return self->presenceOfValue(vals2);
5293 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5296 int ival=-1; std::vector<int> ivval;
5297 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5298 std::vector<char> vals2(sz);
5299 std::copy(pt,pt+sz,vals2.begin());
5300 return self->findIdFirstEqual(vals2);
5303 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5306 int ival=-1; std::vector<int> ivval;
5307 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5308 std::vector<char> vals(sz);
5309 std::copy(pt,pt+sz,vals.begin());
5310 return self->findIdFirstEqualTuple(vals);
5313 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5316 int ival=-1; std::vector<int> ivval;
5317 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5318 std::vector<char> vals(sz);
5319 std::copy(pt,pt+sz,vals.begin());
5320 return self->findIdSequence(vals);
5323 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5325 int sz=self->getNumberOfComponents();
5326 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5327 self->getTuple(tupleId,tmp);
5328 PyObject *ret=PyTuple_New(sz);
5329 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5333 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5336 int r1=(int)self->getMaxValue(tmp);
5337 PyObject *ret=PyTuple_New(2);
5338 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5339 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5343 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5346 int r1=(int)self->getMinValue(tmp);
5347 PyObject *ret=PyTuple_New(2);
5348 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5349 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5353 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5355 int nbOfCompo=self->getNumberOfComponents();
5360 if(PyInt_Check(obj))
5362 int val=(int)PyInt_AS_LONG(obj);
5363 return self->findIdFirstEqual(val);
5366 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5369 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5373 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5375 int nbOfCompo=self->getNumberOfComponents();
5382 if(PyInt_Check(obj))
5384 int val=(int)PyInt_AS_LONG(obj);
5385 return self->presenceOfValue(val);
5388 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5391 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5396 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5398 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5403 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5405 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5408 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5411 if(!self->isAllocated())
5412 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5413 PyObject *ret(PyTuple_New(1));
5414 PyObject *ret0(PyDict_New());
5415 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5416 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5417 PyObject *tmp1(PyInt_FromLong(0));
5418 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5419 PyTuple_SetItem(ret,0,ret0);
5423 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5427 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5429 self->checkAllocated();
5430 const char msg[]="Unexpected situation in __setitem__ !";
5431 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5434 std::vector<int> v1;
5436 DataArrayIntTuple *dd1=0;
5437 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5439 std::vector<int> vt1,vc1;
5440 std::pair<int, std::pair<int,int> > pt1,pc1;
5441 DataArrayInt *dt1=0,*dc1=0;
5442 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5443 MCAuto<DataArrayInt> tmp;
5451 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5454 throw INTERP_KERNEL::Exception(msg);
5463 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5466 throw INTERP_KERNEL::Exception(msg);
5475 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5478 throw INTERP_KERNEL::Exception(msg);
5487 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5490 throw INTERP_KERNEL::Exception(msg);
5499 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5502 throw INTERP_KERNEL::Exception(msg);
5511 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5514 throw INTERP_KERNEL::Exception(msg);
5523 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5526 throw INTERP_KERNEL::Exception(msg);
5535 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5538 throw INTERP_KERNEL::Exception(msg);
5547 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5550 throw INTERP_KERNEL::Exception(msg);
5559 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5562 throw INTERP_KERNEL::Exception(msg);
5571 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5574 throw INTERP_KERNEL::Exception(msg);
5583 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5586 throw INTERP_KERNEL::Exception(msg);
5595 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5598 throw INTERP_KERNEL::Exception(msg);
5607 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5610 throw INTERP_KERNEL::Exception(msg);
5619 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5622 throw INTERP_KERNEL::Exception(msg);
5631 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5634 throw INTERP_KERNEL::Exception(msg);
5639 throw INTERP_KERNEL::Exception(msg);
5646 class DataArrayByteTuple;
5648 class DataArrayByteIterator
5651 DataArrayByteIterator(DataArrayByte *da);
5652 ~DataArrayByteIterator();
5655 class DataArrayByteTuple
5658 std::string repr() const throw(INTERP_KERNEL::Exception);
5659 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5662 std::string __str__() const throw(INTERP_KERNEL::Exception)
5664 return self->repr();
5667 char __int__() const throw(INTERP_KERNEL::Exception)
5669 return self->byteValue();
5672 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5674 return self->buildDAByte(1,self->getNumberOfCompo());
5679 class DataArrayAsciiCharIterator;
5681 class DataArrayAsciiChar : public DataArrayChar
5684 static DataArrayAsciiChar *New();
5685 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5686 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5687 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5690 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5692 return DataArrayAsciiChar::New();
5695 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5697 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) !";
5698 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5702 if(PyInt_Check(nbOfTuples))
5704 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5706 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5709 if(PyInt_Check(nbOfComp))
5710 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5711 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5713 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5714 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5715 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5716 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5720 throw INTERP_KERNEL::Exception(msg);
5723 {//DataArrayAsciiChar.New([1,3,4],3)
5724 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5726 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5727 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5731 else if(PyString_Check(nbOfTuples))
5733 if(PyString_Size(nbOfTuples)!=1)
5734 throw INTERP_KERNEL::Exception(msg);
5735 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5736 std::vector<std::string> tmp;
5737 if(fillStringVector(elt0,tmp))
5738 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5740 throw INTERP_KERNEL::Exception(msg);
5743 throw INTERP_KERNEL::Exception(msg);
5747 std::vector<std::string> tmmp;
5748 if(fillStringVector(elt0,tmmp))
5749 //DataArrayAsciiChar.New(["abc","de","fghi"])
5750 return DataArrayAsciiChar::New(tmmp,' ');
5753 // DataArrayAsciiChar.New([1,3,4])
5754 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5755 int tmpp1=-1,tmpp2=-1;
5756 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5757 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5762 else if(PyInt_Check(elt0))
5764 int nbOfTuples1=PyInt_AS_LONG(elt0);
5766 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5771 if(PyInt_Check(nbOfTuples))
5772 {//DataArrayAsciiChar.New(5,2)
5773 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5775 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5776 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5777 ret->alloc(nbOfTuples1,nbOfCompo);
5781 throw INTERP_KERNEL::Exception(msg);
5784 throw INTERP_KERNEL::Exception(msg);
5787 {//DataArrayAsciiChar.New(5)
5788 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5789 ret->alloc(nbOfTuples1,1);
5794 throw INTERP_KERNEL::Exception(msg);
5797 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5799 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5802 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5804 std::ostringstream oss;
5805 self->reprQuickOverview(oss);
5809 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5811 return self->iterator();
5814 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5816 char tmp[2]; tmp[1]='\0';
5817 tmp[0]=self->getIJ(tupleId,compoId);
5818 return std::string(tmp);
5821 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5823 char tmp[2]; tmp[1]='\0';
5824 tmp[0]=self->getIJSafe(tupleId,compoId);
5825 return std::string(tmp);
5828 std::string __str__() const throw(INTERP_KERNEL::Exception)
5830 return self->repr();
5833 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5835 const char *vals=self->getConstPointer();
5836 int nbOfComp=self->getNumberOfComponents();
5837 int nbOfTuples=self->getNumberOfTuples();
5838 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5841 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5843 if(PyString_Check(tupl))
5845 Py_ssize_t sz=PyString_Size(tupl);
5846 std::vector<char> vals(sz);
5847 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5848 return self->presenceOfTuple(vals);
5851 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5854 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5856 if(PyString_Check(vals))
5858 Py_ssize_t sz=PyString_Size(vals);
5859 std::vector<char> vals2(sz);
5860 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5861 return self->presenceOfValue(vals2);
5864 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5867 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5869 if(PyString_Check(vals))
5871 Py_ssize_t sz=PyString_Size(vals);
5872 std::vector<char> vals2(sz);
5873 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5874 return self->findIdFirstEqual(vals2);
5877 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5880 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5882 if(PyString_Check(tupl))
5884 Py_ssize_t sz=PyString_Size(tupl);
5885 std::vector<char> vals(sz);
5886 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5887 return self->findIdFirstEqualTuple(vals);
5890 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5893 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5895 if(PyString_Check(strOrListOfInt))
5897 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5898 std::vector<char> vals(sz);
5899 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5900 return self->findIdSequence(vals);
5903 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5906 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5908 int sz=self->getNumberOfComponents();
5909 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5910 self->getTuple(tupleId,tmp);
5911 return PyString_FromString(tmp);
5914 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5917 char tmp2[2]; tmp2[1]='\0';
5918 tmp2[0]=self->getMaxValue(tmp);
5919 PyObject *ret=PyTuple_New(2);
5920 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5921 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5925 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5928 char tmp2[2]; tmp2[1]='\0';
5929 tmp2[0]=self->getMinValue(tmp);
5930 PyObject *ret=PyTuple_New(2);
5931 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5932 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5936 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5938 int nbOfCompo=self->getNumberOfComponents();
5943 if(PyString_Check(obj))
5945 Py_ssize_t sz=PyString_Size(obj);
5946 char *pt=PyString_AsString(obj);
5948 return self->findIdFirstEqual(pt[0]);
5950 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5953 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5956 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5960 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5962 int nbOfCompo=self->getNumberOfComponents();
5969 if(PyString_Check(obj))
5971 Py_ssize_t sz=PyString_Size(obj);
5972 char *pt=PyString_AsString(obj);
5974 return self->presenceOfValue(pt[0]);
5976 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5979 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5982 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5986 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5989 std::vector<int> stdvecTyyppArr;
5990 std::pair<int, std::pair<int,int> > sTyyppArr;
5991 MEDCoupling::DataArrayInt *daIntTyypp=0;
5992 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5996 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5998 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
6000 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
6002 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
6004 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6008 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6010 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.";
6012 std::vector<int> stdvecTyyppArr;
6013 std::pair<int, std::pair<int,int> > sTyyppArr;
6014 MEDCoupling::DataArrayInt *daIntTyypp=0;
6015 int nbOfCompo=self->getNumberOfComponents();
6016 int nbOfTuples=self->getNumberOfTuples();
6017 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6019 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6020 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6029 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6035 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6036 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6039 //value vector<string>
6042 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6043 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6046 //value DataArrayChar
6049 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6053 throw INTERP_KERNEL::Exception(msg);
6057 {//obj list-tuple[int]
6063 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6069 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6070 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6073 //value vector<string>
6076 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6077 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6080 //value DataArrayChar
6083 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6087 throw INTERP_KERNEL::Exception(msg);
6098 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6104 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6105 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6108 //value vector<string>
6111 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6112 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6115 //value DataArrayChar
6118 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6122 throw INTERP_KERNEL::Exception(msg);
6133 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6139 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6140 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6143 //value vector<string>
6146 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6147 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6150 //value DataArrayChar
6153 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6157 throw INTERP_KERNEL::Exception(msg);
6162 throw INTERP_KERNEL::Exception(msg);
6168 class DataArrayAsciiCharTuple;
6170 class DataArrayAsciiCharIterator
6173 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6174 ~DataArrayAsciiCharIterator();
6179 DataArrayAsciiCharTuple *ret=self->nextt();
6181 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6184 PyErr_SetString(PyExc_StopIteration,"No more data.");
6191 class DataArrayAsciiCharTuple
6194 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6195 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6198 std::string __str__() const throw(INTERP_KERNEL::Exception)
6200 return self->repr();
6203 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6205 return self->buildDAAsciiChar(1,self->getNumberOfCompo());