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::fromNoInterlace;
90 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
91 %newobject MEDCoupling::DataArrayInt::buildComplement;
92 %newobject MEDCoupling::DataArrayInt::buildUnion;
93 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
94 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
95 %newobject MEDCoupling::DataArrayInt::buildIntersection;
96 %newobject MEDCoupling::DataArrayInt::buildUnique;
97 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
98 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
99 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
100 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
101 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
102 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
103 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
104 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
105 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
106 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
107 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
108 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
109 %newobject MEDCoupling::DataArrayInt::__neg__;
110 %newobject MEDCoupling::DataArrayInt::__add__;
111 %newobject MEDCoupling::DataArrayInt::__radd__;
112 %newobject MEDCoupling::DataArrayInt::__sub__;
113 %newobject MEDCoupling::DataArrayInt::__rsub__;
114 %newobject MEDCoupling::DataArrayInt::__mul__;
115 %newobject MEDCoupling::DataArrayInt::__rmul__;
116 %newobject MEDCoupling::DataArrayInt::__div__;
117 %newobject MEDCoupling::DataArrayInt::__rdiv__;
118 %newobject MEDCoupling::DataArrayInt::__mod__;
119 %newobject MEDCoupling::DataArrayInt::__rmod__;
120 %newobject MEDCoupling::DataArrayInt::__pow__;
121 %newobject MEDCoupling::DataArrayInt::__rpow__;
122 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
123 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
124 %newobject MEDCoupling::DataArrayChar::renumber;
125 %newobject MEDCoupling::DataArrayChar::renumberR;
126 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
127 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
128 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
129 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
130 %newobject MEDCoupling::DataArrayChar::Aggregate;
131 %newobject MEDCoupling::DataArrayChar::Meld;
132 %newobject MEDCoupling::DataArrayByte::New;
133 %newobject MEDCoupling::DataArrayByte::__iter__;
134 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
135 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
136 %newobject MEDCoupling::DataArrayChar::subArray;
137 %newobject MEDCoupling::DataArrayAsciiChar::New;
138 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
139 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
140 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
141 %newobject MEDCoupling::DataArrayDouble::New;
142 %newobject MEDCoupling::DataArrayDouble::__iter__;
143 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
144 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
145 %newobject MEDCoupling::DataArrayDouble::Aggregate;
146 %newobject MEDCoupling::DataArrayDouble::Meld;
147 %newobject MEDCoupling::DataArrayDouble::Dot;
148 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
149 %newobject MEDCoupling::DataArrayDouble::Add;
150 %newobject MEDCoupling::DataArrayDouble::Substract;
151 %newobject MEDCoupling::DataArrayDouble::Multiply;
152 %newobject MEDCoupling::DataArrayDouble::Divide;
153 %newobject MEDCoupling::DataArrayDouble::Pow;
154 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
155 %newobject MEDCoupling::DataArrayDouble::subArray;
156 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
157 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
158 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
159 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
160 %newobject MEDCoupling::DataArrayDouble::negate;
161 %newobject MEDCoupling::DataArrayDouble::computeAbs;
162 %newobject MEDCoupling::DataArrayDouble::applyFunc;
163 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
164 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
165 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
166 %newobject MEDCoupling::DataArrayDouble::determinant;
167 %newobject MEDCoupling::DataArrayDouble::eigenValues;
168 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
169 %newobject MEDCoupling::DataArrayDouble::inverse;
170 %newobject MEDCoupling::DataArrayDouble::trace;
171 %newobject MEDCoupling::DataArrayDouble::deviator;
172 %newobject MEDCoupling::DataArrayDouble::magnitude;
173 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
174 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
175 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
176 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
177 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
178 %newobject MEDCoupling::DataArrayDouble::renumber;
179 %newobject MEDCoupling::DataArrayDouble::renumberR;
180 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
181 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
182 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
183 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
184 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
185 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
186 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
187 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
188 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
189 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
190 %newobject MEDCoupling::DataArrayDouble::cartesianize;
191 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
192 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
193 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
194 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
195 %newobject MEDCoupling::DataArrayDouble::__neg__;
196 %newobject MEDCoupling::DataArrayDouble::__radd__;
197 %newobject MEDCoupling::DataArrayDouble::__rsub__;
198 %newobject MEDCoupling::DataArrayDouble::__rmul__;
199 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
200 %newobject MEDCoupling::DataArrayDouble::__pow__;
201 %newobject MEDCoupling::DataArrayDouble::__rpow__;
202 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
204 %feature("unref") DataArray "$this->decrRef();"
205 %feature("unref") DataArrayDouble "$this->decrRef();"
206 %feature("unref") DataArrayInt "$this->decrRef();"
207 %feature("unref") DataArrayChar "$this->decrRef();"
208 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
209 %feature("unref") DataArrayByte "$this->decrRef();"
211 namespace MEDCoupling
218 } MEDCouplingAxisType;
220 class DataArray : public RefCountObject, public TimeLabel
223 void setName(const std::string& name);
224 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
225 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
226 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
227 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
228 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
229 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
230 std::string getName() const;
231 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
232 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
233 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
234 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
235 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
236 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
237 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
238 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
239 int getNumberOfComponents() const;
240 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
241 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
242 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
243 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
244 virtual void desallocate() throw(INTERP_KERNEL::Exception);
245 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
246 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
247 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
248 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
249 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
250 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
251 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
252 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
253 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
254 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
255 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
256 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
257 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
258 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
259 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
260 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
261 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
262 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
263 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
264 void updateTime() const;
267 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
269 const std::vector<std::string>& comps=self->getInfoOnComponents();
270 PyObject *ret=PyList_New((int)comps.size());
271 for(int i=0;i<(int)comps.size();i++)
272 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
276 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
278 std::vector<int> tmp;
279 convertPyToNewIntArr3(li,tmp);
280 self->copyPartOfStringInfoFrom(other,tmp);
283 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
285 std::vector<int> tmp;
286 convertPyToNewIntArr3(li,tmp);
287 self->copyPartOfStringInfoFrom2(tmp,other);
290 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
293 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
294 if (!SWIG_IsOK(res1))
297 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
298 if(size!=self->getNumberOfTuples())
300 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
302 self->renumberInPlace(tmp);
306 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
308 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
309 da2->checkAllocated();
310 int size=self->getNumberOfTuples();
311 if(size!=self->getNumberOfTuples())
313 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
315 self->renumberInPlace(da2->getConstPointer());
319 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
322 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
323 if (!SWIG_IsOK(res1))
326 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
327 if(size!=self->getNumberOfTuples())
329 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
331 self->renumberInPlaceR(tmp);
335 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
337 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
338 da2->checkAllocated();
339 int size=self->getNumberOfTuples();
340 if(size!=self->getNumberOfTuples())
342 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
344 self->renumberInPlaceR(da2->getConstPointer());
348 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
349 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
351 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
352 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
353 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
354 DataArrayInt *tuplesSelecPtr2=0;
357 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
359 throw INTERP_KERNEL::Exception(msg);
361 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
364 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
366 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
367 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
370 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
372 std::vector<std::pair<int,int> > ranges;
373 convertPyToVectorPairInt(li,ranges);
374 return self->selectByTupleRanges(ranges);
377 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
380 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
381 if (!SWIG_IsOK(res1))
384 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
385 return self->selectByTupleId(tmp,tmp+size);
389 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
391 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
392 da2->checkAllocated();
393 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
397 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
400 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
401 if (!SWIG_IsOK(res1))
404 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
405 return self->selectByTupleIdSafe(tmp,tmp+size);
409 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
411 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
412 da2->checkAllocated();
413 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
417 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
419 std::vector<int> tmp;
420 convertPyToNewIntArr3(li,tmp);
421 DataArray *ret=self->keepSelectedComponents(tmp);
422 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
425 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
427 if(!PySlice_Check(slic))
428 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
429 Py_ssize_t strt=2,stp=2,step=2;
430 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
431 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
433 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
434 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
437 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
439 if(!PySlice_Check(slic))
440 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
441 Py_ssize_t strt=2,stp=2,step=2;
442 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
443 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
445 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
446 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
449 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
451 if(!PySlice_Check(slic))
452 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
453 Py_ssize_t strt=2,stp=2,step=2;
454 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
455 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
456 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
459 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
461 if(!PySlice_Check(slic))
462 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
463 Py_ssize_t strt=2,stp=2,step=2;
464 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
465 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
466 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
469 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
471 std::vector<const DataArray *> tmp;
472 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
473 return DataArray::Aggregate(tmp);
476 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
478 if(!PySlice_Check(slic))
479 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
480 Py_ssize_t strt=2,stp=2,step=2;
481 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
482 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
483 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
486 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
488 if(!PySlice_Check(slic))
489 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
490 Py_ssize_t strt=2,stp=2,step=2;
491 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
492 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
493 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
496 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
498 PyObject *ret(PyTuple_New(2));
499 std::string a0(self->getName());
500 const std::vector<std::string> &a1(self->getInfoOnComponents());
501 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
504 PyObject *ret1(PyList_New(sz));
505 for(int i=0;i<sz;i++)
506 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
507 PyTuple_SetItem(ret,1,ret1);
512 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
514 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 !";
515 if(!PyTuple_Check(inp))
516 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
517 int sz(PyTuple_Size(inp));
519 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
520 PyObject *a0(PyTuple_GetItem(inp,0));
521 if(!PyString_Check(a0))
522 throw INTERP_KERNEL::Exception(MSG);
523 PyObject *a1(PyTuple_GetItem(inp,1));
524 std::vector<std::string> a1cpp;
525 if(!fillStringVector(a1,a1cpp))
526 throw INTERP_KERNEL::Exception(MSG);
527 self->setName(PyString_AsString(a0));
528 self->setInfoOnComponents(a1cpp);
534 class DataArrayDoubleIterator;
536 class DataArrayDouble : public DataArray
539 static DataArrayDouble *New();
540 double doubleValue() const throw(INTERP_KERNEL::Exception);
541 bool empty() const throw(INTERP_KERNEL::Exception);
542 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
543 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
544 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
545 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
546 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
547 double popBackSilent() throw(INTERP_KERNEL::Exception);
548 void pack() const throw(INTERP_KERNEL::Exception);
549 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
550 void fillWithZero() throw(INTERP_KERNEL::Exception);
551 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
552 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
553 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
554 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
555 void reverse() throw(INTERP_KERNEL::Exception);
556 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
557 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
558 std::string repr() const throw(INTERP_KERNEL::Exception);
559 std::string reprZip() const throw(INTERP_KERNEL::Exception);
560 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
561 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
562 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
563 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
567 void transpose() throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
569 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
570 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
571 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
572 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
573 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
574 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
575 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
576 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
577 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
578 double front() const throw(INTERP_KERNEL::Exception);
579 double back() const throw(INTERP_KERNEL::Exception);
580 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
581 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
582 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
583 double *getPointer() throw(INTERP_KERNEL::Exception);
584 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
585 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
586 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
587 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
588 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
589 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
590 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
591 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
592 double getAverageValue() const throw(INTERP_KERNEL::Exception);
593 double norm2() const throw(INTERP_KERNEL::Exception);
594 double normMax() const throw(INTERP_KERNEL::Exception);
595 double normMin() const throw(INTERP_KERNEL::Exception);
596 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
609 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
610 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
611 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
612 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
613 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
616 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
617 void abs() throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
619 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
620 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
621 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
622 void applyPow(double val) throw(INTERP_KERNEL::Exception);
623 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
624 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
625 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
626 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
627 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
628 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
629 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
630 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
631 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
632 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
633 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
634 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
635 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
636 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
637 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
638 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
639 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
640 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
641 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
642 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
643 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
644 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
645 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
646 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
647 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
648 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
649 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
650 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
653 DataArrayDouble() throw(INTERP_KERNEL::Exception)
655 return DataArrayDouble::New();
658 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
660 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)";
661 std::string msg(msgBase);
663 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
666 if(PyList_Check(elt0) || PyTuple_Check(elt0))
670 if(PyInt_Check(nbOfTuples))
672 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
674 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
677 if(PyInt_Check(elt2))
678 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
679 int nbOfCompo=PyInt_AS_LONG(elt2);
681 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
682 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
683 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
684 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
688 throw INTERP_KERNEL::Exception(msg.c_str());
691 {//DataArrayDouble.New([1.,3.,4.],3)
692 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
694 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
695 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
700 throw INTERP_KERNEL::Exception(msg.c_str());
703 {// DataArrayDouble.New([1.,3.,4.])
704 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
705 int tmpp1=-1,tmpp2=-1;
706 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
707 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
711 else if(PyInt_Check(elt0))
713 int nbOfTuples1=PyInt_AS_LONG(elt0);
715 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
720 if(PyInt_Check(nbOfTuples))
721 {//DataArrayDouble.New(5,2)
722 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
724 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
725 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
726 ret->alloc(nbOfTuples1,nbOfCompo);
730 throw INTERP_KERNEL::Exception(msg.c_str());
733 throw INTERP_KERNEL::Exception(msg.c_str());
736 {//DataArrayDouble.New(5)
737 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
738 ret->alloc(nbOfTuples1,1);
743 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
744 {//DataArrayDouble.New(numpyArray)
745 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
749 throw INTERP_KERNEL::Exception(msg.c_str());
750 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
753 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
755 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
758 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
761 std::vector<double> bb;
763 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
764 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
765 self->pushBackValsSilent(tmp,tmp+nbTuples);
768 std::string __repr__() const throw(INTERP_KERNEL::Exception)
770 std::ostringstream oss;
771 self->reprQuickOverview(oss);
775 std::string __str__() const throw(INTERP_KERNEL::Exception)
777 return self->reprNotTooLong();
780 double __float__() const throw(INTERP_KERNEL::Exception)
782 return self->doubleValue();
785 int __len__() const throw(INTERP_KERNEL::Exception)
787 if(self->isAllocated())
789 return self->getNumberOfTuples();
793 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
797 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
799 return self->iterator();
802 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
804 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 !";
805 if(PyList_Check(li) || PyTuple_Check(li))
809 if(PyInt_Check(nbOfTuples))
811 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
813 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
816 if(PyInt_Check(nbOfComp))
817 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
818 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
820 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
821 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
822 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
825 throw INTERP_KERNEL::Exception(msg);
828 {//DataArrayDouble.setValues([1.,3.,4.],3)
830 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
831 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
835 throw INTERP_KERNEL::Exception(msg);
838 {// DataArrayDouble.setValues([1.,3.,4.])
839 int tmpp1=-1,tmpp2=-1;
840 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
841 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
845 throw INTERP_KERNEL::Exception(msg);
848 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
850 const double *vals=self->getConstPointer();
851 return convertDblArrToPyList(vals,self->getNbOfElems());
855 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
857 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
861 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
864 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
865 PyObject *ret=PyTuple_New(2);
866 PyObject *ret0Py=ret0?Py_True:Py_False;
868 PyTuple_SetItem(ret,0,ret0Py);
869 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
873 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
875 const double *vals=self->getConstPointer();
876 int nbOfComp=self->getNumberOfComponents();
877 int nbOfTuples=self->getNumberOfTuples();
878 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
881 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
883 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
885 DataArrayDouble *a,*a2;
886 DataArrayDoubleTuple *aa,*aa2;
887 std::vector<double> bb,bb2;
889 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
890 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
891 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
895 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
897 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
899 DataArrayDouble *a,*a2;
900 DataArrayDoubleTuple *aa,*aa2;
901 std::vector<double> bb,bb2;
903 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
905 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
906 return convertDblArrToPyListOfTuple(res,3,3);
909 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
911 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
913 DataArrayDouble *a,*a2;
914 DataArrayDoubleTuple *aa,*aa2;
915 std::vector<double> bb,bb2;
917 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
918 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
919 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
922 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
925 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
926 if (!SWIG_IsOK(res1))
929 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
930 if(size!=self->getNumberOfTuples())
932 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
934 return self->renumber(tmp);
938 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
940 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
941 da2->checkAllocated();
942 int size=self->getNumberOfTuples();
943 if(size!=self->getNumberOfTuples())
945 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
947 return self->renumber(da2->getConstPointer());
951 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
954 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
955 if (!SWIG_IsOK(res1))
958 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
959 if(size!=self->getNumberOfTuples())
961 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
963 return self->renumberR(tmp);
967 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
969 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
970 da2->checkAllocated();
971 int size=self->getNumberOfTuples();
972 if(size!=self->getNumberOfTuples())
974 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
976 return self->renumberR(da2->getConstPointer());
980 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
983 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
984 if (!SWIG_IsOK(res1))
987 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
988 if(size!=self->getNumberOfTuples())
990 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
992 return self->renumberAndReduce(tmp,newNbOfTuple);
996 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
998 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
999 da2->checkAllocated();
1000 int size=self->getNumberOfTuples();
1001 if(size!=self->getNumberOfTuples())
1003 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1005 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1009 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1011 int thisTupleId,otherTupleId;
1012 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1013 PyObject *ret=PyTuple_New(3);
1014 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1015 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1016 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1020 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1023 double r1=self->getMaxValue(tmp);
1024 PyObject *ret=PyTuple_New(2);
1025 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1026 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1030 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1033 double r1=self->getMaxValue2(tmp);
1034 PyObject *ret=PyTuple_New(2);
1035 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1036 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1040 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1043 double r1=self->getMinValue(tmp);
1044 PyObject *ret=PyTuple_New(2);
1045 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1046 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1050 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1053 double r1=self->getMinValue2(tmp);
1054 PyObject *ret=PyTuple_New(2);
1055 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1056 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1060 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1062 int nbOfCompo=self->getNumberOfComponents();
1063 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1064 self->getMinMaxPerComponent(tmp);
1065 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1069 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1071 int sz=self->getNumberOfComponents();
1072 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1073 self->accumulate(tmp);
1074 return convertDblArrToPyList(tmp,sz);
1077 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1080 std::vector<int> val2;
1081 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1082 return self->accumulatePerChunck(bg,bg+sz);
1085 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1087 DataArrayInt *comm, *commIndex;
1088 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1089 PyObject *res = PyList_New(2);
1090 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1091 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1095 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1099 DataArrayDoubleTuple *aa;
1100 std::vector<double> bb;
1102 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1103 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1105 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1106 PyObject *ret=PyTuple_New(2);
1107 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1108 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1112 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1114 std::vector<int> tmp;
1115 convertPyToNewIntArr3(li,tmp);
1116 self->setSelectedComponents(a,tmp);
1119 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1121 int sz=self->getNumberOfComponents();
1122 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1123 self->getTuple(tupleId,tmp);
1124 return convertDblArrToPyList(tmp,sz);
1127 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1129 std::vector<const DataArrayDouble *> tmp;
1130 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1131 return DataArrayDouble::Aggregate(tmp);
1134 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1136 std::vector<const DataArrayDouble *> tmp;
1137 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1138 return DataArrayDouble::Meld(tmp);
1141 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1145 DataArrayDoubleTuple *aa;
1146 std::vector<double> bb;
1148 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1149 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1150 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1151 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1152 DataArrayInt *c=0,*cI=0;
1153 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1154 PyObject *ret=PyTuple_New(2);
1155 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1156 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1160 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1162 DataArrayInt *ret1=0;
1163 bool ret0=self->areIncludedInMe(other,prec,ret1);
1164 PyObject *ret=PyTuple_New(2);
1165 PyObject *ret0Py=ret0?Py_True:Py_False;
1167 PyTuple_SetItem(ret,0,ret0Py);
1168 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1172 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1174 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1175 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1176 self->checkAllocated();
1177 int nbOfTuples=self->getNumberOfTuples();
1178 int nbOfComponents=self->getNumberOfComponents();
1180 std::vector<int> vt1,vc1;
1181 std::pair<int, std::pair<int,int> > pt1,pc1;
1182 DataArrayInt *dt1=0,*dc1=0;
1184 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1185 MCAuto<DataArrayDouble> ret;
1189 if(nbOfComponents==1)
1190 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1191 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1193 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1195 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1197 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1199 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1202 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1203 std::vector<int> v2(1,ic1);
1204 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1208 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1209 std::vector<int> v2(1,ic1);
1210 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1214 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1215 std::vector<int> v2(1,ic1);
1216 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1220 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1221 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1225 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1226 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1230 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1231 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1235 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1236 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1240 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1241 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1242 std::vector<int> v2(nbOfComp);
1243 for(int i=0;i<nbOfComp;i++)
1244 v2[i]=pc1.first+i*pc1.second.second;
1245 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1249 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1250 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1251 std::vector<int> v2(nbOfComp);
1252 for(int i=0;i<nbOfComp;i++)
1253 v2[i]=pc1.first+i*pc1.second.second;
1254 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1258 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1259 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1260 std::vector<int> v2(nbOfComp);
1261 for(int i=0;i<nbOfComp;i++)
1262 v2[i]=pc1.first+i*pc1.second.second;
1263 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1267 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1268 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1269 std::vector<int> v2(nbOfComp);
1270 for(int i=0;i<nbOfComp;i++)
1271 v2[i]=pc1.first+i*pc1.second.second;
1272 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1275 throw INTERP_KERNEL::Exception(msg);
1279 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1281 self->checkAllocated();
1282 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1283 int nbOfTuples=self->getNumberOfTuples();
1284 int nbOfComponents=self->getNumberOfComponents();
1287 std::vector<double> v1;
1288 DataArrayDouble *d1=0;
1289 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1291 std::vector<int> vt1,vc1;
1292 std::pair<int, std::pair<int,int> > pt1,pc1;
1293 DataArrayInt *dt1=0,*dc1=0;
1294 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1295 MCAuto<DataArrayDouble> tmp;
1303 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1306 tmp=DataArrayDouble::New();
1307 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1308 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1311 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1314 throw INTERP_KERNEL::Exception(msg);
1323 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1326 tmp=DataArrayDouble::New();
1327 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1328 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1331 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1334 throw INTERP_KERNEL::Exception(msg);
1343 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1346 tmp=DataArrayDouble::New();
1347 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1348 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1351 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1354 throw INTERP_KERNEL::Exception(msg);
1363 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1366 tmp=DataArrayDouble::New();
1367 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1368 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1371 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1374 throw INTERP_KERNEL::Exception(msg);
1383 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1386 tmp=DataArrayDouble::New();
1387 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1388 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1391 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1394 throw INTERP_KERNEL::Exception(msg);
1403 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1406 tmp=DataArrayDouble::New();
1407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1408 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1411 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1414 throw INTERP_KERNEL::Exception(msg);
1423 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1426 tmp=DataArrayDouble::New();
1427 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1428 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1431 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1434 throw INTERP_KERNEL::Exception(msg);
1443 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1446 tmp=DataArrayDouble::New();
1447 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1448 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1451 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1454 throw INTERP_KERNEL::Exception(msg);
1463 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1466 tmp=DataArrayDouble::New();
1467 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1468 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1471 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1474 throw INTERP_KERNEL::Exception(msg);
1483 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1486 tmp=DataArrayDouble::New();
1487 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1488 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1491 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1494 throw INTERP_KERNEL::Exception(msg);
1503 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1506 tmp=DataArrayDouble::New();
1507 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1508 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1511 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1514 throw INTERP_KERNEL::Exception(msg);
1523 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1526 tmp=DataArrayDouble::New();
1527 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1528 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1531 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1534 throw INTERP_KERNEL::Exception(msg);
1543 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1546 tmp=DataArrayDouble::New();
1547 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1548 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1551 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1554 throw INTERP_KERNEL::Exception(msg);
1563 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1566 tmp=DataArrayDouble::New();
1567 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1568 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1571 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1574 throw INTERP_KERNEL::Exception(msg);
1583 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1586 tmp=DataArrayDouble::New();
1587 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1588 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1591 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1594 throw INTERP_KERNEL::Exception(msg);
1603 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1606 tmp=DataArrayDouble::New();
1607 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1608 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1611 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1614 throw INTERP_KERNEL::Exception(msg);
1619 throw INTERP_KERNEL::Exception(msg);
1624 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1626 return self->negate();
1629 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1631 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1634 DataArrayDoubleTuple *aa;
1635 std::vector<double> bb;
1638 #ifndef WITHOUT_AUTOFIELD
1640 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1642 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1645 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1646 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1648 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1651 throw INTERP_KERNEL::Exception(msg);
1655 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1660 MCAuto<DataArrayDouble> ret=self->deepCopy();
1661 ret->applyLin(1.,val);
1662 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1666 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1670 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1671 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1675 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1676 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1679 throw INTERP_KERNEL::Exception(msg);
1683 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1685 const char msg[]="Unexpected situation in __radd__ !";
1688 DataArrayDoubleTuple *aa;
1689 std::vector<double> bb;
1691 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1696 MCAuto<DataArrayDouble> ret=self->deepCopy();
1697 ret->applyLin(1.,val);
1702 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1703 return DataArrayDouble::Add(self,aaa);
1707 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1708 return DataArrayDouble::Add(self,aaa);
1711 throw INTERP_KERNEL::Exception(msg);
1715 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1717 const char msg[]="Unexpected situation in __iadd__ !";
1720 DataArrayDoubleTuple *aa;
1721 std::vector<double> bb;
1723 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1728 self->applyLin(1.,val);
1729 Py_XINCREF(trueSelf);
1735 Py_XINCREF(trueSelf);
1740 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1741 self->addEqual(aaa);
1742 Py_XINCREF(trueSelf);
1747 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1748 self->addEqual(aaa);
1749 Py_XINCREF(trueSelf);
1753 throw INTERP_KERNEL::Exception(msg);
1757 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1759 const char msg[]="Unexpected situation in __sub__ !";
1762 DataArrayDoubleTuple *aa;
1763 std::vector<double> bb;
1766 #ifndef WITHOUT_AUTOFIELD
1768 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1770 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1773 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1774 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1776 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1779 throw INTERP_KERNEL::Exception(msg);
1783 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1788 MCAuto<DataArrayDouble> ret=self->deepCopy();
1789 ret->applyLin(1.,-val);
1790 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1794 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1798 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1799 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1803 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1804 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1807 throw INTERP_KERNEL::Exception(msg);
1811 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1813 const char msg[]="Unexpected situation in __rsub__ !";
1816 DataArrayDoubleTuple *aa;
1817 std::vector<double> bb;
1819 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1824 MCAuto<DataArrayDouble> ret=self->deepCopy();
1825 ret->applyLin(-1.,val);
1830 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1831 return DataArrayDouble::Substract(aaa,self);
1835 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1836 return DataArrayDouble::Substract(aaa,self);
1839 throw INTERP_KERNEL::Exception(msg);
1843 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1845 const char msg[]="Unexpected situation in __isub__ !";
1848 DataArrayDoubleTuple *aa;
1849 std::vector<double> bb;
1851 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1856 self->applyLin(1,-val);
1857 Py_XINCREF(trueSelf);
1862 self->substractEqual(a);
1863 Py_XINCREF(trueSelf);
1868 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1869 self->substractEqual(aaa);
1870 Py_XINCREF(trueSelf);
1875 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1876 self->substractEqual(aaa);
1877 Py_XINCREF(trueSelf);
1881 throw INTERP_KERNEL::Exception(msg);
1885 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1887 const char msg[]="Unexpected situation in __mul__ !";
1890 DataArrayDoubleTuple *aa;
1891 std::vector<double> bb;
1894 #ifndef WITHOUT_AUTOFIELD
1896 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1898 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1901 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1902 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1904 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1907 throw INTERP_KERNEL::Exception(msg);
1911 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1916 MCAuto<DataArrayDouble> ret=self->deepCopy();
1917 ret->applyLin(val,0.);
1918 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1922 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1926 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1927 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1931 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1932 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1935 throw INTERP_KERNEL::Exception(msg);
1939 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1941 const char msg[]="Unexpected situation in __rmul__ !";
1944 DataArrayDoubleTuple *aa;
1945 std::vector<double> bb;
1947 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1952 MCAuto<DataArrayDouble> ret=self->deepCopy();
1953 ret->applyLin(val,0.);
1958 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1959 return DataArrayDouble::Multiply(self,aaa);
1963 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1964 return DataArrayDouble::Multiply(self,aaa);
1967 throw INTERP_KERNEL::Exception(msg);
1971 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1973 const char msg[]="Unexpected situation in __imul__ !";
1976 DataArrayDoubleTuple *aa;
1977 std::vector<double> bb;
1979 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1984 self->applyLin(val,0.);
1985 Py_XINCREF(trueSelf);
1990 self->multiplyEqual(a);
1991 Py_XINCREF(trueSelf);
1996 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1997 self->multiplyEqual(aaa);
1998 Py_XINCREF(trueSelf);
2003 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2004 self->multiplyEqual(aaa);
2005 Py_XINCREF(trueSelf);
2009 throw INTERP_KERNEL::Exception(msg);
2013 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2015 const char msg[]="Unexpected situation in __div__ !";
2018 DataArrayDoubleTuple *aa;
2019 std::vector<double> bb;
2022 #ifndef WITHOUT_AUTOFIELD
2024 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2026 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2029 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2030 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2032 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2035 throw INTERP_KERNEL::Exception(msg);
2039 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2045 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2046 MCAuto<DataArrayDouble> ret=self->deepCopy();
2047 ret->applyLin(1/val,0.);
2048 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2052 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2056 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2057 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2061 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2062 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2065 throw INTERP_KERNEL::Exception(msg);
2069 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2071 const char msg[]="Unexpected situation in __rdiv__ !";
2074 DataArrayDoubleTuple *aa;
2075 std::vector<double> bb;
2077 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2082 MCAuto<DataArrayDouble> ret=self->deepCopy();
2088 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2089 return DataArrayDouble::Divide(aaa,self);
2093 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2094 return DataArrayDouble::Divide(aaa,self);
2097 throw INTERP_KERNEL::Exception(msg);
2101 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2103 const char msg[]="Unexpected situation in __idiv__ !";
2106 DataArrayDoubleTuple *aa;
2107 std::vector<double> bb;
2109 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2115 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2116 self->applyLin(1./val,0.);
2117 Py_XINCREF(trueSelf);
2122 self->divideEqual(a);
2123 Py_XINCREF(trueSelf);
2128 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2129 self->divideEqual(aaa);
2130 Py_XINCREF(trueSelf);
2135 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2136 self->divideEqual(aaa);
2137 Py_XINCREF(trueSelf);
2141 throw INTERP_KERNEL::Exception(msg);
2145 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2147 const char msg[]="Unexpected situation in __pow__ !";
2150 DataArrayDoubleTuple *aa;
2151 std::vector<double> bb;
2153 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2158 MCAuto<DataArrayDouble> ret=self->deepCopy();
2164 return DataArrayDouble::Pow(self,a);
2168 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2169 return DataArrayDouble::Pow(self,aaa);
2173 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2174 return DataArrayDouble::Pow(self,aaa);
2177 throw INTERP_KERNEL::Exception(msg);
2181 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2183 const char msg[]="Unexpected situation in __rpow__ !";
2186 DataArrayDoubleTuple *aa;
2187 std::vector<double> bb;
2189 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2194 MCAuto<DataArrayDouble> ret=self->deepCopy();
2195 ret->applyRPow(val);
2200 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2201 return DataArrayDouble::Pow(aaa,self);
2205 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2206 return DataArrayDouble::Pow(aaa,self);
2209 throw INTERP_KERNEL::Exception(msg);
2213 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2215 const char msg[]="Unexpected situation in __ipow__ !";
2218 DataArrayDoubleTuple *aa;
2219 std::vector<double> bb;
2221 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2226 self->applyPow(val);
2227 Py_XINCREF(trueSelf);
2233 Py_XINCREF(trueSelf);
2238 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2239 self->powEqual(aaa);
2240 Py_XINCREF(trueSelf);
2245 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2246 self->powEqual(aaa);
2247 Py_XINCREF(trueSelf);
2251 throw INTERP_KERNEL::Exception(msg);
2255 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2257 DataArrayInt *c=0,*cI=0;
2259 self->computeTupleIdsNearTuples(other,eps,c,cI);
2260 PyObject *ret=PyTuple_New(2);
2261 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2262 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2266 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2268 DataArrayInt *ret1=0;
2269 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2270 PyObject *ret=PyTuple_New(2);
2271 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2272 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2277 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2279 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2282 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2285 if(!self->isAllocated())
2286 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2287 PyObject *ret(PyTuple_New(1));
2288 PyObject *ret0(PyDict_New());
2289 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2290 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2291 PyObject *tmp1(PyInt_FromLong(0));
2292 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2293 PyTuple_SetItem(ret,0,ret0);
2297 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2303 class DataArrayDoubleTuple;
2305 class DataArrayDoubleIterator
2308 DataArrayDoubleIterator(DataArrayDouble *da);
2309 ~DataArrayDoubleIterator();
2314 DataArrayDoubleTuple *ret=self->nextt();
2316 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2319 PyErr_SetString(PyExc_StopIteration,"No more data.");
2326 class DataArrayDoubleTuple
2329 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2330 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2333 std::string __str__() const throw(INTERP_KERNEL::Exception)
2335 return self->repr();
2338 double __float__() const throw(INTERP_KERNEL::Exception)
2340 return self->doubleValue();
2343 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2345 return self->buildDADouble(1,self->getNumberOfCompo());
2348 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2350 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2351 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2352 Py_XINCREF(trueSelf);
2356 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2358 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2359 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2360 Py_XINCREF(trueSelf);
2364 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2366 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2367 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2368 Py_XINCREF(trueSelf);
2372 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2374 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2375 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2376 Py_XINCREF(trueSelf);
2380 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2382 return PyInt_FromLong(self->getNumberOfCompo());
2385 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2387 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2390 std::vector<int> multiVal;
2391 std::pair<int, std::pair<int,int> > slic;
2392 MEDCoupling::DataArrayInt *daIntTyypp=0;
2393 const double *pt=self->getConstPointer();
2394 int nbc=self->getNumberOfCompo();
2395 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2402 std::ostringstream oss;
2403 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2404 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2408 return PyFloat_FromDouble(pt[singleVal]);
2412 return PyFloat_FromDouble(pt[nbc+singleVal]);
2415 std::ostringstream oss;
2416 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2417 throw INTERP_KERNEL::Exception(oss.str().c_str());
2423 PyObject *t=PyTuple_New(multiVal.size());
2424 for(int j=0;j<(int)multiVal.size();j++)
2426 int cid=multiVal[j];
2429 std::ostringstream oss;
2430 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2431 throw INTERP_KERNEL::Exception(oss.str().c_str());
2433 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2439 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2440 PyObject *t=PyTuple_New(sz);
2441 for(int j=0;j<sz;j++)
2442 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2446 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2450 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2452 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2453 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2456 std::vector<double> multiValV;
2457 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2458 int nbc=self->getNumberOfCompo();
2459 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2461 std::vector<int> multiVal;
2462 std::pair<int, std::pair<int,int> > slic;
2463 MEDCoupling::DataArrayInt *daIntTyypp=0;
2464 double *pt=self->getPointer();
2465 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2472 std::ostringstream oss;
2473 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2474 throw INTERP_KERNEL::Exception(oss.str().c_str());
2480 pt[singleVal]=singleValV;
2485 if(multiValV.size()!=1)
2487 std::ostringstream oss;
2488 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2489 throw INTERP_KERNEL::Exception(oss.str().c_str());
2491 pt[singleVal]=multiValV[0];
2496 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2500 throw INTERP_KERNEL::Exception(msg);
2509 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2513 std::ostringstream oss;
2514 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2515 throw INTERP_KERNEL::Exception(oss.str().c_str());
2523 if(multiVal.size()!=multiValV.size())
2525 std::ostringstream oss;
2526 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2527 throw INTERP_KERNEL::Exception(oss.str().c_str());
2529 for(int i=0;i<(int)multiVal.size();i++)
2531 int pos=multiVal[i];
2534 std::ostringstream oss;
2535 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2536 throw INTERP_KERNEL::Exception(oss.str().c_str());
2538 pt[multiVal[i]]=multiValV[i];
2544 const double *ptV=daIntTyyppV->getConstPointer();
2545 if(nbc>daIntTyyppV->getNumberOfCompo())
2547 std::ostringstream oss;
2548 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2549 throw INTERP_KERNEL::Exception(oss.str().c_str());
2551 std::copy(ptV,ptV+nbc,pt);
2555 throw INTERP_KERNEL::Exception(msg);
2560 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2565 for(int j=0;j<sz;j++)
2566 pt[slic.first+j*slic.second.second]=singleValV;
2571 if(sz!=(int)multiValV.size())
2573 std::ostringstream oss;
2574 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2575 throw INTERP_KERNEL::Exception(oss.str().c_str());
2577 for(int j=0;j<sz;j++)
2578 pt[slic.first+j*slic.second.second]=multiValV[j];
2583 const double *ptV=daIntTyyppV->getConstPointer();
2584 if(sz>daIntTyyppV->getNumberOfCompo())
2586 std::ostringstream oss;
2587 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2588 throw INTERP_KERNEL::Exception(oss.str().c_str());
2590 for(int j=0;j<sz;j++)
2591 pt[slic.first+j*slic.second.second]=ptV[j];
2595 throw INTERP_KERNEL::Exception(msg);
2599 throw INTERP_KERNEL::Exception(msg);
2605 class DataArrayIntIterator;
2607 class DataArrayInt : public DataArray
2610 static DataArrayInt *New();
2611 int intValue() const throw(INTERP_KERNEL::Exception);
2612 int getHashCode() const throw(INTERP_KERNEL::Exception);
2613 bool empty() const throw(INTERP_KERNEL::Exception);
2614 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2615 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2616 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2617 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2618 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2619 int popBackSilent() throw(INTERP_KERNEL::Exception);
2620 void pack() const throw(INTERP_KERNEL::Exception);
2621 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2622 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2623 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2624 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2625 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2626 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2627 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2628 void reverse() throw(INTERP_KERNEL::Exception);
2629 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2630 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2631 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2632 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2633 void fillWithZero() throw(INTERP_KERNEL::Exception);
2634 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2635 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2636 std::string repr() const throw(INTERP_KERNEL::Exception);
2637 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2638 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2639 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2640 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2641 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2642 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2643 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2644 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2645 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2646 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2647 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2648 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2649 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2650 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2651 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2652 void transpose() throw(INTERP_KERNEL::Exception);
2653 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2654 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2655 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2656 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2657 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2658 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2659 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2660 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2661 int front() const throw(INTERP_KERNEL::Exception);
2662 int back() const throw(INTERP_KERNEL::Exception);
2663 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2664 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2665 int *getPointer() throw(INTERP_KERNEL::Exception);
2666 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2667 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2668 const int *begin() const throw(INTERP_KERNEL::Exception);
2669 const int *end() const throw(INTERP_KERNEL::Exception);
2670 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2671 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2672 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2673 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2674 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2675 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2676 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2677 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2678 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2679 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2680 int count(int value) const throw(INTERP_KERNEL::Exception);
2681 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2682 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2683 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2684 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2685 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2686 void abs() throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2688 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2689 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2690 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2691 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2692 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2693 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2694 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2695 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2696 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2697 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2698 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2699 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2700 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2701 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2702 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2703 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2704 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2705 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2706 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2707 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2708 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2709 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2710 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2711 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2712 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2713 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2714 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2715 void computeOffsets() throw(INTERP_KERNEL::Exception);
2716 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2717 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2718 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2719 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2720 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2721 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2722 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2723 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2724 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2725 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2726 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2727 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2728 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2729 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2730 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2731 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2732 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2733 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2734 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2736 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2739 DataArrayInt() throw(INTERP_KERNEL::Exception)
2741 return DataArrayInt::New();
2744 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2746 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)";
2747 std::string msg(msgBase);
2749 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2752 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2756 if(PyInt_Check(nbOfTuples))
2758 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2760 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2763 if(PyInt_Check(nbOfComp))
2764 {//DataArrayInt.New([1,3,4,5],2,2)
2765 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2767 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2768 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2769 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2770 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2774 throw INTERP_KERNEL::Exception(msg.c_str());
2777 {//DataArrayInt.New([1,3,4],3)
2778 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2780 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2781 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2786 throw INTERP_KERNEL::Exception(msg.c_str());
2789 {// DataArrayInt.New([1,3,4])
2790 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2791 int tmpp1=-1,tmpp2=-1;
2792 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2793 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2797 else if(PyInt_Check(elt0))
2799 int nbOfTuples1=PyInt_AS_LONG(elt0);
2801 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2806 if(PyInt_Check(nbOfTuples))
2807 {//DataArrayInt.New(5,2)
2808 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2810 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2811 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2812 ret->alloc(nbOfTuples1,nbOfCompo);
2816 throw INTERP_KERNEL::Exception(msg.c_str());
2819 throw INTERP_KERNEL::Exception(msg.c_str());
2822 {//DataArrayInt.New(5)
2823 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2824 ret->alloc(nbOfTuples1,1);
2829 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2830 {//DataArrayInt.New(numpyArray)
2831 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2835 throw INTERP_KERNEL::Exception(msg.c_str());
2836 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2839 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2841 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2844 std::string __str__() const throw(INTERP_KERNEL::Exception)
2846 return self->reprNotTooLong();
2849 int __len__() const throw(INTERP_KERNEL::Exception)
2851 if(self->isAllocated())
2853 return self->getNumberOfTuples();
2857 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2861 int __int__() const throw(INTERP_KERNEL::Exception)
2863 return self->intValue();
2866 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2868 return self->iterator();
2871 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2873 int sz=self->getNumberOfComponents();
2874 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2875 self->accumulate(tmp);
2876 return convertIntArrToPyList(tmp,sz);
2879 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2882 std::vector<int> val2;
2883 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2884 return self->accumulatePerChunck(bg,bg+sz);
2887 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2890 std::vector<int> val2;
2891 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2892 return self->findIdsEqualTuple(bg,bg+sz);
2895 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2897 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2898 PyObject *ret=PyList_New(slcs.size());
2899 for(std::size_t i=0;i<slcs.size();i++)
2900 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2904 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2906 if(!PySlice_Check(slic))
2907 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2908 Py_ssize_t strt=2,stp=2,step=2;
2909 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2910 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2911 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2912 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 !");
2913 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2916 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2919 self->getMinMaxValues(a,b);
2920 PyObject *ret=PyTuple_New(2);
2921 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2922 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2926 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2928 int newNbOfTuples=-1;
2929 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2930 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2931 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2932 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2933 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2934 PyObject *ret=PyTuple_New(2);
2935 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2936 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2940 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2942 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2943 int szArr,sw,iTypppArr;
2944 std::vector<int> stdvecTyyppArr;
2945 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2946 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2947 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2951 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2953 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 !";
2954 if(PyList_Check(li) || PyTuple_Check(li))
2956 if(nbOfTuples && nbOfTuples != Py_None)
2958 if(PyInt_Check(nbOfTuples))
2960 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2962 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2963 if(nbOfComp && nbOfComp != Py_None)
2965 if(PyInt_Check(nbOfComp))
2966 {//DataArrayInt.setValues([1,3,4,5],2,2)
2967 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2969 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2970 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2971 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2974 throw INTERP_KERNEL::Exception(msg);
2977 {//DataArrayInt.setValues([1,3,4],3)
2979 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2980 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2984 throw INTERP_KERNEL::Exception(msg);
2987 {// DataArrayInt.setValues([1,3,4])
2988 int tmpp1=-1,tmpp2=-1;
2989 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2990 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2994 throw INTERP_KERNEL::Exception(msg);
2997 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2999 const int *vals=self->getConstPointer();
3000 return convertIntArrToPyList(vals,self->getNbOfElems());
3004 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3006 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3010 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3013 bool ret0=self->isEqualIfNotWhy(other,ret1);
3014 PyObject *ret=PyTuple_New(2);
3015 PyObject *ret0Py=ret0?Py_True:Py_False;
3017 PyTuple_SetItem(ret,0,ret0Py);
3018 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3022 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3024 const int *vals=self->getConstPointer();
3025 int nbOfComp=self->getNumberOfComponents();
3026 int nbOfTuples=self->getNumberOfTuples();
3027 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3030 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3032 std::vector<const DataArrayInt *> groups;
3033 std::vector< std::vector<int> > fidsOfGroups;
3034 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3035 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3036 PyObject *ret = PyList_New(2);
3037 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3038 int sz=fidsOfGroups.size();
3039 PyObject *ret1 = PyList_New(sz);
3040 for(int i=0;i<sz;i++)
3041 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3042 PyList_SetItem(ret,1,ret1);
3046 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3049 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3050 if (!SWIG_IsOK(res1))
3053 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3054 self->transformWithIndArr(tmp,tmp+size);
3058 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3059 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3063 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3067 std::vector<int> multiVal;
3068 std::pair<int, std::pair<int,int> > slic;
3069 MEDCoupling::DataArrayInt *daIntTyypp=0;
3070 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3074 return self->findIdsEqualList(&singleVal,&singleVal+1);
3076 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3078 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3080 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3084 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3088 std::vector<int> multiVal;
3089 std::pair<int, std::pair<int,int> > slic;
3090 MEDCoupling::DataArrayInt *daIntTyypp=0;
3091 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3095 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3097 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3099 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3101 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3105 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3107 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3109 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3110 if (!SWIG_IsOK(res1))
3113 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3114 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3118 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3120 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3121 da2->checkAllocated();
3122 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3124 PyObject *ret = PyList_New(3);
3125 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3126 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3127 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3131 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3134 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3135 if (!SWIG_IsOK(res1))
3138 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3139 return self->transformWithIndArrR(tmp,tmp+size);
3143 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3144 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3148 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3151 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3152 if (!SWIG_IsOK(res1))
3155 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3156 if(size!=self->getNumberOfTuples())
3158 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3160 return self->renumberAndReduce(tmp,newNbOfTuple);
3164 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3166 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3167 da2->checkAllocated();
3168 int size=self->getNumberOfTuples();
3169 if(size!=self->getNumberOfTuples())
3171 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3173 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3177 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3180 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3181 if (!SWIG_IsOK(res1))
3184 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3185 if(size!=self->getNumberOfTuples())
3187 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3189 return self->renumber(tmp);
3193 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3195 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3196 da2->checkAllocated();
3197 int size=self->getNumberOfTuples();
3198 if(size!=self->getNumberOfTuples())
3200 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3202 return self->renumber(da2->getConstPointer());
3206 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3209 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3210 if (!SWIG_IsOK(res1))
3213 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3214 if(size!=self->getNumberOfTuples())
3216 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3218 return self->renumberR(tmp);
3222 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3224 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3225 da2->checkAllocated();
3226 int size=self->getNumberOfTuples();
3227 if(size!=self->getNumberOfTuples())
3229 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3231 return self->renumberR(da2->getConstPointer());
3235 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3237 std::vector<int> tmp;
3238 convertPyToNewIntArr3(li,tmp);
3239 self->setSelectedComponents(a,tmp);
3242 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3244 int sz=self->getNumberOfComponents();
3245 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3246 self->getTuple(tupleId,tmp);
3247 return convertIntArrToPyList(tmp,sz);
3250 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3252 DataArrayInt *arr=0;
3253 DataArrayInt *arrI=0;
3254 self->changeSurjectiveFormat(targetNb,arr,arrI);
3255 PyObject *res = PyList_New(2);
3256 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3257 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3261 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3263 std::vector<const DataArrayInt *> tmp;
3264 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3265 return DataArrayInt::Meld(tmp);
3268 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3270 std::vector<const DataArrayInt *> tmp;
3271 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3272 return DataArrayInt::Aggregate(tmp);
3275 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3277 std::vector<const DataArrayInt *> tmp;
3278 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3279 return DataArrayInt::AggregateIndexes(tmp);
3282 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3284 std::vector<const DataArrayInt *> tmp;
3285 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3286 return DataArrayInt::BuildUnion(tmp);
3289 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3291 std::vector<const DataArrayInt *> tmp;
3292 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3293 return DataArrayInt::BuildIntersection(tmp);
3296 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3299 int r1=self->getMaxValue(tmp);
3300 PyObject *ret=PyTuple_New(2);
3301 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3302 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3306 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3309 int r1=self->getMinValue(tmp);
3310 PyObject *ret=PyTuple_New(2);
3311 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3312 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3316 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3318 int nbOfCompo=self->getNumberOfComponents();
3323 if(PyInt_Check(obj))
3325 int val=(int)PyInt_AS_LONG(obj);
3326 return self->findIdFirstEqual(val);
3329 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3333 std::vector<int> arr;
3334 convertPyToNewIntArr3(obj,arr);
3335 return self->findIdFirstEqualTuple(arr);
3340 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3342 int nbOfCompo=self->getNumberOfComponents();
3349 if(PyInt_Check(obj))
3351 int val=(int)PyInt_AS_LONG(obj);
3352 return self->presenceOfValue(val);
3355 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3359 std::vector<int> arr;
3360 convertPyToNewIntArr3(obj,arr);
3361 return self->presenceOfTuple(arr);
3366 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3368 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3369 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3370 self->checkAllocated();
3371 int nbOfTuples=self->getNumberOfTuples();
3372 int nbOfComponents=self->getNumberOfComponents();
3374 std::vector<int> vt1,vc1;
3375 std::pair<int, std::pair<int,int> > pt1,pc1;
3376 DataArrayInt *dt1=0,*dc1=0;
3378 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3379 MCAuto<DataArrayInt> ret;
3384 if(nbOfComponents==1)
3385 return PyInt_FromLong(self->getIJSafe(it1,0));
3386 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3389 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3391 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3393 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3395 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3398 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3399 std::vector<int> v2(1,ic1);
3400 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3404 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3405 std::vector<int> v2(1,ic1);
3406 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3410 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3411 std::vector<int> v2(1,ic1);
3412 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3416 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3417 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3421 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3422 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3426 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3427 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3431 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3432 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3436 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3437 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3438 std::vector<int> v2(nbOfComp);
3439 for(int i=0;i<nbOfComp;i++)
3440 v2[i]=pc1.first+i*pc1.second.second;
3441 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3445 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3446 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3447 std::vector<int> v2(nbOfComp);
3448 for(int i=0;i<nbOfComp;i++)
3449 v2[i]=pc1.first+i*pc1.second.second;
3450 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3454 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3455 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3456 std::vector<int> v2(nbOfComp);
3457 for(int i=0;i<nbOfComp;i++)
3458 v2[i]=pc1.first+i*pc1.second.second;
3459 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3463 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3464 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3465 std::vector<int> v2(nbOfComp);
3466 for(int i=0;i<nbOfComp;i++)
3467 v2[i]=pc1.first+i*pc1.second.second;
3468 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3471 throw INTERP_KERNEL::Exception(msg);
3475 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3477 self->checkAllocated();
3478 const char msg[]="Unexpected situation in __setitem__ !";
3479 int nbOfTuples=self->getNumberOfTuples();
3480 int nbOfComponents=self->getNumberOfComponents();
3483 std::vector<int> v1;
3485 DataArrayIntTuple *dd1=0;
3486 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3488 std::vector<int> vt1,vc1;
3489 std::pair<int, std::pair<int,int> > pt1,pc1;
3490 DataArrayInt *dt1=0,*dc1=0;
3491 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3492 MCAuto<DataArrayInt> tmp;
3500 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3503 tmp=DataArrayInt::New();
3504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3505 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3508 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3511 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3512 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3515 throw INTERP_KERNEL::Exception(msg);
3524 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3527 tmp=DataArrayInt::New();
3528 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3529 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3532 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3535 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3536 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3539 throw INTERP_KERNEL::Exception(msg);
3548 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3551 tmp=DataArrayInt::New();
3552 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3553 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3556 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3559 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3560 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3563 throw INTERP_KERNEL::Exception(msg);
3572 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3575 tmp=DataArrayInt::New();
3576 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3577 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3580 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3583 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3584 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3587 throw INTERP_KERNEL::Exception(msg);
3596 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3599 tmp=DataArrayInt::New();
3600 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3601 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3604 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3607 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3608 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3611 throw INTERP_KERNEL::Exception(msg);
3620 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3623 tmp=DataArrayInt::New();
3624 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3625 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3628 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3631 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3632 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3635 throw INTERP_KERNEL::Exception(msg);
3644 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3647 tmp=DataArrayInt::New();
3648 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3649 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3652 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3655 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3656 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3659 throw INTERP_KERNEL::Exception(msg);
3668 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3671 tmp=DataArrayInt::New();
3672 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3673 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3676 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3679 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3680 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3683 throw INTERP_KERNEL::Exception(msg);
3692 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3695 tmp=DataArrayInt::New();
3696 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3697 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3700 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3703 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3704 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3707 throw INTERP_KERNEL::Exception(msg);
3716 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3719 tmp=DataArrayInt::New();
3720 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3721 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3724 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3727 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3728 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3731 throw INTERP_KERNEL::Exception(msg);
3740 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3743 tmp=DataArrayInt::New();
3744 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3745 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3748 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3751 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3752 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3755 throw INTERP_KERNEL::Exception(msg);
3764 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3767 tmp=DataArrayInt::New();
3768 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3769 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3772 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3775 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3776 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3779 throw INTERP_KERNEL::Exception(msg);
3788 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3791 tmp=DataArrayInt::New();
3792 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3793 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3796 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3799 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3800 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3803 throw INTERP_KERNEL::Exception(msg);
3812 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3815 tmp=DataArrayInt::New();
3816 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3817 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3820 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3823 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3824 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3827 throw INTERP_KERNEL::Exception(msg);
3836 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3839 tmp=DataArrayInt::New();
3840 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3841 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3844 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3847 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3848 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3851 throw INTERP_KERNEL::Exception(msg);
3860 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3863 tmp=DataArrayInt::New();
3864 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3865 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3868 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3871 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3872 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3875 throw INTERP_KERNEL::Exception(msg);
3880 throw INTERP_KERNEL::Exception(msg);
3885 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3887 return self->negate();
3890 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3892 const char msg[]="Unexpected situation in __add__ !";
3895 std::vector<int> aa;
3896 DataArrayIntTuple *aaa;
3898 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3903 MCAuto<DataArrayInt> ret=self->deepCopy();
3904 ret->applyLin(1,val);
3909 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3910 return DataArrayInt::Add(self,aaaa);
3914 return DataArrayInt::Add(self,a);
3918 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3919 return DataArrayInt::Add(self,aaaa);
3922 throw INTERP_KERNEL::Exception(msg);
3926 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3928 const char msg[]="Unexpected situation in __radd__ !";
3931 std::vector<int> aa;
3932 DataArrayIntTuple *aaa;
3934 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3939 MCAuto<DataArrayInt> ret=self->deepCopy();
3940 ret->applyLin(1,val);
3945 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3946 return DataArrayInt::Add(self,aaaa);
3950 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3951 return DataArrayInt::Add(self,aaaa);
3954 throw INTERP_KERNEL::Exception(msg);
3958 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3960 const char msg[]="Unexpected situation in __iadd__ !";
3963 std::vector<int> aa;
3964 DataArrayIntTuple *aaa;
3966 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3971 self->applyLin(1,val);
3972 Py_XINCREF(trueSelf);
3977 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3979 Py_XINCREF(trueSelf);
3985 Py_XINCREF(trueSelf);
3990 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3991 self->addEqual(aaaa);
3992 Py_XINCREF(trueSelf);
3996 throw INTERP_KERNEL::Exception(msg);
4000 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4002 const char msg[]="Unexpected situation in __sub__ !";
4005 std::vector<int> aa;
4006 DataArrayIntTuple *aaa;
4008 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4013 MCAuto<DataArrayInt> ret=self->deepCopy();
4014 ret->applyLin(1,-val);
4019 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4020 return DataArrayInt::Substract(self,aaaa);
4024 return DataArrayInt::Substract(self,a);
4028 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4029 return DataArrayInt::Substract(self,aaaa);
4032 throw INTERP_KERNEL::Exception(msg);
4036 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4038 const char msg[]="Unexpected situation in __rsub__ !";
4041 std::vector<int> aa;
4042 DataArrayIntTuple *aaa;
4044 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4049 MCAuto<DataArrayInt> ret=self->deepCopy();
4050 ret->applyLin(-1,val);
4055 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4056 return DataArrayInt::Substract(aaaa,self);
4060 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4061 return DataArrayInt::Substract(aaaa,self);
4064 throw INTERP_KERNEL::Exception(msg);
4068 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4070 const char msg[]="Unexpected situation in __isub__ !";
4073 std::vector<int> aa;
4074 DataArrayIntTuple *aaa;
4076 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4081 self->applyLin(1,-val);
4082 Py_XINCREF(trueSelf);
4087 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4088 self->substractEqual(bb);
4089 Py_XINCREF(trueSelf);
4094 self->substractEqual(a);
4095 Py_XINCREF(trueSelf);
4100 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4101 self->substractEqual(aaaa);
4102 Py_XINCREF(trueSelf);
4106 throw INTERP_KERNEL::Exception(msg);
4110 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4112 const char msg[]="Unexpected situation in __mul__ !";
4115 std::vector<int> aa;
4116 DataArrayIntTuple *aaa;
4118 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4123 MCAuto<DataArrayInt> ret=self->deepCopy();
4124 ret->applyLin(val,0);
4129 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4130 return DataArrayInt::Multiply(self,aaaa);
4134 return DataArrayInt::Multiply(self,a);
4138 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4139 return DataArrayInt::Multiply(self,aaaa);
4142 throw INTERP_KERNEL::Exception(msg);
4146 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4148 const char msg[]="Unexpected situation in __rmul__ !";
4151 std::vector<int> aa;
4152 DataArrayIntTuple *aaa;
4154 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4159 MCAuto<DataArrayInt> ret=self->deepCopy();
4160 ret->applyLin(val,0);
4165 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4166 return DataArrayInt::Multiply(self,aaaa);
4170 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4171 return DataArrayInt::Multiply(self,aaaa);
4174 throw INTERP_KERNEL::Exception(msg);
4178 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4180 const char msg[]="Unexpected situation in __imul__ !";
4183 std::vector<int> aa;
4184 DataArrayIntTuple *aaa;
4186 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4191 self->applyLin(val,0);
4192 Py_XINCREF(trueSelf);
4197 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4198 self->multiplyEqual(bb);
4199 Py_XINCREF(trueSelf);
4204 self->multiplyEqual(a);
4205 Py_XINCREF(trueSelf);
4210 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4211 self->multiplyEqual(aaaa);
4212 Py_XINCREF(trueSelf);
4216 throw INTERP_KERNEL::Exception(msg);
4220 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4222 const char msg[]="Unexpected situation in __div__ !";
4225 std::vector<int> aa;
4226 DataArrayIntTuple *aaa;
4228 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4233 MCAuto<DataArrayInt> ret=self->deepCopy();
4234 ret->applyDivideBy(val);
4239 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4240 return DataArrayInt::Divide(self,aaaa);
4244 return DataArrayInt::Divide(self,a);
4248 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4249 return DataArrayInt::Divide(self,aaaa);
4252 throw INTERP_KERNEL::Exception(msg);
4256 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4258 const char msg[]="Unexpected situation in __rdiv__ !";
4261 std::vector<int> aa;
4262 DataArrayIntTuple *aaa;
4264 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4269 MCAuto<DataArrayInt> ret=self->deepCopy();
4275 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4276 return DataArrayInt::Divide(aaaa,self);
4280 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4281 return DataArrayInt::Divide(aaaa,self);
4284 throw INTERP_KERNEL::Exception(msg);
4288 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4290 const char msg[]="Unexpected situation in __idiv__ !";
4293 std::vector<int> aa;
4294 DataArrayIntTuple *aaa;
4296 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4301 self->applyDivideBy(val);
4302 Py_XINCREF(trueSelf);
4307 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4308 self->divideEqual(bb);
4309 Py_XINCREF(trueSelf);
4314 self->divideEqual(a);
4315 Py_XINCREF(trueSelf);
4320 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4321 self->divideEqual(aaaa);
4322 Py_XINCREF(trueSelf);
4326 throw INTERP_KERNEL::Exception(msg);
4330 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4332 const char msg[]="Unexpected situation in __mod__ !";
4335 std::vector<int> aa;
4336 DataArrayIntTuple *aaa;
4338 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4343 MCAuto<DataArrayInt> ret=self->deepCopy();
4344 ret->applyModulus(val);
4349 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4350 return DataArrayInt::Modulus(self,aaaa);
4354 return DataArrayInt::Modulus(self,a);
4358 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4359 return DataArrayInt::Modulus(self,aaaa);
4362 throw INTERP_KERNEL::Exception(msg);
4366 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4368 const char msg[]="Unexpected situation in __rmod__ !";
4371 std::vector<int> aa;
4372 DataArrayIntTuple *aaa;
4374 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4379 MCAuto<DataArrayInt> ret=self->deepCopy();
4380 ret->applyRModulus(val);
4385 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4386 return DataArrayInt::Modulus(aaaa,self);
4390 return DataArrayInt::Modulus(a,self);
4394 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4395 return DataArrayInt::Modulus(aaaa,self);
4398 throw INTERP_KERNEL::Exception(msg);
4402 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4404 const char msg[]="Unexpected situation in __imod__ !";
4407 std::vector<int> aa;
4408 DataArrayIntTuple *aaa;
4410 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4415 self->applyModulus(val);
4416 Py_XINCREF(trueSelf);
4421 self->modulusEqual(a);
4422 Py_XINCREF(trueSelf);
4427 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4428 self->modulusEqual(aaaa);
4429 Py_XINCREF(trueSelf);
4433 throw INTERP_KERNEL::Exception(msg);
4437 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4439 const char msg[]="Unexpected situation in __pow__ !";
4442 std::vector<int> aa;
4443 DataArrayIntTuple *aaa;
4445 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4450 MCAuto<DataArrayInt> ret=self->deepCopy();
4456 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4457 return DataArrayInt::Pow(self,aaaa);
4461 return DataArrayInt::Pow(self,a);
4465 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4466 return DataArrayInt::Pow(self,aaaa);
4469 throw INTERP_KERNEL::Exception(msg);
4473 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4475 const char msg[]="Unexpected situation in __rpow__ !";
4478 std::vector<int> aa;
4479 DataArrayIntTuple *aaa;
4481 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4486 MCAuto<DataArrayInt> ret=self->deepCopy();
4487 ret->applyRPow(val);
4492 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4493 return DataArrayInt::Pow(aaaa,self);
4497 return DataArrayInt::Pow(a,self);
4501 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4502 return DataArrayInt::Pow(aaaa,self);
4505 throw INTERP_KERNEL::Exception(msg);
4509 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4511 const char msg[]="Unexpected situation in __ipow__ !";
4514 std::vector<int> aa;
4515 DataArrayIntTuple *aaa;
4517 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4522 self->applyPow(val);
4523 Py_XINCREF(trueSelf);
4529 Py_XINCREF(trueSelf);
4534 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4535 self->powEqual(aaaa);
4536 Py_XINCREF(trueSelf);
4540 throw INTERP_KERNEL::Exception(msg);
4544 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4546 std::ostringstream oss;
4547 self->reprQuickOverview(oss);
4551 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4553 int szArr,sw,iTypppArr;
4554 std::vector<int> stdvecTyyppArr;
4555 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4556 self->pushBackValsSilent(tmp,tmp+szArr);
4559 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4561 std::vector<int> ret1;
4562 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4563 std::size_t sz=ret0.size();
4564 PyObject *pyRet=PyTuple_New(2);
4565 PyObject *pyRet0=PyList_New((int)sz);
4566 PyObject *pyRet1=PyList_New((int)sz);
4567 for(std::size_t i=0;i<sz;i++)
4569 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4570 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4572 PyTuple_SetItem(pyRet,0,pyRet0);
4573 PyTuple_SetItem(pyRet,1,pyRet1);
4577 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4579 DataArrayInt *ret0=0,*ret1=0;
4580 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4581 PyObject *pyRet=PyTuple_New(2);
4582 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4583 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4587 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4590 bool ret(self->isRange(a,b,c));
4591 PyObject *pyRet=PyTuple_New(2);
4592 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4594 PyTuple_SetItem(pyRet,0,ret0Py);
4596 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4602 PyTuple_SetItem(pyRet,1,ret1Py);
4607 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4609 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4612 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4615 if(!self->isAllocated())
4616 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4617 PyObject *ret(PyTuple_New(1));
4618 PyObject *ret0(PyDict_New());
4619 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4620 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4621 PyObject *tmp1(PyInt_FromLong(0));
4622 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4623 PyTuple_SetItem(ret,0,ret0);
4627 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4633 class DataArrayIntTuple;
4635 class DataArrayIntIterator
4638 DataArrayIntIterator(DataArrayInt *da);
4639 ~DataArrayIntIterator();
4644 DataArrayIntTuple *ret=self->nextt();
4646 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4649 PyErr_SetString(PyExc_StopIteration,"No more data.");
4656 class DataArrayIntTuple
4659 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4660 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4663 std::string __str__() const throw(INTERP_KERNEL::Exception)
4665 return self->repr();
4668 int __int__() const throw(INTERP_KERNEL::Exception)
4670 return self->intValue();
4673 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4675 return self->buildDAInt(1,self->getNumberOfCompo());
4678 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4680 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4681 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4682 Py_XINCREF(trueSelf);
4686 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4688 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4689 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4690 Py_XINCREF(trueSelf);
4694 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4696 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4697 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4698 Py_XINCREF(trueSelf);
4702 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4704 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4705 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4706 Py_XINCREF(trueSelf);
4710 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4712 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4713 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4714 Py_XINCREF(trueSelf);
4718 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4720 return PyInt_FromLong(self->getNumberOfCompo());
4723 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4725 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4728 std::vector<int> multiVal;
4729 std::pair<int, std::pair<int,int> > slic;
4730 MEDCoupling::DataArrayInt *daIntTyypp=0;
4731 const int *pt=self->getConstPointer();
4732 int nbc=self->getNumberOfCompo();
4733 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4740 std::ostringstream oss;
4741 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4742 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4746 return PyInt_FromLong(pt[singleVal]);
4750 return PyInt_FromLong(pt[nbc+singleVal]);
4753 std::ostringstream oss;
4754 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4755 throw INTERP_KERNEL::Exception(oss.str().c_str());
4761 PyObject *t=PyTuple_New(multiVal.size());
4762 for(int j=0;j<(int)multiVal.size();j++)
4764 int cid=multiVal[j];
4767 std::ostringstream oss;
4768 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4769 throw INTERP_KERNEL::Exception(oss.str().c_str());
4771 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4777 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4778 PyObject *t=PyTuple_New(sz);
4779 for(int j=0;j<sz;j++)
4780 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4784 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4788 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4790 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4791 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4794 std::vector<int> multiValV;
4795 std::pair<int, std::pair<int,int> > slicV;
4796 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4797 int nbc=self->getNumberOfCompo();
4798 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4800 std::vector<int> multiVal;
4801 std::pair<int, std::pair<int,int> > slic;
4802 MEDCoupling::DataArrayInt *daIntTyypp=0;
4803 int *pt=self->getPointer();
4804 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4811 std::ostringstream oss;
4812 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4813 throw INTERP_KERNEL::Exception(oss.str().c_str());
4819 pt[singleVal]=singleValV;
4824 if(multiValV.size()!=1)
4826 std::ostringstream oss;
4827 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4828 throw INTERP_KERNEL::Exception(oss.str().c_str());
4830 pt[singleVal]=multiValV[0];
4835 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4839 throw INTERP_KERNEL::Exception(msg);
4848 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4852 std::ostringstream oss;
4853 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4854 throw INTERP_KERNEL::Exception(oss.str().c_str());
4862 if(multiVal.size()!=multiValV.size())
4864 std::ostringstream oss;
4865 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4866 throw INTERP_KERNEL::Exception(oss.str().c_str());
4868 for(int i=0;i<(int)multiVal.size();i++)
4870 int pos=multiVal[i];
4873 std::ostringstream oss;
4874 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4875 throw INTERP_KERNEL::Exception(oss.str().c_str());
4877 pt[multiVal[i]]=multiValV[i];
4883 const int *ptV=daIntTyyppV->getConstPointer();
4884 if(nbc>daIntTyyppV->getNumberOfCompo())
4886 std::ostringstream oss;
4887 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4888 throw INTERP_KERNEL::Exception(oss.str().c_str());
4890 std::copy(ptV,ptV+nbc,pt);
4894 throw INTERP_KERNEL::Exception(msg);
4899 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4904 for(int j=0;j<sz;j++)
4905 pt[slic.first+j*slic.second.second]=singleValV;
4910 if(sz!=(int)multiValV.size())
4912 std::ostringstream oss;
4913 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4914 throw INTERP_KERNEL::Exception(oss.str().c_str());
4916 for(int j=0;j<sz;j++)
4917 pt[slic.first+j*slic.second.second]=multiValV[j];
4922 const int *ptV=daIntTyyppV->getConstPointer();
4923 if(sz>daIntTyyppV->getNumberOfCompo())
4925 std::ostringstream oss;
4926 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4927 throw INTERP_KERNEL::Exception(oss.str().c_str());
4929 for(int j=0;j<sz;j++)
4930 pt[slic.first+j*slic.second.second]=ptV[j];
4934 throw INTERP_KERNEL::Exception(msg);
4938 throw INTERP_KERNEL::Exception(msg);
4944 class DataArrayChar : public DataArray
4947 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4948 int getHashCode() const throw(INTERP_KERNEL::Exception);
4949 bool empty() const throw(INTERP_KERNEL::Exception);
4950 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4951 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4952 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4953 char popBackSilent() throw(INTERP_KERNEL::Exception);
4954 void pack() const throw(INTERP_KERNEL::Exception);
4955 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4956 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4957 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4958 void reverse() throw(INTERP_KERNEL::Exception);
4959 void fillWithZero() throw(INTERP_KERNEL::Exception);
4960 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4961 std::string repr() const throw(INTERP_KERNEL::Exception);
4962 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4963 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4964 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4965 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4966 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4967 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4968 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4969 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4970 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4971 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4972 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4973 char front() const throw(INTERP_KERNEL::Exception);
4974 char back() const throw(INTERP_KERNEL::Exception);
4975 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4976 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4977 char *getPointer() throw(INTERP_KERNEL::Exception);
4978 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4979 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4980 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4981 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4982 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4983 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4984 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4985 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4986 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4987 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4988 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4991 int __len__() const throw(INTERP_KERNEL::Exception)
4993 if(self->isAllocated())
4995 return self->getNumberOfTuples();
4999 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5003 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5006 bool ret0=self->isEqualIfNotWhy(other,ret1);
5007 PyObject *ret=PyTuple_New(2);
5008 PyObject *ret0Py=ret0?Py_True:Py_False;
5010 PyTuple_SetItem(ret,0,ret0Py);
5011 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5015 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5018 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5019 if (!SWIG_IsOK(res1))
5022 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5023 if(size!=self->getNumberOfTuples())
5025 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5027 return self->renumber(tmp);
5031 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5033 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5034 da2->checkAllocated();
5035 int size=self->getNumberOfTuples();
5036 if(size!=self->getNumberOfTuples())
5038 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5040 return self->renumber(da2->getConstPointer());
5044 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5047 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5048 if (!SWIG_IsOK(res1))
5051 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5052 if(size!=self->getNumberOfTuples())
5054 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5056 return self->renumberR(tmp);
5060 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5062 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5063 da2->checkAllocated();
5064 int size=self->getNumberOfTuples();
5065 if(size!=self->getNumberOfTuples())
5067 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5069 return self->renumberR(da2->getConstPointer());
5073 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5076 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5077 if (!SWIG_IsOK(res1))
5080 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5081 if(size!=self->getNumberOfTuples())
5083 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5085 return self->renumberAndReduce(tmp,newNbOfTuple);
5089 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5091 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5092 da2->checkAllocated();
5093 int size=self->getNumberOfTuples();
5094 if(size!=self->getNumberOfTuples())
5096 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5098 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5102 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5104 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5105 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5106 return DataArrayChar::Aggregate(tmp);
5109 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5111 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5112 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5113 return DataArrayChar::Meld(tmp);
5118 class DataArrayByteIterator;
5120 class DataArrayByte : public DataArrayChar
5123 static DataArrayByte *New();
5124 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5125 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5126 char byteValue() const throw(INTERP_KERNEL::Exception);
5129 DataArrayByte() throw(INTERP_KERNEL::Exception)
5131 return DataArrayByte::New();
5134 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5136 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) !";
5137 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5141 if(PyInt_Check(nbOfTuples))
5143 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5145 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5148 if(PyInt_Check(nbOfComp))
5149 {//DataArrayByte.New([1,3,4,5],2,2)
5150 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5152 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5153 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5154 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5155 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5159 throw INTERP_KERNEL::Exception(msg);
5162 {//DataArrayByte.New([1,3,4],3)
5163 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5165 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5166 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5171 throw INTERP_KERNEL::Exception(msg);
5174 {// DataArrayByte.New([1,3,4])
5175 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5176 int tmpp1=-1,tmpp2=-1;
5177 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5178 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5182 else if(PyInt_Check(elt0))
5184 int nbOfTuples1=PyInt_AS_LONG(elt0);
5186 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5191 if(PyInt_Check(nbOfTuples))
5192 {//DataArrayByte.New(5,2)
5193 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5195 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5196 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5197 ret->alloc(nbOfTuples1,nbOfCompo);
5201 throw INTERP_KERNEL::Exception(msg);
5204 throw INTERP_KERNEL::Exception(msg);
5207 {//DataArrayByte.New(5)
5208 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5209 ret->alloc(nbOfTuples1,1);
5214 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5215 {//DataArrayDouble.New(numpyArray)
5216 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5220 throw INTERP_KERNEL::Exception(msg);
5223 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5225 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5228 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5230 std::ostringstream oss;
5231 self->reprQuickOverview(oss);
5235 int __int__() const throw(INTERP_KERNEL::Exception)
5237 return (int) self->byteValue();
5240 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5242 return self->iterator();
5245 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5247 return (int)self->getIJ(tupleId,compoId);
5250 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5252 return (int)self->getIJSafe(tupleId,compoId);
5255 std::string __str__() const throw(INTERP_KERNEL::Exception)
5257 return self->repr();
5260 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5262 const char *vals=self->getConstPointer();
5263 int nbOfComp=self->getNumberOfComponents();
5264 int nbOfTuples=self->getNumberOfTuples();
5265 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5268 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5271 int ival=-1; std::vector<int> ivval;
5272 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5273 std::vector<char> vals(sz);
5274 std::copy(pt,pt+sz,vals.begin());
5275 return self->presenceOfTuple(vals);
5278 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5281 int ival=-1; std::vector<int> ivval;
5282 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5283 std::vector<char> vals2(sz);
5284 std::copy(pt,pt+sz,vals2.begin());
5285 return self->presenceOfValue(vals2);
5288 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5291 int ival=-1; std::vector<int> ivval;
5292 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5293 std::vector<char> vals2(sz);
5294 std::copy(pt,pt+sz,vals2.begin());
5295 return self->findIdFirstEqual(vals2);
5298 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5301 int ival=-1; std::vector<int> ivval;
5302 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5303 std::vector<char> vals(sz);
5304 std::copy(pt,pt+sz,vals.begin());
5305 return self->findIdFirstEqualTuple(vals);
5308 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5311 int ival=-1; std::vector<int> ivval;
5312 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5313 std::vector<char> vals(sz);
5314 std::copy(pt,pt+sz,vals.begin());
5315 return self->findIdSequence(vals);
5318 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5320 int sz=self->getNumberOfComponents();
5321 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5322 self->getTuple(tupleId,tmp);
5323 PyObject *ret=PyTuple_New(sz);
5324 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5328 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5331 int r1=(int)self->getMaxValue(tmp);
5332 PyObject *ret=PyTuple_New(2);
5333 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5334 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5338 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5341 int r1=(int)self->getMinValue(tmp);
5342 PyObject *ret=PyTuple_New(2);
5343 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5344 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5348 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5350 int nbOfCompo=self->getNumberOfComponents();
5355 if(PyInt_Check(obj))
5357 int val=(int)PyInt_AS_LONG(obj);
5358 return self->findIdFirstEqual(val);
5361 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5364 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5368 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5370 int nbOfCompo=self->getNumberOfComponents();
5377 if(PyInt_Check(obj))
5379 int val=(int)PyInt_AS_LONG(obj);
5380 return self->presenceOfValue(val);
5383 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5386 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5391 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5393 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5398 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5400 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5403 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5406 if(!self->isAllocated())
5407 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5408 PyObject *ret(PyTuple_New(1));
5409 PyObject *ret0(PyDict_New());
5410 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5411 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5412 PyObject *tmp1(PyInt_FromLong(0));
5413 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5414 PyTuple_SetItem(ret,0,ret0);
5418 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5422 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5424 self->checkAllocated();
5425 const char msg[]="Unexpected situation in __setitem__ !";
5426 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5429 std::vector<int> v1;
5431 DataArrayIntTuple *dd1=0;
5432 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5434 std::vector<int> vt1,vc1;
5435 std::pair<int, std::pair<int,int> > pt1,pc1;
5436 DataArrayInt *dt1=0,*dc1=0;
5437 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5438 MCAuto<DataArrayInt> tmp;
5446 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5449 throw INTERP_KERNEL::Exception(msg);
5458 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5461 throw INTERP_KERNEL::Exception(msg);
5470 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5473 throw INTERP_KERNEL::Exception(msg);
5482 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5485 throw INTERP_KERNEL::Exception(msg);
5494 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5497 throw INTERP_KERNEL::Exception(msg);
5506 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5509 throw INTERP_KERNEL::Exception(msg);
5518 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5521 throw INTERP_KERNEL::Exception(msg);
5530 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5533 throw INTERP_KERNEL::Exception(msg);
5542 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5545 throw INTERP_KERNEL::Exception(msg);
5554 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5557 throw INTERP_KERNEL::Exception(msg);
5566 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5569 throw INTERP_KERNEL::Exception(msg);
5578 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5581 throw INTERP_KERNEL::Exception(msg);
5590 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5593 throw INTERP_KERNEL::Exception(msg);
5602 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5605 throw INTERP_KERNEL::Exception(msg);
5614 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5617 throw INTERP_KERNEL::Exception(msg);
5626 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5629 throw INTERP_KERNEL::Exception(msg);
5634 throw INTERP_KERNEL::Exception(msg);
5641 class DataArrayByteTuple;
5643 class DataArrayByteIterator
5646 DataArrayByteIterator(DataArrayByte *da);
5647 ~DataArrayByteIterator();
5650 class DataArrayByteTuple
5653 std::string repr() const throw(INTERP_KERNEL::Exception);
5654 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5657 std::string __str__() const throw(INTERP_KERNEL::Exception)
5659 return self->repr();
5662 char __int__() const throw(INTERP_KERNEL::Exception)
5664 return self->byteValue();
5667 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5669 return self->buildDAByte(1,self->getNumberOfCompo());
5674 class DataArrayAsciiCharIterator;
5676 class DataArrayAsciiChar : public DataArrayChar
5679 static DataArrayAsciiChar *New();
5680 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5681 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5682 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5685 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5687 return DataArrayAsciiChar::New();
5690 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5692 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) !";
5693 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5697 if(PyInt_Check(nbOfTuples))
5699 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5701 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5704 if(PyInt_Check(nbOfComp))
5705 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5706 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5708 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5709 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5710 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5711 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5715 throw INTERP_KERNEL::Exception(msg);
5718 {//DataArrayAsciiChar.New([1,3,4],3)
5719 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5721 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5722 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5726 else if(PyString_Check(nbOfTuples))
5728 if(PyString_Size(nbOfTuples)!=1)
5729 throw INTERP_KERNEL::Exception(msg);
5730 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5731 std::vector<std::string> tmp;
5732 if(fillStringVector(elt0,tmp))
5733 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5735 throw INTERP_KERNEL::Exception(msg);
5738 throw INTERP_KERNEL::Exception(msg);
5742 std::vector<std::string> tmmp;
5743 if(fillStringVector(elt0,tmmp))
5744 //DataArrayAsciiChar.New(["abc","de","fghi"])
5745 return DataArrayAsciiChar::New(tmmp,' ');
5748 // DataArrayAsciiChar.New([1,3,4])
5749 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5750 int tmpp1=-1,tmpp2=-1;
5751 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5752 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5757 else if(PyInt_Check(elt0))
5759 int nbOfTuples1=PyInt_AS_LONG(elt0);
5761 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5766 if(PyInt_Check(nbOfTuples))
5767 {//DataArrayAsciiChar.New(5,2)
5768 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5770 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5771 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5772 ret->alloc(nbOfTuples1,nbOfCompo);
5776 throw INTERP_KERNEL::Exception(msg);
5779 throw INTERP_KERNEL::Exception(msg);
5782 {//DataArrayAsciiChar.New(5)
5783 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5784 ret->alloc(nbOfTuples1,1);
5789 throw INTERP_KERNEL::Exception(msg);
5792 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5794 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5797 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5799 std::ostringstream oss;
5800 self->reprQuickOverview(oss);
5804 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5806 return self->iterator();
5809 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5811 char tmp[2]; tmp[1]='\0';
5812 tmp[0]=self->getIJ(tupleId,compoId);
5813 return std::string(tmp);
5816 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5818 char tmp[2]; tmp[1]='\0';
5819 tmp[0]=self->getIJSafe(tupleId,compoId);
5820 return std::string(tmp);
5823 std::string __str__() const throw(INTERP_KERNEL::Exception)
5825 return self->repr();
5828 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5830 const char *vals=self->getConstPointer();
5831 int nbOfComp=self->getNumberOfComponents();
5832 int nbOfTuples=self->getNumberOfTuples();
5833 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5836 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5838 if(PyString_Check(tupl))
5840 Py_ssize_t sz=PyString_Size(tupl);
5841 std::vector<char> vals(sz);
5842 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5843 return self->presenceOfTuple(vals);
5846 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5849 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5851 if(PyString_Check(vals))
5853 Py_ssize_t sz=PyString_Size(vals);
5854 std::vector<char> vals2(sz);
5855 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5856 return self->presenceOfValue(vals2);
5859 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5862 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5864 if(PyString_Check(vals))
5866 Py_ssize_t sz=PyString_Size(vals);
5867 std::vector<char> vals2(sz);
5868 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5869 return self->findIdFirstEqual(vals2);
5872 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5875 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5877 if(PyString_Check(tupl))
5879 Py_ssize_t sz=PyString_Size(tupl);
5880 std::vector<char> vals(sz);
5881 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5882 return self->findIdFirstEqualTuple(vals);
5885 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5888 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5890 if(PyString_Check(strOrListOfInt))
5892 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5893 std::vector<char> vals(sz);
5894 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5895 return self->findIdSequence(vals);
5898 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5901 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5903 int sz=self->getNumberOfComponents();
5904 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5905 self->getTuple(tupleId,tmp);
5906 return PyString_FromString(tmp);
5909 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5912 char tmp2[2]; tmp2[1]='\0';
5913 tmp2[0]=self->getMaxValue(tmp);
5914 PyObject *ret=PyTuple_New(2);
5915 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5916 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5920 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5923 char tmp2[2]; tmp2[1]='\0';
5924 tmp2[0]=self->getMinValue(tmp);
5925 PyObject *ret=PyTuple_New(2);
5926 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5927 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5931 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5933 int nbOfCompo=self->getNumberOfComponents();
5938 if(PyString_Check(obj))
5940 Py_ssize_t sz=PyString_Size(obj);
5941 char *pt=PyString_AsString(obj);
5943 return self->findIdFirstEqual(pt[0]);
5945 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5948 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5951 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5955 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5957 int nbOfCompo=self->getNumberOfComponents();
5964 if(PyString_Check(obj))
5966 Py_ssize_t sz=PyString_Size(obj);
5967 char *pt=PyString_AsString(obj);
5969 return self->presenceOfValue(pt[0]);
5971 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5974 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5977 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5981 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5984 std::vector<int> stdvecTyyppArr;
5985 std::pair<int, std::pair<int,int> > sTyyppArr;
5986 MEDCoupling::DataArrayInt *daIntTyypp=0;
5987 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5991 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5993 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5995 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5997 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5999 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6003 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6005 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.";
6007 std::vector<int> stdvecTyyppArr;
6008 std::pair<int, std::pair<int,int> > sTyyppArr;
6009 MEDCoupling::DataArrayInt *daIntTyypp=0;
6010 int nbOfCompo=self->getNumberOfComponents();
6011 int nbOfTuples=self->getNumberOfTuples();
6012 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6014 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6015 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6024 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6030 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6031 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6034 //value vector<string>
6037 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6038 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6041 //value DataArrayChar
6044 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6048 throw INTERP_KERNEL::Exception(msg);
6052 {//obj list-tuple[int]
6058 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6064 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6065 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6068 //value vector<string>
6071 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6072 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6075 //value DataArrayChar
6078 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6082 throw INTERP_KERNEL::Exception(msg);
6093 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6099 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6100 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6103 //value vector<string>
6106 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6107 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6110 //value DataArrayChar
6113 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6117 throw INTERP_KERNEL::Exception(msg);
6128 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6134 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6135 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6138 //value vector<string>
6141 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6142 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6145 //value DataArrayChar
6148 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6152 throw INTERP_KERNEL::Exception(msg);
6157 throw INTERP_KERNEL::Exception(msg);
6163 class DataArrayAsciiCharTuple;
6165 class DataArrayAsciiCharIterator
6168 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6169 ~DataArrayAsciiCharIterator();
6174 DataArrayAsciiCharTuple *ret=self->nextt();
6176 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6179 PyErr_SetString(PyExc_StopIteration,"No more data.");
6186 class DataArrayAsciiCharTuple
6189 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6190 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6193 std::string __str__() const throw(INTERP_KERNEL::Exception)
6195 return self->repr();
6198 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6200 return self->buildDAAsciiChar(1,self->getNumberOfCompo());