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::cartesianize;
187 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
188 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
189 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
190 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
191 %newobject MEDCoupling::DataArrayDouble::__neg__;
192 %newobject MEDCoupling::DataArrayDouble::__radd__;
193 %newobject MEDCoupling::DataArrayDouble::__rsub__;
194 %newobject MEDCoupling::DataArrayDouble::__rmul__;
195 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
196 %newobject MEDCoupling::DataArrayDouble::__pow__;
197 %newobject MEDCoupling::DataArrayDouble::__rpow__;
198 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
200 %feature("unref") DataArray "$this->decrRef();"
201 %feature("unref") DataArrayDouble "$this->decrRef();"
202 %feature("unref") DataArrayInt "$this->decrRef();"
203 %feature("unref") DataArrayChar "$this->decrRef();"
204 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
205 %feature("unref") DataArrayByte "$this->decrRef();"
207 namespace MEDCoupling
214 } MEDCouplingAxisType;
216 class DataArray : public RefCountObject, public TimeLabel
219 void setName(const std::string& name);
220 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
221 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
222 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
223 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
224 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
225 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
226 std::string getName() const;
227 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
228 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
229 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
230 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
231 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
232 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
233 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
234 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
235 int getNumberOfComponents() const;
236 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
237 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
238 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
239 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
240 virtual void desallocate() throw(INTERP_KERNEL::Exception);
241 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
242 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
243 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
244 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
245 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
246 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
247 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
248 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
249 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
250 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
251 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
252 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
253 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
254 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
255 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
256 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
257 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
258 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
259 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
260 void updateTime() const;
263 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
265 const std::vector<std::string>& comps=self->getInfoOnComponents();
266 PyObject *ret=PyList_New((int)comps.size());
267 for(int i=0;i<(int)comps.size();i++)
268 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
272 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
274 std::vector<int> tmp;
275 convertPyToNewIntArr3(li,tmp);
276 self->copyPartOfStringInfoFrom(other,tmp);
279 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
281 std::vector<int> tmp;
282 convertPyToNewIntArr3(li,tmp);
283 self->copyPartOfStringInfoFrom2(tmp,other);
286 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
289 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
290 if (!SWIG_IsOK(res1))
293 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
294 if(size!=self->getNumberOfTuples())
296 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
298 self->renumberInPlace(tmp);
302 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
304 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
305 da2->checkAllocated();
306 int size=self->getNumberOfTuples();
307 if(size!=self->getNumberOfTuples())
309 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
311 self->renumberInPlace(da2->getConstPointer());
315 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
318 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
319 if (!SWIG_IsOK(res1))
322 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
323 if(size!=self->getNumberOfTuples())
325 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
327 self->renumberInPlaceR(tmp);
331 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
333 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
334 da2->checkAllocated();
335 int size=self->getNumberOfTuples();
336 if(size!=self->getNumberOfTuples())
338 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
340 self->renumberInPlaceR(da2->getConstPointer());
344 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
345 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
347 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
348 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
349 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
350 DataArrayInt *tuplesSelecPtr2=0;
353 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
355 throw INTERP_KERNEL::Exception(msg);
357 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
360 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
362 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
363 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
366 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
368 std::vector<std::pair<int,int> > ranges;
369 convertPyToVectorPairInt(li,ranges);
370 return self->selectByTupleRanges(ranges);
373 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
376 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
377 if (!SWIG_IsOK(res1))
380 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
381 return self->selectByTupleId(tmp,tmp+size);
385 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
387 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
388 da2->checkAllocated();
389 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
393 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
396 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
397 if (!SWIG_IsOK(res1))
400 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
401 return self->selectByTupleIdSafe(tmp,tmp+size);
405 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
407 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
408 da2->checkAllocated();
409 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
413 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
415 std::vector<int> tmp;
416 convertPyToNewIntArr3(li,tmp);
417 DataArray *ret=self->keepSelectedComponents(tmp);
418 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
421 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
423 if(!PySlice_Check(slic))
424 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
425 Py_ssize_t strt=2,stp=2,step=2;
426 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
427 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
429 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
430 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
433 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
435 if(!PySlice_Check(slic))
436 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
437 Py_ssize_t strt=2,stp=2,step=2;
438 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
439 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
441 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
442 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
445 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
447 if(!PySlice_Check(slic))
448 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
449 Py_ssize_t strt=2,stp=2,step=2;
450 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
451 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
452 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
455 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
457 if(!PySlice_Check(slic))
458 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
459 Py_ssize_t strt=2,stp=2,step=2;
460 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
461 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
462 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
465 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
467 std::vector<const DataArray *> tmp;
468 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
469 return DataArray::Aggregate(tmp);
472 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
474 if(!PySlice_Check(slic))
475 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
476 Py_ssize_t strt=2,stp=2,step=2;
477 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
478 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
479 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
482 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
484 if(!PySlice_Check(slic))
485 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
486 Py_ssize_t strt=2,stp=2,step=2;
487 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
488 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
489 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
492 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
494 PyObject *ret(PyTuple_New(2));
495 std::string a0(self->getName());
496 const std::vector<std::string> &a1(self->getInfoOnComponents());
497 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
500 PyObject *ret1(PyList_New(sz));
501 for(int i=0;i<sz;i++)
502 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
503 PyTuple_SetItem(ret,1,ret1);
508 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
510 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 !";
511 if(!PyTuple_Check(inp))
512 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
513 int sz(PyTuple_Size(inp));
515 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
516 PyObject *a0(PyTuple_GetItem(inp,0));
517 if(!PyString_Check(a0))
518 throw INTERP_KERNEL::Exception(MSG);
519 PyObject *a1(PyTuple_GetItem(inp,1));
520 std::vector<std::string> a1cpp;
521 if(!fillStringVector(a1,a1cpp))
522 throw INTERP_KERNEL::Exception(MSG);
523 self->setName(PyString_AsString(a0));
524 self->setInfoOnComponents(a1cpp);
530 class DataArrayDoubleIterator;
532 class DataArrayDouble : public DataArray
535 static DataArrayDouble *New();
536 double doubleValue() const throw(INTERP_KERNEL::Exception);
537 bool empty() const throw(INTERP_KERNEL::Exception);
538 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
539 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
540 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
541 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
542 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
543 double popBackSilent() throw(INTERP_KERNEL::Exception);
544 void pack() const throw(INTERP_KERNEL::Exception);
545 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
546 void fillWithZero() throw(INTERP_KERNEL::Exception);
547 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
548 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
549 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
550 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
551 void reverse() throw(INTERP_KERNEL::Exception);
552 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
553 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
554 std::string repr() const throw(INTERP_KERNEL::Exception);
555 std::string reprZip() const throw(INTERP_KERNEL::Exception);
556 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
557 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
558 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
559 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
563 void transpose() throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
565 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
567 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
568 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
569 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
570 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
571 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
572 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
573 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
574 double front() const throw(INTERP_KERNEL::Exception);
575 double back() const throw(INTERP_KERNEL::Exception);
576 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
577 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
578 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
579 double *getPointer() throw(INTERP_KERNEL::Exception);
580 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
581 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
582 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
583 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
584 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
585 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
586 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
587 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
588 double getAverageValue() const throw(INTERP_KERNEL::Exception);
589 double norm2() const throw(INTERP_KERNEL::Exception);
590 double normMax() const throw(INTERP_KERNEL::Exception);
591 double normMin() const throw(INTERP_KERNEL::Exception);
592 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
595 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
596 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
609 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
610 void abs() throw(INTERP_KERNEL::Exception);
611 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
612 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
613 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
614 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
615 void applyPow(double val) throw(INTERP_KERNEL::Exception);
616 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
617 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
620 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
621 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
622 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
623 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
624 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
625 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
626 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
627 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
630 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
631 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
632 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
633 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
634 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
635 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
636 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
637 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
638 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
639 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
640 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
641 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
642 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
643 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
646 DataArrayDouble() throw(INTERP_KERNEL::Exception)
648 return DataArrayDouble::New();
651 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
653 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)";
654 std::string msg(msgBase);
656 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
659 if(PyList_Check(elt0) || PyTuple_Check(elt0))
663 if(PyInt_Check(nbOfTuples))
665 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
667 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
670 if(PyInt_Check(elt2))
671 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
672 int nbOfCompo=PyInt_AS_LONG(elt2);
674 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
675 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
676 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
677 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
681 throw INTERP_KERNEL::Exception(msg.c_str());
684 {//DataArrayDouble.New([1.,3.,4.],3)
685 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
687 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
688 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
693 throw INTERP_KERNEL::Exception(msg.c_str());
696 {// DataArrayDouble.New([1.,3.,4.])
697 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
698 int tmpp1=-1,tmpp2=-1;
699 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
700 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
704 else if(PyInt_Check(elt0))
706 int nbOfTuples1=PyInt_AS_LONG(elt0);
708 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
713 if(PyInt_Check(nbOfTuples))
714 {//DataArrayDouble.New(5,2)
715 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
717 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
718 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
719 ret->alloc(nbOfTuples1,nbOfCompo);
723 throw INTERP_KERNEL::Exception(msg.c_str());
726 throw INTERP_KERNEL::Exception(msg.c_str());
729 {//DataArrayDouble.New(5)
730 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
731 ret->alloc(nbOfTuples1,1);
736 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
737 {//DataArrayDouble.New(numpyArray)
738 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
742 throw INTERP_KERNEL::Exception(msg.c_str());
743 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
746 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
748 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
751 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
754 std::vector<double> bb;
756 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
757 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
758 self->pushBackValsSilent(tmp,tmp+nbTuples);
761 std::string __repr__() const throw(INTERP_KERNEL::Exception)
763 std::ostringstream oss;
764 self->reprQuickOverview(oss);
768 std::string __str__() const throw(INTERP_KERNEL::Exception)
770 return self->reprNotTooLong();
773 double __float__() const throw(INTERP_KERNEL::Exception)
775 return self->doubleValue();
778 int __len__() const throw(INTERP_KERNEL::Exception)
780 if(self->isAllocated())
782 return self->getNumberOfTuples();
786 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
790 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
792 return self->iterator();
795 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
797 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 !";
798 if(PyList_Check(li) || PyTuple_Check(li))
802 if(PyInt_Check(nbOfTuples))
804 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
806 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
809 if(PyInt_Check(nbOfComp))
810 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
811 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
813 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
814 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
815 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
818 throw INTERP_KERNEL::Exception(msg);
821 {//DataArrayDouble.setValues([1.,3.,4.],3)
823 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
824 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
828 throw INTERP_KERNEL::Exception(msg);
831 {// DataArrayDouble.setValues([1.,3.,4.])
832 int tmpp1=-1,tmpp2=-1;
833 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
834 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
838 throw INTERP_KERNEL::Exception(msg);
841 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
843 const double *vals=self->getConstPointer();
844 return convertDblArrToPyList(vals,self->getNbOfElems());
848 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
850 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
854 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
857 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
858 PyObject *ret=PyTuple_New(2);
859 PyObject *ret0Py=ret0?Py_True:Py_False;
861 PyTuple_SetItem(ret,0,ret0Py);
862 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
866 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
868 const double *vals=self->getConstPointer();
869 int nbOfComp=self->getNumberOfComponents();
870 int nbOfTuples=self->getNumberOfTuples();
871 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
874 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
876 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
878 DataArrayDouble *a,*a2;
879 DataArrayDoubleTuple *aa,*aa2;
880 std::vector<double> bb,bb2;
882 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
883 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
884 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
888 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
890 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
892 DataArrayDouble *a,*a2;
893 DataArrayDoubleTuple *aa,*aa2;
894 std::vector<double> bb,bb2;
896 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
898 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
899 return convertDblArrToPyListOfTuple(res,3,3);
902 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
905 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
906 if (!SWIG_IsOK(res1))
909 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
910 if(size!=self->getNumberOfTuples())
912 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
914 return self->renumber(tmp);
918 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
920 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
921 da2->checkAllocated();
922 int size=self->getNumberOfTuples();
923 if(size!=self->getNumberOfTuples())
925 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
927 return self->renumber(da2->getConstPointer());
931 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
934 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
935 if (!SWIG_IsOK(res1))
938 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
939 if(size!=self->getNumberOfTuples())
941 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
943 return self->renumberR(tmp);
947 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
949 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
950 da2->checkAllocated();
951 int size=self->getNumberOfTuples();
952 if(size!=self->getNumberOfTuples())
954 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
956 return self->renumberR(da2->getConstPointer());
960 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
963 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
964 if (!SWIG_IsOK(res1))
967 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
968 if(size!=self->getNumberOfTuples())
970 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
972 return self->renumberAndReduce(tmp,newNbOfTuple);
976 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
978 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
979 da2->checkAllocated();
980 int size=self->getNumberOfTuples();
981 if(size!=self->getNumberOfTuples())
983 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
985 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
989 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
991 int thisTupleId,otherTupleId;
992 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
993 PyObject *ret=PyTuple_New(3);
994 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
995 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
996 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1000 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1003 double r1=self->getMaxValue(tmp);
1004 PyObject *ret=PyTuple_New(2);
1005 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1006 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1010 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1013 double r1=self->getMaxValue2(tmp);
1014 PyObject *ret=PyTuple_New(2);
1015 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1016 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1020 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1023 double r1=self->getMinValue(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 *getMinValue2() const throw(INTERP_KERNEL::Exception)
1033 double r1=self->getMinValue2(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 *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1042 int nbOfCompo=self->getNumberOfComponents();
1043 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1044 self->getMinMaxPerComponent(tmp);
1045 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1049 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1051 int sz=self->getNumberOfComponents();
1052 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1053 self->accumulate(tmp);
1054 return convertDblArrToPyList(tmp,sz);
1057 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1060 std::vector<int> val2;
1061 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1062 return self->accumulatePerChunck(bg,bg+sz);
1065 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1067 DataArrayInt *comm, *commIndex;
1068 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1069 PyObject *res = PyList_New(2);
1070 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1071 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1075 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1079 DataArrayDoubleTuple *aa;
1080 std::vector<double> bb;
1082 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1083 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1085 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1086 PyObject *ret=PyTuple_New(2);
1087 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1088 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1092 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1094 std::vector<int> tmp;
1095 convertPyToNewIntArr3(li,tmp);
1096 self->setSelectedComponents(a,tmp);
1099 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1101 int sz=self->getNumberOfComponents();
1102 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1103 self->getTuple(tupleId,tmp);
1104 return convertDblArrToPyList(tmp,sz);
1107 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1109 std::vector<const DataArrayDouble *> tmp;
1110 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1111 return DataArrayDouble::Aggregate(tmp);
1114 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1116 std::vector<const DataArrayDouble *> tmp;
1117 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1118 return DataArrayDouble::Meld(tmp);
1121 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1125 DataArrayDoubleTuple *aa;
1126 std::vector<double> bb;
1128 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1129 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1130 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1131 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1132 DataArrayInt *c=0,*cI=0;
1133 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1134 PyObject *ret=PyTuple_New(2);
1135 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1136 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1140 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1142 DataArrayInt *ret1=0;
1143 bool ret0=self->areIncludedInMe(other,prec,ret1);
1144 PyObject *ret=PyTuple_New(2);
1145 PyObject *ret0Py=ret0?Py_True:Py_False;
1147 PyTuple_SetItem(ret,0,ret0Py);
1148 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1152 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1154 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1155 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1156 self->checkAllocated();
1157 int nbOfTuples=self->getNumberOfTuples();
1158 int nbOfComponents=self->getNumberOfComponents();
1160 std::vector<int> vt1,vc1;
1161 std::pair<int, std::pair<int,int> > pt1,pc1;
1162 DataArrayInt *dt1=0,*dc1=0;
1164 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1165 MCAuto<DataArrayDouble> ret;
1169 if(nbOfComponents==1)
1170 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1171 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1173 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1175 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1177 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1179 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1182 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1183 std::vector<int> v2(1,ic1);
1184 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1188 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1189 std::vector<int> v2(1,ic1);
1190 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1194 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1195 std::vector<int> v2(1,ic1);
1196 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1200 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1205 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1206 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1210 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1211 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1215 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1216 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1220 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1221 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1222 std::vector<int> v2(nbOfComp);
1223 for(int i=0;i<nbOfComp;i++)
1224 v2[i]=pc1.first+i*pc1.second.second;
1225 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1229 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1230 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1231 std::vector<int> v2(nbOfComp);
1232 for(int i=0;i<nbOfComp;i++)
1233 v2[i]=pc1.first+i*pc1.second.second;
1234 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1238 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1239 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1240 std::vector<int> v2(nbOfComp);
1241 for(int i=0;i<nbOfComp;i++)
1242 v2[i]=pc1.first+i*pc1.second.second;
1243 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1247 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1248 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1249 std::vector<int> v2(nbOfComp);
1250 for(int i=0;i<nbOfComp;i++)
1251 v2[i]=pc1.first+i*pc1.second.second;
1252 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1255 throw INTERP_KERNEL::Exception(msg);
1259 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1261 self->checkAllocated();
1262 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1263 int nbOfTuples=self->getNumberOfTuples();
1264 int nbOfComponents=self->getNumberOfComponents();
1267 std::vector<double> v1;
1268 DataArrayDouble *d1=0;
1269 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1271 std::vector<int> vt1,vc1;
1272 std::pair<int, std::pair<int,int> > pt1,pc1;
1273 DataArrayInt *dt1=0,*dc1=0;
1274 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1275 MCAuto<DataArrayDouble> tmp;
1283 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1286 tmp=DataArrayDouble::New();
1287 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1288 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1291 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1294 throw INTERP_KERNEL::Exception(msg);
1303 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1306 tmp=DataArrayDouble::New();
1307 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1308 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1311 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1314 throw INTERP_KERNEL::Exception(msg);
1323 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1326 tmp=DataArrayDouble::New();
1327 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1328 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1331 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1334 throw INTERP_KERNEL::Exception(msg);
1343 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1346 tmp=DataArrayDouble::New();
1347 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1348 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1351 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1354 throw INTERP_KERNEL::Exception(msg);
1363 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1366 tmp=DataArrayDouble::New();
1367 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1368 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1371 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1374 throw INTERP_KERNEL::Exception(msg);
1383 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1386 tmp=DataArrayDouble::New();
1387 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1388 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1391 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1394 throw INTERP_KERNEL::Exception(msg);
1403 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1406 tmp=DataArrayDouble::New();
1407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1408 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1411 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1414 throw INTERP_KERNEL::Exception(msg);
1423 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1426 tmp=DataArrayDouble::New();
1427 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1428 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1431 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1434 throw INTERP_KERNEL::Exception(msg);
1443 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1446 tmp=DataArrayDouble::New();
1447 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1448 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1451 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1454 throw INTERP_KERNEL::Exception(msg);
1463 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&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,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1471 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1474 throw INTERP_KERNEL::Exception(msg);
1483 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1486 tmp=DataArrayDouble::New();
1487 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1488 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1491 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1494 throw INTERP_KERNEL::Exception(msg);
1503 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1506 tmp=DataArrayDouble::New();
1507 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1508 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1511 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1514 throw INTERP_KERNEL::Exception(msg);
1523 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1526 tmp=DataArrayDouble::New();
1527 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1528 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1531 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1534 throw INTERP_KERNEL::Exception(msg);
1543 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),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->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1551 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1554 throw INTERP_KERNEL::Exception(msg);
1563 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,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->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1571 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1574 throw INTERP_KERNEL::Exception(msg);
1583 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),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->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1591 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1594 throw INTERP_KERNEL::Exception(msg);
1599 throw INTERP_KERNEL::Exception(msg);
1604 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1606 return self->negate();
1609 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1611 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1614 DataArrayDoubleTuple *aa;
1615 std::vector<double> bb;
1618 #ifndef WITHOUT_AUTOFIELD
1620 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1622 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1625 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1626 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1628 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1631 throw INTERP_KERNEL::Exception(msg);
1635 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1640 MCAuto<DataArrayDouble> ret=self->deepCopy();
1641 ret->applyLin(1.,val);
1642 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1646 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1650 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1651 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1655 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1656 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1659 throw INTERP_KERNEL::Exception(msg);
1663 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1665 const char msg[]="Unexpected situation in __radd__ !";
1668 DataArrayDoubleTuple *aa;
1669 std::vector<double> bb;
1671 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1676 MCAuto<DataArrayDouble> ret=self->deepCopy();
1677 ret->applyLin(1.,val);
1682 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1683 return DataArrayDouble::Add(self,aaa);
1687 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1688 return DataArrayDouble::Add(self,aaa);
1691 throw INTERP_KERNEL::Exception(msg);
1695 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1697 const char msg[]="Unexpected situation in __iadd__ !";
1700 DataArrayDoubleTuple *aa;
1701 std::vector<double> bb;
1703 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1708 self->applyLin(1.,val);
1709 Py_XINCREF(trueSelf);
1715 Py_XINCREF(trueSelf);
1720 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1721 self->addEqual(aaa);
1722 Py_XINCREF(trueSelf);
1727 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1728 self->addEqual(aaa);
1729 Py_XINCREF(trueSelf);
1733 throw INTERP_KERNEL::Exception(msg);
1737 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1739 const char msg[]="Unexpected situation in __sub__ !";
1742 DataArrayDoubleTuple *aa;
1743 std::vector<double> bb;
1746 #ifndef WITHOUT_AUTOFIELD
1748 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1750 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1753 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1754 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1756 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1759 throw INTERP_KERNEL::Exception(msg);
1763 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1768 MCAuto<DataArrayDouble> ret=self->deepCopy();
1769 ret->applyLin(1.,-val);
1770 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1774 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1778 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1779 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1783 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1784 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1787 throw INTERP_KERNEL::Exception(msg);
1791 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1793 const char msg[]="Unexpected situation in __rsub__ !";
1796 DataArrayDoubleTuple *aa;
1797 std::vector<double> bb;
1799 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1804 MCAuto<DataArrayDouble> ret=self->deepCopy();
1805 ret->applyLin(-1.,val);
1810 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1811 return DataArrayDouble::Substract(aaa,self);
1815 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1816 return DataArrayDouble::Substract(aaa,self);
1819 throw INTERP_KERNEL::Exception(msg);
1823 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1825 const char msg[]="Unexpected situation in __isub__ !";
1828 DataArrayDoubleTuple *aa;
1829 std::vector<double> bb;
1831 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1836 self->applyLin(1,-val);
1837 Py_XINCREF(trueSelf);
1842 self->substractEqual(a);
1843 Py_XINCREF(trueSelf);
1848 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1849 self->substractEqual(aaa);
1850 Py_XINCREF(trueSelf);
1855 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1856 self->substractEqual(aaa);
1857 Py_XINCREF(trueSelf);
1861 throw INTERP_KERNEL::Exception(msg);
1865 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1867 const char msg[]="Unexpected situation in __mul__ !";
1870 DataArrayDoubleTuple *aa;
1871 std::vector<double> bb;
1874 #ifndef WITHOUT_AUTOFIELD
1876 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1878 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1881 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1882 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1884 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1887 throw INTERP_KERNEL::Exception(msg);
1891 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1896 MCAuto<DataArrayDouble> ret=self->deepCopy();
1897 ret->applyLin(val,0.);
1898 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1902 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1906 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1907 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1911 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1912 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1915 throw INTERP_KERNEL::Exception(msg);
1919 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1921 const char msg[]="Unexpected situation in __rmul__ !";
1924 DataArrayDoubleTuple *aa;
1925 std::vector<double> bb;
1927 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1932 MCAuto<DataArrayDouble> ret=self->deepCopy();
1933 ret->applyLin(val,0.);
1938 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1939 return DataArrayDouble::Multiply(self,aaa);
1943 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1944 return DataArrayDouble::Multiply(self,aaa);
1947 throw INTERP_KERNEL::Exception(msg);
1951 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1953 const char msg[]="Unexpected situation in __imul__ !";
1956 DataArrayDoubleTuple *aa;
1957 std::vector<double> bb;
1959 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1964 self->applyLin(val,0.);
1965 Py_XINCREF(trueSelf);
1970 self->multiplyEqual(a);
1971 Py_XINCREF(trueSelf);
1976 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1977 self->multiplyEqual(aaa);
1978 Py_XINCREF(trueSelf);
1983 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1984 self->multiplyEqual(aaa);
1985 Py_XINCREF(trueSelf);
1989 throw INTERP_KERNEL::Exception(msg);
1993 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1995 const char msg[]="Unexpected situation in __div__ !";
1998 DataArrayDoubleTuple *aa;
1999 std::vector<double> bb;
2002 #ifndef WITHOUT_AUTOFIELD
2004 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2006 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2009 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2010 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2012 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2015 throw INTERP_KERNEL::Exception(msg);
2019 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2025 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2026 MCAuto<DataArrayDouble> ret=self->deepCopy();
2027 ret->applyLin(1/val,0.);
2028 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2032 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2036 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2037 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2041 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2042 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2045 throw INTERP_KERNEL::Exception(msg);
2049 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2051 const char msg[]="Unexpected situation in __rdiv__ !";
2054 DataArrayDoubleTuple *aa;
2055 std::vector<double> bb;
2057 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2062 MCAuto<DataArrayDouble> ret=self->deepCopy();
2068 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2069 return DataArrayDouble::Divide(aaa,self);
2073 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2074 return DataArrayDouble::Divide(aaa,self);
2077 throw INTERP_KERNEL::Exception(msg);
2081 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2083 const char msg[]="Unexpected situation in __idiv__ !";
2086 DataArrayDoubleTuple *aa;
2087 std::vector<double> bb;
2089 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2095 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2096 self->applyLin(1./val,0.);
2097 Py_XINCREF(trueSelf);
2102 self->divideEqual(a);
2103 Py_XINCREF(trueSelf);
2108 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2109 self->divideEqual(aaa);
2110 Py_XINCREF(trueSelf);
2115 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2116 self->divideEqual(aaa);
2117 Py_XINCREF(trueSelf);
2121 throw INTERP_KERNEL::Exception(msg);
2125 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2127 const char msg[]="Unexpected situation in __pow__ !";
2130 DataArrayDoubleTuple *aa;
2131 std::vector<double> bb;
2133 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2138 MCAuto<DataArrayDouble> ret=self->deepCopy();
2144 return DataArrayDouble::Pow(self,a);
2148 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2149 return DataArrayDouble::Pow(self,aaa);
2153 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2154 return DataArrayDouble::Pow(self,aaa);
2157 throw INTERP_KERNEL::Exception(msg);
2161 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2163 const char msg[]="Unexpected situation in __rpow__ !";
2166 DataArrayDoubleTuple *aa;
2167 std::vector<double> bb;
2169 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2174 MCAuto<DataArrayDouble> ret=self->deepCopy();
2175 ret->applyRPow(val);
2180 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2181 return DataArrayDouble::Pow(aaa,self);
2185 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2186 return DataArrayDouble::Pow(aaa,self);
2189 throw INTERP_KERNEL::Exception(msg);
2193 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2195 const char msg[]="Unexpected situation in __ipow__ !";
2198 DataArrayDoubleTuple *aa;
2199 std::vector<double> bb;
2201 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2206 self->applyPow(val);
2207 Py_XINCREF(trueSelf);
2213 Py_XINCREF(trueSelf);
2218 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2219 self->powEqual(aaa);
2220 Py_XINCREF(trueSelf);
2225 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2226 self->powEqual(aaa);
2227 Py_XINCREF(trueSelf);
2231 throw INTERP_KERNEL::Exception(msg);
2235 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2237 DataArrayInt *c=0,*cI=0;
2239 self->computeTupleIdsNearTuples(other,eps,c,cI);
2240 PyObject *ret=PyTuple_New(2);
2241 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2242 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2246 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2248 DataArrayInt *ret1=0;
2249 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2250 PyObject *ret=PyTuple_New(2);
2251 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2252 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2257 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2259 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2262 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2265 if(!self->isAllocated())
2266 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2267 PyObject *ret(PyTuple_New(1));
2268 PyObject *ret0(PyDict_New());
2269 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2270 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2271 PyObject *tmp1(PyInt_FromLong(0));
2272 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2273 PyTuple_SetItem(ret,0,ret0);
2277 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2283 class DataArrayDoubleTuple;
2285 class DataArrayDoubleIterator
2288 DataArrayDoubleIterator(DataArrayDouble *da);
2289 ~DataArrayDoubleIterator();
2294 DataArrayDoubleTuple *ret=self->nextt();
2296 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2299 PyErr_SetString(PyExc_StopIteration,"No more data.");
2306 class DataArrayDoubleTuple
2309 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2310 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2313 std::string __str__() const throw(INTERP_KERNEL::Exception)
2315 return self->repr();
2318 double __float__() const throw(INTERP_KERNEL::Exception)
2320 return self->doubleValue();
2323 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2325 return self->buildDADouble(1,self->getNumberOfCompo());
2328 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2330 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2331 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2332 Py_XINCREF(trueSelf);
2336 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2338 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2339 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2340 Py_XINCREF(trueSelf);
2344 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2346 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2347 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2348 Py_XINCREF(trueSelf);
2352 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2354 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2355 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2356 Py_XINCREF(trueSelf);
2360 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2362 return PyInt_FromLong(self->getNumberOfCompo());
2365 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2367 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2370 std::vector<int> multiVal;
2371 std::pair<int, std::pair<int,int> > slic;
2372 MEDCoupling::DataArrayInt *daIntTyypp=0;
2373 const double *pt=self->getConstPointer();
2374 int nbc=self->getNumberOfCompo();
2375 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2382 std::ostringstream oss;
2383 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2384 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2388 return PyFloat_FromDouble(pt[singleVal]);
2392 return PyFloat_FromDouble(pt[nbc+singleVal]);
2395 std::ostringstream oss;
2396 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2397 throw INTERP_KERNEL::Exception(oss.str().c_str());
2403 PyObject *t=PyTuple_New(multiVal.size());
2404 for(int j=0;j<(int)multiVal.size();j++)
2406 int cid=multiVal[j];
2409 std::ostringstream oss;
2410 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2411 throw INTERP_KERNEL::Exception(oss.str().c_str());
2413 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2419 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2420 PyObject *t=PyTuple_New(sz);
2421 for(int j=0;j<sz;j++)
2422 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2426 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2430 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2432 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2433 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2436 std::vector<double> multiValV;
2437 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2438 int nbc=self->getNumberOfCompo();
2439 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2441 std::vector<int> multiVal;
2442 std::pair<int, std::pair<int,int> > slic;
2443 MEDCoupling::DataArrayInt *daIntTyypp=0;
2444 double *pt=self->getPointer();
2445 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2452 std::ostringstream oss;
2453 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2454 throw INTERP_KERNEL::Exception(oss.str().c_str());
2460 pt[singleVal]=singleValV;
2465 if(multiValV.size()!=1)
2467 std::ostringstream oss;
2468 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2469 throw INTERP_KERNEL::Exception(oss.str().c_str());
2471 pt[singleVal]=multiValV[0];
2476 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2480 throw INTERP_KERNEL::Exception(msg);
2489 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2493 std::ostringstream oss;
2494 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2495 throw INTERP_KERNEL::Exception(oss.str().c_str());
2503 if(multiVal.size()!=multiValV.size())
2505 std::ostringstream oss;
2506 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2507 throw INTERP_KERNEL::Exception(oss.str().c_str());
2509 for(int i=0;i<(int)multiVal.size();i++)
2511 int pos=multiVal[i];
2514 std::ostringstream oss;
2515 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2516 throw INTERP_KERNEL::Exception(oss.str().c_str());
2518 pt[multiVal[i]]=multiValV[i];
2524 const double *ptV=daIntTyyppV->getConstPointer();
2525 if(nbc>daIntTyyppV->getNumberOfCompo())
2527 std::ostringstream oss;
2528 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2529 throw INTERP_KERNEL::Exception(oss.str().c_str());
2531 std::copy(ptV,ptV+nbc,pt);
2535 throw INTERP_KERNEL::Exception(msg);
2540 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2545 for(int j=0;j<sz;j++)
2546 pt[slic.first+j*slic.second.second]=singleValV;
2551 if(sz!=(int)multiValV.size())
2553 std::ostringstream oss;
2554 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2555 throw INTERP_KERNEL::Exception(oss.str().c_str());
2557 for(int j=0;j<sz;j++)
2558 pt[slic.first+j*slic.second.second]=multiValV[j];
2563 const double *ptV=daIntTyyppV->getConstPointer();
2564 if(sz>daIntTyyppV->getNumberOfCompo())
2566 std::ostringstream oss;
2567 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2568 throw INTERP_KERNEL::Exception(oss.str().c_str());
2570 for(int j=0;j<sz;j++)
2571 pt[slic.first+j*slic.second.second]=ptV[j];
2575 throw INTERP_KERNEL::Exception(msg);
2579 throw INTERP_KERNEL::Exception(msg);
2585 class DataArrayIntIterator;
2587 class DataArrayInt : public DataArray
2590 static DataArrayInt *New();
2591 int intValue() const throw(INTERP_KERNEL::Exception);
2592 int getHashCode() const throw(INTERP_KERNEL::Exception);
2593 bool empty() const throw(INTERP_KERNEL::Exception);
2594 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2595 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2596 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2597 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2598 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2599 int popBackSilent() throw(INTERP_KERNEL::Exception);
2600 void pack() const throw(INTERP_KERNEL::Exception);
2601 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2602 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2603 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2604 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2605 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2606 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2607 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2608 void reverse() throw(INTERP_KERNEL::Exception);
2609 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2610 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2611 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2612 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2613 void fillWithZero() throw(INTERP_KERNEL::Exception);
2614 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2615 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2616 std::string repr() const throw(INTERP_KERNEL::Exception);
2617 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2618 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2619 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2620 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2621 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2622 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2623 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2624 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2625 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2626 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2627 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2628 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2629 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2630 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2631 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2632 void transpose() throw(INTERP_KERNEL::Exception);
2633 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2634 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2635 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2636 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2637 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2638 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2639 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2640 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2641 int front() const throw(INTERP_KERNEL::Exception);
2642 int back() const throw(INTERP_KERNEL::Exception);
2643 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2644 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2645 int *getPointer() throw(INTERP_KERNEL::Exception);
2646 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2647 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2648 const int *begin() const throw(INTERP_KERNEL::Exception);
2649 const int *end() const throw(INTERP_KERNEL::Exception);
2650 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2651 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2652 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2653 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2654 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2655 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2656 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2657 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2658 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2659 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2660 int count(int value) const throw(INTERP_KERNEL::Exception);
2661 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2662 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2663 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2664 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2665 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2666 void abs() throw(INTERP_KERNEL::Exception);
2667 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2668 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2669 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2670 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2671 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2672 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2673 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2674 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2675 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2676 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2677 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2678 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2679 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2680 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2681 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2682 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2683 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2684 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2685 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2686 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2688 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2689 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2690 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2691 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2692 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2693 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2694 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2695 void computeOffsets() throw(INTERP_KERNEL::Exception);
2696 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2697 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2698 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2699 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2700 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2701 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2702 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2703 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2704 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2705 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2706 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2707 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2708 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2709 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2710 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2711 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2712 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2713 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2714 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2716 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2719 DataArrayInt() throw(INTERP_KERNEL::Exception)
2721 return DataArrayInt::New();
2724 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2726 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)";
2727 std::string msg(msgBase);
2729 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2732 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2736 if(PyInt_Check(nbOfTuples))
2738 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2740 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2743 if(PyInt_Check(nbOfComp))
2744 {//DataArrayInt.New([1,3,4,5],2,2)
2745 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2747 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2748 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2749 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2750 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2754 throw INTERP_KERNEL::Exception(msg.c_str());
2757 {//DataArrayInt.New([1,3,4],3)
2758 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2760 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2761 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2766 throw INTERP_KERNEL::Exception(msg.c_str());
2769 {// DataArrayInt.New([1,3,4])
2770 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2771 int tmpp1=-1,tmpp2=-1;
2772 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2773 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2777 else if(PyInt_Check(elt0))
2779 int nbOfTuples1=PyInt_AS_LONG(elt0);
2781 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2786 if(PyInt_Check(nbOfTuples))
2787 {//DataArrayInt.New(5,2)
2788 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2790 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2791 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2792 ret->alloc(nbOfTuples1,nbOfCompo);
2796 throw INTERP_KERNEL::Exception(msg.c_str());
2799 throw INTERP_KERNEL::Exception(msg.c_str());
2802 {//DataArrayInt.New(5)
2803 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2804 ret->alloc(nbOfTuples1,1);
2809 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2810 {//DataArrayInt.New(numpyArray)
2811 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2815 throw INTERP_KERNEL::Exception(msg.c_str());
2816 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2819 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2821 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2824 std::string __str__() const throw(INTERP_KERNEL::Exception)
2826 return self->reprNotTooLong();
2829 int __len__() const throw(INTERP_KERNEL::Exception)
2831 if(self->isAllocated())
2833 return self->getNumberOfTuples();
2837 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2841 int __int__() const throw(INTERP_KERNEL::Exception)
2843 return self->intValue();
2846 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2848 return self->iterator();
2851 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2853 int sz=self->getNumberOfComponents();
2854 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2855 self->accumulate(tmp);
2856 return convertIntArrToPyList(tmp,sz);
2859 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2862 std::vector<int> val2;
2863 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2864 return self->accumulatePerChunck(bg,bg+sz);
2867 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2870 std::vector<int> val2;
2871 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2872 return self->findIdsEqualTuple(bg,bg+sz);
2875 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2877 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2878 PyObject *ret=PyList_New(slcs.size());
2879 for(std::size_t i=0;i<slcs.size();i++)
2880 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2884 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2886 if(!PySlice_Check(slic))
2887 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2888 Py_ssize_t strt=2,stp=2,step=2;
2889 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2890 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2891 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2892 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 !");
2893 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2896 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2899 self->getMinMaxValues(a,b);
2900 PyObject *ret=PyTuple_New(2);
2901 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2902 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2906 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2908 int newNbOfTuples=-1;
2909 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2910 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2911 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2912 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2913 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2914 PyObject *ret=PyTuple_New(2);
2915 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2916 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2920 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2922 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2923 int szArr,sw,iTypppArr;
2924 std::vector<int> stdvecTyyppArr;
2925 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2926 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2927 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2931 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2933 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 !";
2934 if(PyList_Check(li) || PyTuple_Check(li))
2938 if(PyInt_Check(nbOfTuples))
2940 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2942 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2945 if(PyInt_Check(nbOfComp))
2946 {//DataArrayInt.setValues([1,3,4,5],2,2)
2947 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2949 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2950 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2951 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2954 throw INTERP_KERNEL::Exception(msg);
2957 {//DataArrayInt.setValues([1,3,4],3)
2959 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2960 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2964 throw INTERP_KERNEL::Exception(msg);
2967 {// DataArrayInt.setValues([1,3,4])
2968 int tmpp1=-1,tmpp2=-1;
2969 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2970 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2974 throw INTERP_KERNEL::Exception(msg);
2977 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2979 const int *vals=self->getConstPointer();
2980 return convertIntArrToPyList(vals,self->getNbOfElems());
2984 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2986 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2990 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2993 bool ret0=self->isEqualIfNotWhy(other,ret1);
2994 PyObject *ret=PyTuple_New(2);
2995 PyObject *ret0Py=ret0?Py_True:Py_False;
2997 PyTuple_SetItem(ret,0,ret0Py);
2998 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3002 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3004 const int *vals=self->getConstPointer();
3005 int nbOfComp=self->getNumberOfComponents();
3006 int nbOfTuples=self->getNumberOfTuples();
3007 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3010 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3012 std::vector<const DataArrayInt *> groups;
3013 std::vector< std::vector<int> > fidsOfGroups;
3014 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3015 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3016 PyObject *ret = PyList_New(2);
3017 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3018 int sz=fidsOfGroups.size();
3019 PyObject *ret1 = PyList_New(sz);
3020 for(int i=0;i<sz;i++)
3021 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3022 PyList_SetItem(ret,1,ret1);
3026 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3029 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3030 if (!SWIG_IsOK(res1))
3033 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3034 self->transformWithIndArr(tmp,tmp+size);
3038 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3039 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3043 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3047 std::vector<int> multiVal;
3048 std::pair<int, std::pair<int,int> > slic;
3049 MEDCoupling::DataArrayInt *daIntTyypp=0;
3050 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3054 return self->findIdsEqualList(&singleVal,&singleVal+1);
3056 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3058 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3060 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3064 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3068 std::vector<int> multiVal;
3069 std::pair<int, std::pair<int,int> > slic;
3070 MEDCoupling::DataArrayInt *daIntTyypp=0;
3071 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3075 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3077 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3079 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3081 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3085 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3087 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3089 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3090 if (!SWIG_IsOK(res1))
3093 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3094 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3098 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3100 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3101 da2->checkAllocated();
3102 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3104 PyObject *ret = PyList_New(3);
3105 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3106 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3107 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3111 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3114 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3115 if (!SWIG_IsOK(res1))
3118 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3119 return self->transformWithIndArrR(tmp,tmp+size);
3123 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3124 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3128 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3131 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3132 if (!SWIG_IsOK(res1))
3135 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3136 if(size!=self->getNumberOfTuples())
3138 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3140 return self->renumberAndReduce(tmp,newNbOfTuple);
3144 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3146 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3147 da2->checkAllocated();
3148 int size=self->getNumberOfTuples();
3149 if(size!=self->getNumberOfTuples())
3151 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3153 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3157 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3160 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3161 if (!SWIG_IsOK(res1))
3164 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3165 if(size!=self->getNumberOfTuples())
3167 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3169 return self->renumber(tmp);
3173 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3175 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3176 da2->checkAllocated();
3177 int size=self->getNumberOfTuples();
3178 if(size!=self->getNumberOfTuples())
3180 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3182 return self->renumber(da2->getConstPointer());
3186 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3189 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3190 if (!SWIG_IsOK(res1))
3193 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3194 if(size!=self->getNumberOfTuples())
3196 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3198 return self->renumberR(tmp);
3202 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3204 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3205 da2->checkAllocated();
3206 int size=self->getNumberOfTuples();
3207 if(size!=self->getNumberOfTuples())
3209 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3211 return self->renumberR(da2->getConstPointer());
3215 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3217 std::vector<int> tmp;
3218 convertPyToNewIntArr3(li,tmp);
3219 self->setSelectedComponents(a,tmp);
3222 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3224 int sz=self->getNumberOfComponents();
3225 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3226 self->getTuple(tupleId,tmp);
3227 return convertIntArrToPyList(tmp,sz);
3230 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3232 DataArrayInt *arr=0;
3233 DataArrayInt *arrI=0;
3234 self->changeSurjectiveFormat(targetNb,arr,arrI);
3235 PyObject *res = PyList_New(2);
3236 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3237 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3241 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3243 std::vector<const DataArrayInt *> tmp;
3244 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3245 return DataArrayInt::Meld(tmp);
3248 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3250 std::vector<const DataArrayInt *> tmp;
3251 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3252 return DataArrayInt::Aggregate(tmp);
3255 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3257 std::vector<const DataArrayInt *> tmp;
3258 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3259 return DataArrayInt::AggregateIndexes(tmp);
3262 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3264 std::vector<const DataArrayInt *> tmp;
3265 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3266 return DataArrayInt::BuildUnion(tmp);
3269 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3271 std::vector<const DataArrayInt *> tmp;
3272 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3273 return DataArrayInt::BuildIntersection(tmp);
3276 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3279 int r1=self->getMaxValue(tmp);
3280 PyObject *ret=PyTuple_New(2);
3281 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3282 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3286 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3289 int r1=self->getMinValue(tmp);
3290 PyObject *ret=PyTuple_New(2);
3291 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3292 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3296 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3298 int nbOfCompo=self->getNumberOfComponents();
3303 if(PyInt_Check(obj))
3305 int val=(int)PyInt_AS_LONG(obj);
3306 return self->findIdFirstEqual(val);
3309 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3313 std::vector<int> arr;
3314 convertPyToNewIntArr3(obj,arr);
3315 return self->findIdFirstEqualTuple(arr);
3320 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3322 int nbOfCompo=self->getNumberOfComponents();
3329 if(PyInt_Check(obj))
3331 int val=(int)PyInt_AS_LONG(obj);
3332 return self->presenceOfValue(val);
3335 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3339 std::vector<int> arr;
3340 convertPyToNewIntArr3(obj,arr);
3341 return self->presenceOfTuple(arr);
3346 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3348 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3349 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3350 self->checkAllocated();
3351 int nbOfTuples=self->getNumberOfTuples();
3352 int nbOfComponents=self->getNumberOfComponents();
3354 std::vector<int> vt1,vc1;
3355 std::pair<int, std::pair<int,int> > pt1,pc1;
3356 DataArrayInt *dt1=0,*dc1=0;
3358 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3359 MCAuto<DataArrayInt> ret;
3364 if(nbOfComponents==1)
3365 return PyInt_FromLong(self->getIJSafe(it1,0));
3366 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3369 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3371 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3373 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3375 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3378 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3379 std::vector<int> v2(1,ic1);
3380 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3384 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3385 std::vector<int> v2(1,ic1);
3386 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3390 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3391 std::vector<int> v2(1,ic1);
3392 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3396 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3397 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3401 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3402 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3406 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3407 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3411 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3412 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3416 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3417 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3418 std::vector<int> v2(nbOfComp);
3419 for(int i=0;i<nbOfComp;i++)
3420 v2[i]=pc1.first+i*pc1.second.second;
3421 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3425 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3426 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3427 std::vector<int> v2(nbOfComp);
3428 for(int i=0;i<nbOfComp;i++)
3429 v2[i]=pc1.first+i*pc1.second.second;
3430 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3434 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3435 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3436 std::vector<int> v2(nbOfComp);
3437 for(int i=0;i<nbOfComp;i++)
3438 v2[i]=pc1.first+i*pc1.second.second;
3439 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3443 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3444 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3445 std::vector<int> v2(nbOfComp);
3446 for(int i=0;i<nbOfComp;i++)
3447 v2[i]=pc1.first+i*pc1.second.second;
3448 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3451 throw INTERP_KERNEL::Exception(msg);
3455 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3457 self->checkAllocated();
3458 const char msg[]="Unexpected situation in __setitem__ !";
3459 int nbOfTuples=self->getNumberOfTuples();
3460 int nbOfComponents=self->getNumberOfComponents();
3463 std::vector<int> v1;
3465 DataArrayIntTuple *dd1=0;
3466 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3468 std::vector<int> vt1,vc1;
3469 std::pair<int, std::pair<int,int> > pt1,pc1;
3470 DataArrayInt *dt1=0,*dc1=0;
3471 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3472 MCAuto<DataArrayInt> tmp;
3480 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3483 tmp=DataArrayInt::New();
3484 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3485 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3488 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3491 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3492 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3495 throw INTERP_KERNEL::Exception(msg);
3504 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3507 tmp=DataArrayInt::New();
3508 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3509 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3512 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3515 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3516 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3519 throw INTERP_KERNEL::Exception(msg);
3528 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3531 tmp=DataArrayInt::New();
3532 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3533 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3536 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3539 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3540 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3543 throw INTERP_KERNEL::Exception(msg);
3552 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3555 tmp=DataArrayInt::New();
3556 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3557 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3560 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3563 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3564 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3567 throw INTERP_KERNEL::Exception(msg);
3576 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3579 tmp=DataArrayInt::New();
3580 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3581 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3584 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3587 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3588 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3591 throw INTERP_KERNEL::Exception(msg);
3600 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3603 tmp=DataArrayInt::New();
3604 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3605 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3608 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3611 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3612 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3615 throw INTERP_KERNEL::Exception(msg);
3624 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3627 tmp=DataArrayInt::New();
3628 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3629 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3632 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3635 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3636 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3639 throw INTERP_KERNEL::Exception(msg);
3648 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3651 tmp=DataArrayInt::New();
3652 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3653 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3656 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3659 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3660 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3663 throw INTERP_KERNEL::Exception(msg);
3672 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3675 tmp=DataArrayInt::New();
3676 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3677 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3680 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3683 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3684 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3687 throw INTERP_KERNEL::Exception(msg);
3696 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3699 tmp=DataArrayInt::New();
3700 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3701 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3704 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3707 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3708 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3711 throw INTERP_KERNEL::Exception(msg);
3720 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3723 tmp=DataArrayInt::New();
3724 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3725 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3728 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3731 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3732 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3735 throw INTERP_KERNEL::Exception(msg);
3744 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3747 tmp=DataArrayInt::New();
3748 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3749 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3752 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3755 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3756 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3759 throw INTERP_KERNEL::Exception(msg);
3768 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3771 tmp=DataArrayInt::New();
3772 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3773 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3776 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3779 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3780 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3783 throw INTERP_KERNEL::Exception(msg);
3792 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3795 tmp=DataArrayInt::New();
3796 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3797 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3800 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3803 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3804 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3807 throw INTERP_KERNEL::Exception(msg);
3816 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3819 tmp=DataArrayInt::New();
3820 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3821 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3824 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3827 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3828 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3831 throw INTERP_KERNEL::Exception(msg);
3840 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3843 tmp=DataArrayInt::New();
3844 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3845 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3848 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3851 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3852 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3855 throw INTERP_KERNEL::Exception(msg);
3860 throw INTERP_KERNEL::Exception(msg);
3865 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3867 return self->negate();
3870 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3872 const char msg[]="Unexpected situation in __add__ !";
3875 std::vector<int> aa;
3876 DataArrayIntTuple *aaa;
3878 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3883 MCAuto<DataArrayInt> ret=self->deepCopy();
3884 ret->applyLin(1,val);
3889 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3890 return DataArrayInt::Add(self,aaaa);
3894 return DataArrayInt::Add(self,a);
3898 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3899 return DataArrayInt::Add(self,aaaa);
3902 throw INTERP_KERNEL::Exception(msg);
3906 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3908 const char msg[]="Unexpected situation in __radd__ !";
3911 std::vector<int> aa;
3912 DataArrayIntTuple *aaa;
3914 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3919 MCAuto<DataArrayInt> ret=self->deepCopy();
3920 ret->applyLin(1,val);
3925 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3926 return DataArrayInt::Add(self,aaaa);
3930 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3931 return DataArrayInt::Add(self,aaaa);
3934 throw INTERP_KERNEL::Exception(msg);
3938 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3940 const char msg[]="Unexpected situation in __iadd__ !";
3943 std::vector<int> aa;
3944 DataArrayIntTuple *aaa;
3946 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3951 self->applyLin(1,val);
3952 Py_XINCREF(trueSelf);
3957 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3959 Py_XINCREF(trueSelf);
3965 Py_XINCREF(trueSelf);
3970 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3971 self->addEqual(aaaa);
3972 Py_XINCREF(trueSelf);
3976 throw INTERP_KERNEL::Exception(msg);
3980 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3982 const char msg[]="Unexpected situation in __sub__ !";
3985 std::vector<int> aa;
3986 DataArrayIntTuple *aaa;
3988 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3993 MCAuto<DataArrayInt> ret=self->deepCopy();
3994 ret->applyLin(1,-val);
3999 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4000 return DataArrayInt::Substract(self,aaaa);
4004 return DataArrayInt::Substract(self,a);
4008 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4009 return DataArrayInt::Substract(self,aaaa);
4012 throw INTERP_KERNEL::Exception(msg);
4016 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4018 const char msg[]="Unexpected situation in __rsub__ !";
4021 std::vector<int> aa;
4022 DataArrayIntTuple *aaa;
4024 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4029 MCAuto<DataArrayInt> ret=self->deepCopy();
4030 ret->applyLin(-1,val);
4035 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4036 return DataArrayInt::Substract(aaaa,self);
4040 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4041 return DataArrayInt::Substract(aaaa,self);
4044 throw INTERP_KERNEL::Exception(msg);
4048 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4050 const char msg[]="Unexpected situation in __isub__ !";
4053 std::vector<int> aa;
4054 DataArrayIntTuple *aaa;
4056 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4061 self->applyLin(1,-val);
4062 Py_XINCREF(trueSelf);
4067 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4068 self->substractEqual(bb);
4069 Py_XINCREF(trueSelf);
4074 self->substractEqual(a);
4075 Py_XINCREF(trueSelf);
4080 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4081 self->substractEqual(aaaa);
4082 Py_XINCREF(trueSelf);
4086 throw INTERP_KERNEL::Exception(msg);
4090 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4092 const char msg[]="Unexpected situation in __mul__ !";
4095 std::vector<int> aa;
4096 DataArrayIntTuple *aaa;
4098 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4103 MCAuto<DataArrayInt> ret=self->deepCopy();
4104 ret->applyLin(val,0);
4109 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4110 return DataArrayInt::Multiply(self,aaaa);
4114 return DataArrayInt::Multiply(self,a);
4118 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4119 return DataArrayInt::Multiply(self,aaaa);
4122 throw INTERP_KERNEL::Exception(msg);
4126 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4128 const char msg[]="Unexpected situation in __rmul__ !";
4131 std::vector<int> aa;
4132 DataArrayIntTuple *aaa;
4134 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4139 MCAuto<DataArrayInt> ret=self->deepCopy();
4140 ret->applyLin(val,0);
4145 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4146 return DataArrayInt::Multiply(self,aaaa);
4150 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4151 return DataArrayInt::Multiply(self,aaaa);
4154 throw INTERP_KERNEL::Exception(msg);
4158 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4160 const char msg[]="Unexpected situation in __imul__ !";
4163 std::vector<int> aa;
4164 DataArrayIntTuple *aaa;
4166 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4171 self->applyLin(val,0);
4172 Py_XINCREF(trueSelf);
4177 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4178 self->multiplyEqual(bb);
4179 Py_XINCREF(trueSelf);
4184 self->multiplyEqual(a);
4185 Py_XINCREF(trueSelf);
4190 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4191 self->multiplyEqual(aaaa);
4192 Py_XINCREF(trueSelf);
4196 throw INTERP_KERNEL::Exception(msg);
4200 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4202 const char msg[]="Unexpected situation in __div__ !";
4205 std::vector<int> aa;
4206 DataArrayIntTuple *aaa;
4208 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4213 MCAuto<DataArrayInt> ret=self->deepCopy();
4214 ret->applyDivideBy(val);
4219 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4220 return DataArrayInt::Divide(self,aaaa);
4224 return DataArrayInt::Divide(self,a);
4228 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4229 return DataArrayInt::Divide(self,aaaa);
4232 throw INTERP_KERNEL::Exception(msg);
4236 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4238 const char msg[]="Unexpected situation in __rdiv__ !";
4241 std::vector<int> aa;
4242 DataArrayIntTuple *aaa;
4244 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4249 MCAuto<DataArrayInt> ret=self->deepCopy();
4255 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4256 return DataArrayInt::Divide(aaaa,self);
4260 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4261 return DataArrayInt::Divide(aaaa,self);
4264 throw INTERP_KERNEL::Exception(msg);
4268 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4270 const char msg[]="Unexpected situation in __idiv__ !";
4273 std::vector<int> aa;
4274 DataArrayIntTuple *aaa;
4276 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4281 self->applyDivideBy(val);
4282 Py_XINCREF(trueSelf);
4287 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4288 self->divideEqual(bb);
4289 Py_XINCREF(trueSelf);
4294 self->divideEqual(a);
4295 Py_XINCREF(trueSelf);
4300 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4301 self->divideEqual(aaaa);
4302 Py_XINCREF(trueSelf);
4306 throw INTERP_KERNEL::Exception(msg);
4310 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4312 const char msg[]="Unexpected situation in __mod__ !";
4315 std::vector<int> aa;
4316 DataArrayIntTuple *aaa;
4318 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4323 MCAuto<DataArrayInt> ret=self->deepCopy();
4324 ret->applyModulus(val);
4329 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4330 return DataArrayInt::Modulus(self,aaaa);
4334 return DataArrayInt::Modulus(self,a);
4338 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4339 return DataArrayInt::Modulus(self,aaaa);
4342 throw INTERP_KERNEL::Exception(msg);
4346 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4348 const char msg[]="Unexpected situation in __rmod__ !";
4351 std::vector<int> aa;
4352 DataArrayIntTuple *aaa;
4354 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4359 MCAuto<DataArrayInt> ret=self->deepCopy();
4360 ret->applyRModulus(val);
4365 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4366 return DataArrayInt::Modulus(aaaa,self);
4370 return DataArrayInt::Modulus(a,self);
4374 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4375 return DataArrayInt::Modulus(aaaa,self);
4378 throw INTERP_KERNEL::Exception(msg);
4382 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4384 const char msg[]="Unexpected situation in __imod__ !";
4387 std::vector<int> aa;
4388 DataArrayIntTuple *aaa;
4390 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4395 self->applyModulus(val);
4396 Py_XINCREF(trueSelf);
4401 self->modulusEqual(a);
4402 Py_XINCREF(trueSelf);
4407 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4408 self->modulusEqual(aaaa);
4409 Py_XINCREF(trueSelf);
4413 throw INTERP_KERNEL::Exception(msg);
4417 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4419 const char msg[]="Unexpected situation in __pow__ !";
4422 std::vector<int> aa;
4423 DataArrayIntTuple *aaa;
4425 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4430 MCAuto<DataArrayInt> ret=self->deepCopy();
4436 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4437 return DataArrayInt::Pow(self,aaaa);
4441 return DataArrayInt::Pow(self,a);
4445 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4446 return DataArrayInt::Pow(self,aaaa);
4449 throw INTERP_KERNEL::Exception(msg);
4453 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4455 const char msg[]="Unexpected situation in __rpow__ !";
4458 std::vector<int> aa;
4459 DataArrayIntTuple *aaa;
4461 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4466 MCAuto<DataArrayInt> ret=self->deepCopy();
4467 ret->applyRPow(val);
4472 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4473 return DataArrayInt::Pow(aaaa,self);
4477 return DataArrayInt::Pow(a,self);
4481 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4482 return DataArrayInt::Pow(aaaa,self);
4485 throw INTERP_KERNEL::Exception(msg);
4489 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4491 const char msg[]="Unexpected situation in __ipow__ !";
4494 std::vector<int> aa;
4495 DataArrayIntTuple *aaa;
4497 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4502 self->applyPow(val);
4503 Py_XINCREF(trueSelf);
4509 Py_XINCREF(trueSelf);
4514 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4515 self->powEqual(aaaa);
4516 Py_XINCREF(trueSelf);
4520 throw INTERP_KERNEL::Exception(msg);
4524 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4526 std::ostringstream oss;
4527 self->reprQuickOverview(oss);
4531 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4533 int szArr,sw,iTypppArr;
4534 std::vector<int> stdvecTyyppArr;
4535 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4536 self->pushBackValsSilent(tmp,tmp+szArr);
4539 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4541 std::vector<int> ret1;
4542 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4543 std::size_t sz=ret0.size();
4544 PyObject *pyRet=PyTuple_New(2);
4545 PyObject *pyRet0=PyList_New((int)sz);
4546 PyObject *pyRet1=PyList_New((int)sz);
4547 for(std::size_t i=0;i<sz;i++)
4549 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4550 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4552 PyTuple_SetItem(pyRet,0,pyRet0);
4553 PyTuple_SetItem(pyRet,1,pyRet1);
4557 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4559 DataArrayInt *ret0=0,*ret1=0;
4560 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4561 PyObject *pyRet=PyTuple_New(2);
4562 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4563 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4567 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4570 bool ret(self->isRange(a,b,c));
4571 PyObject *pyRet=PyTuple_New(2);
4572 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4574 PyTuple_SetItem(pyRet,0,ret0Py);
4576 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4582 PyTuple_SetItem(pyRet,1,ret1Py);
4587 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4589 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4592 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4595 if(!self->isAllocated())
4596 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4597 PyObject *ret(PyTuple_New(1));
4598 PyObject *ret0(PyDict_New());
4599 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4600 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4601 PyObject *tmp1(PyInt_FromLong(0));
4602 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4603 PyTuple_SetItem(ret,0,ret0);
4607 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4613 class DataArrayIntTuple;
4615 class DataArrayIntIterator
4618 DataArrayIntIterator(DataArrayInt *da);
4619 ~DataArrayIntIterator();
4624 DataArrayIntTuple *ret=self->nextt();
4626 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4629 PyErr_SetString(PyExc_StopIteration,"No more data.");
4636 class DataArrayIntTuple
4639 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4640 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4643 std::string __str__() const throw(INTERP_KERNEL::Exception)
4645 return self->repr();
4648 int __int__() const throw(INTERP_KERNEL::Exception)
4650 return self->intValue();
4653 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4655 return self->buildDAInt(1,self->getNumberOfCompo());
4658 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4660 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4661 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4662 Py_XINCREF(trueSelf);
4666 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4668 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4669 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4670 Py_XINCREF(trueSelf);
4674 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4676 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4677 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4678 Py_XINCREF(trueSelf);
4682 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4684 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4685 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4686 Py_XINCREF(trueSelf);
4690 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4692 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4693 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4694 Py_XINCREF(trueSelf);
4698 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4700 return PyInt_FromLong(self->getNumberOfCompo());
4703 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4705 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4708 std::vector<int> multiVal;
4709 std::pair<int, std::pair<int,int> > slic;
4710 MEDCoupling::DataArrayInt *daIntTyypp=0;
4711 const int *pt=self->getConstPointer();
4712 int nbc=self->getNumberOfCompo();
4713 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4720 std::ostringstream oss;
4721 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4722 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4726 return PyInt_FromLong(pt[singleVal]);
4730 return PyInt_FromLong(pt[nbc+singleVal]);
4733 std::ostringstream oss;
4734 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4735 throw INTERP_KERNEL::Exception(oss.str().c_str());
4741 PyObject *t=PyTuple_New(multiVal.size());
4742 for(int j=0;j<(int)multiVal.size();j++)
4744 int cid=multiVal[j];
4747 std::ostringstream oss;
4748 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4749 throw INTERP_KERNEL::Exception(oss.str().c_str());
4751 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4757 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4758 PyObject *t=PyTuple_New(sz);
4759 for(int j=0;j<sz;j++)
4760 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4764 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4768 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4770 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4771 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4774 std::vector<int> multiValV;
4775 std::pair<int, std::pair<int,int> > slicV;
4776 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4777 int nbc=self->getNumberOfCompo();
4778 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4780 std::vector<int> multiVal;
4781 std::pair<int, std::pair<int,int> > slic;
4782 MEDCoupling::DataArrayInt *daIntTyypp=0;
4783 int *pt=self->getPointer();
4784 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4791 std::ostringstream oss;
4792 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4793 throw INTERP_KERNEL::Exception(oss.str().c_str());
4799 pt[singleVal]=singleValV;
4804 if(multiValV.size()!=1)
4806 std::ostringstream oss;
4807 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4808 throw INTERP_KERNEL::Exception(oss.str().c_str());
4810 pt[singleVal]=multiValV[0];
4815 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4819 throw INTERP_KERNEL::Exception(msg);
4828 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4832 std::ostringstream oss;
4833 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4834 throw INTERP_KERNEL::Exception(oss.str().c_str());
4842 if(multiVal.size()!=multiValV.size())
4844 std::ostringstream oss;
4845 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4846 throw INTERP_KERNEL::Exception(oss.str().c_str());
4848 for(int i=0;i<(int)multiVal.size();i++)
4850 int pos=multiVal[i];
4853 std::ostringstream oss;
4854 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4855 throw INTERP_KERNEL::Exception(oss.str().c_str());
4857 pt[multiVal[i]]=multiValV[i];
4863 const int *ptV=daIntTyyppV->getConstPointer();
4864 if(nbc>daIntTyyppV->getNumberOfCompo())
4866 std::ostringstream oss;
4867 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4868 throw INTERP_KERNEL::Exception(oss.str().c_str());
4870 std::copy(ptV,ptV+nbc,pt);
4874 throw INTERP_KERNEL::Exception(msg);
4879 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4884 for(int j=0;j<sz;j++)
4885 pt[slic.first+j*slic.second.second]=singleValV;
4890 if(sz!=(int)multiValV.size())
4892 std::ostringstream oss;
4893 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4894 throw INTERP_KERNEL::Exception(oss.str().c_str());
4896 for(int j=0;j<sz;j++)
4897 pt[slic.first+j*slic.second.second]=multiValV[j];
4902 const int *ptV=daIntTyyppV->getConstPointer();
4903 if(sz>daIntTyyppV->getNumberOfCompo())
4905 std::ostringstream oss;
4906 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4907 throw INTERP_KERNEL::Exception(oss.str().c_str());
4909 for(int j=0;j<sz;j++)
4910 pt[slic.first+j*slic.second.second]=ptV[j];
4914 throw INTERP_KERNEL::Exception(msg);
4918 throw INTERP_KERNEL::Exception(msg);
4924 class DataArrayChar : public DataArray
4927 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4928 int getHashCode() const throw(INTERP_KERNEL::Exception);
4929 bool empty() const throw(INTERP_KERNEL::Exception);
4930 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4931 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4932 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4933 char popBackSilent() throw(INTERP_KERNEL::Exception);
4934 void pack() const throw(INTERP_KERNEL::Exception);
4935 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4936 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4937 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4938 void reverse() throw(INTERP_KERNEL::Exception);
4939 void fillWithZero() throw(INTERP_KERNEL::Exception);
4940 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4941 std::string repr() const throw(INTERP_KERNEL::Exception);
4942 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4943 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4944 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4945 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4946 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4947 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4948 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4949 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4950 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4951 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4952 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4953 char front() const throw(INTERP_KERNEL::Exception);
4954 char back() const throw(INTERP_KERNEL::Exception);
4955 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4956 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4957 char *getPointer() throw(INTERP_KERNEL::Exception);
4958 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4959 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4960 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4961 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4962 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4963 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4964 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4965 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4966 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4967 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4968 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4971 int __len__() const throw(INTERP_KERNEL::Exception)
4973 if(self->isAllocated())
4975 return self->getNumberOfTuples();
4979 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4983 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4986 bool ret0=self->isEqualIfNotWhy(other,ret1);
4987 PyObject *ret=PyTuple_New(2);
4988 PyObject *ret0Py=ret0?Py_True:Py_False;
4990 PyTuple_SetItem(ret,0,ret0Py);
4991 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4995 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4998 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4999 if (!SWIG_IsOK(res1))
5002 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5003 if(size!=self->getNumberOfTuples())
5005 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5007 return self->renumber(tmp);
5011 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5013 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5014 da2->checkAllocated();
5015 int size=self->getNumberOfTuples();
5016 if(size!=self->getNumberOfTuples())
5018 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5020 return self->renumber(da2->getConstPointer());
5024 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5027 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5028 if (!SWIG_IsOK(res1))
5031 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5032 if(size!=self->getNumberOfTuples())
5034 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5036 return self->renumberR(tmp);
5040 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5042 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5043 da2->checkAllocated();
5044 int size=self->getNumberOfTuples();
5045 if(size!=self->getNumberOfTuples())
5047 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5049 return self->renumberR(da2->getConstPointer());
5053 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5056 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5057 if (!SWIG_IsOK(res1))
5060 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5061 if(size!=self->getNumberOfTuples())
5063 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5065 return self->renumberAndReduce(tmp,newNbOfTuple);
5069 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5071 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5072 da2->checkAllocated();
5073 int size=self->getNumberOfTuples();
5074 if(size!=self->getNumberOfTuples())
5076 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5078 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5082 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5084 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5085 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5086 return DataArrayChar::Aggregate(tmp);
5089 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5091 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5092 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5093 return DataArrayChar::Meld(tmp);
5098 class DataArrayByteIterator;
5100 class DataArrayByte : public DataArrayChar
5103 static DataArrayByte *New();
5104 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5105 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5106 char byteValue() const throw(INTERP_KERNEL::Exception);
5109 DataArrayByte() throw(INTERP_KERNEL::Exception)
5111 return DataArrayByte::New();
5114 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5116 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) !";
5117 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5121 if(PyInt_Check(nbOfTuples))
5123 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5125 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5128 if(PyInt_Check(nbOfComp))
5129 {//DataArrayByte.New([1,3,4,5],2,2)
5130 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5132 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5133 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5134 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5135 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5139 throw INTERP_KERNEL::Exception(msg);
5142 {//DataArrayByte.New([1,3,4],3)
5143 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5145 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5146 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5151 throw INTERP_KERNEL::Exception(msg);
5154 {// DataArrayByte.New([1,3,4])
5155 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5156 int tmpp1=-1,tmpp2=-1;
5157 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5158 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5162 else if(PyInt_Check(elt0))
5164 int nbOfTuples1=PyInt_AS_LONG(elt0);
5166 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5171 if(PyInt_Check(nbOfTuples))
5172 {//DataArrayByte.New(5,2)
5173 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5175 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5176 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5177 ret->alloc(nbOfTuples1,nbOfCompo);
5181 throw INTERP_KERNEL::Exception(msg);
5184 throw INTERP_KERNEL::Exception(msg);
5187 {//DataArrayByte.New(5)
5188 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5189 ret->alloc(nbOfTuples1,1);
5194 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5195 {//DataArrayDouble.New(numpyArray)
5196 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5200 throw INTERP_KERNEL::Exception(msg);
5203 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5205 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5208 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5210 std::ostringstream oss;
5211 self->reprQuickOverview(oss);
5215 int __int__() const throw(INTERP_KERNEL::Exception)
5217 return (int) self->byteValue();
5220 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5222 return self->iterator();
5225 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5227 return (int)self->getIJ(tupleId,compoId);
5230 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5232 return (int)self->getIJSafe(tupleId,compoId);
5235 std::string __str__() const throw(INTERP_KERNEL::Exception)
5237 return self->repr();
5240 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5242 const char *vals=self->getConstPointer();
5243 int nbOfComp=self->getNumberOfComponents();
5244 int nbOfTuples=self->getNumberOfTuples();
5245 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5248 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5251 int ival=-1; std::vector<int> ivval;
5252 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5253 std::vector<char> vals(sz);
5254 std::copy(pt,pt+sz,vals.begin());
5255 return self->presenceOfTuple(vals);
5258 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5261 int ival=-1; std::vector<int> ivval;
5262 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5263 std::vector<char> vals2(sz);
5264 std::copy(pt,pt+sz,vals2.begin());
5265 return self->presenceOfValue(vals2);
5268 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5271 int ival=-1; std::vector<int> ivval;
5272 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5273 std::vector<char> vals2(sz);
5274 std::copy(pt,pt+sz,vals2.begin());
5275 return self->findIdFirstEqual(vals2);
5278 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5281 int ival=-1; std::vector<int> ivval;
5282 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5283 std::vector<char> vals(sz);
5284 std::copy(pt,pt+sz,vals.begin());
5285 return self->findIdFirstEqualTuple(vals);
5288 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5291 int ival=-1; std::vector<int> ivval;
5292 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5293 std::vector<char> vals(sz);
5294 std::copy(pt,pt+sz,vals.begin());
5295 return self->findIdSequence(vals);
5298 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5300 int sz=self->getNumberOfComponents();
5301 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5302 self->getTuple(tupleId,tmp);
5303 PyObject *ret=PyTuple_New(sz);
5304 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5308 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5311 int r1=(int)self->getMaxValue(tmp);
5312 PyObject *ret=PyTuple_New(2);
5313 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5314 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5318 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5321 int r1=(int)self->getMinValue(tmp);
5322 PyObject *ret=PyTuple_New(2);
5323 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5324 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5328 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5330 int nbOfCompo=self->getNumberOfComponents();
5335 if(PyInt_Check(obj))
5337 int val=(int)PyInt_AS_LONG(obj);
5338 return self->findIdFirstEqual(val);
5341 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5344 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5348 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5350 int nbOfCompo=self->getNumberOfComponents();
5357 if(PyInt_Check(obj))
5359 int val=(int)PyInt_AS_LONG(obj);
5360 return self->presenceOfValue(val);
5363 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5366 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5371 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5373 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5378 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5380 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5383 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5386 if(!self->isAllocated())
5387 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5388 PyObject *ret(PyTuple_New(1));
5389 PyObject *ret0(PyDict_New());
5390 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5391 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5392 PyObject *tmp1(PyInt_FromLong(0));
5393 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5394 PyTuple_SetItem(ret,0,ret0);
5398 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5402 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5404 self->checkAllocated();
5405 const char msg[]="Unexpected situation in __setitem__ !";
5406 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5409 std::vector<int> v1;
5411 DataArrayIntTuple *dd1=0;
5412 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5414 std::vector<int> vt1,vc1;
5415 std::pair<int, std::pair<int,int> > pt1,pc1;
5416 DataArrayInt *dt1=0,*dc1=0;
5417 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5418 MCAuto<DataArrayInt> tmp;
5426 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5429 throw INTERP_KERNEL::Exception(msg);
5438 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5441 throw INTERP_KERNEL::Exception(msg);
5450 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5453 throw INTERP_KERNEL::Exception(msg);
5462 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5465 throw INTERP_KERNEL::Exception(msg);
5474 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5477 throw INTERP_KERNEL::Exception(msg);
5486 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5489 throw INTERP_KERNEL::Exception(msg);
5498 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5501 throw INTERP_KERNEL::Exception(msg);
5510 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5513 throw INTERP_KERNEL::Exception(msg);
5522 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5525 throw INTERP_KERNEL::Exception(msg);
5534 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5537 throw INTERP_KERNEL::Exception(msg);
5546 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5549 throw INTERP_KERNEL::Exception(msg);
5558 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5561 throw INTERP_KERNEL::Exception(msg);
5570 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5573 throw INTERP_KERNEL::Exception(msg);
5582 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5585 throw INTERP_KERNEL::Exception(msg);
5594 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5597 throw INTERP_KERNEL::Exception(msg);
5606 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5609 throw INTERP_KERNEL::Exception(msg);
5614 throw INTERP_KERNEL::Exception(msg);
5621 class DataArrayByteTuple;
5623 class DataArrayByteIterator
5626 DataArrayByteIterator(DataArrayByte *da);
5627 ~DataArrayByteIterator();
5630 class DataArrayByteTuple
5633 std::string repr() const throw(INTERP_KERNEL::Exception);
5634 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5637 std::string __str__() const throw(INTERP_KERNEL::Exception)
5639 return self->repr();
5642 char __int__() const throw(INTERP_KERNEL::Exception)
5644 return self->byteValue();
5647 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5649 return self->buildDAByte(1,self->getNumberOfCompo());
5654 class DataArrayAsciiCharIterator;
5656 class DataArrayAsciiChar : public DataArrayChar
5659 static DataArrayAsciiChar *New();
5660 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5661 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5662 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5665 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5667 return DataArrayAsciiChar::New();
5670 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5672 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) !";
5673 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5677 if(PyInt_Check(nbOfTuples))
5679 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5681 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5684 if(PyInt_Check(nbOfComp))
5685 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5686 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5688 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5689 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5690 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5691 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5695 throw INTERP_KERNEL::Exception(msg);
5698 {//DataArrayAsciiChar.New([1,3,4],3)
5699 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5701 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5702 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5706 else if(PyString_Check(nbOfTuples))
5708 if(PyString_Size(nbOfTuples)!=1)
5709 throw INTERP_KERNEL::Exception(msg);
5710 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5711 std::vector<std::string> tmp;
5712 if(fillStringVector(elt0,tmp))
5713 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5715 throw INTERP_KERNEL::Exception(msg);
5718 throw INTERP_KERNEL::Exception(msg);
5722 std::vector<std::string> tmmp;
5723 if(fillStringVector(elt0,tmmp))
5724 //DataArrayAsciiChar.New(["abc","de","fghi"])
5725 return DataArrayAsciiChar::New(tmmp,' ');
5728 // DataArrayAsciiChar.New([1,3,4])
5729 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5730 int tmpp1=-1,tmpp2=-1;
5731 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5732 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5737 else if(PyInt_Check(elt0))
5739 int nbOfTuples1=PyInt_AS_LONG(elt0);
5741 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5746 if(PyInt_Check(nbOfTuples))
5747 {//DataArrayAsciiChar.New(5,2)
5748 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5750 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5751 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5752 ret->alloc(nbOfTuples1,nbOfCompo);
5756 throw INTERP_KERNEL::Exception(msg);
5759 throw INTERP_KERNEL::Exception(msg);
5762 {//DataArrayAsciiChar.New(5)
5763 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5764 ret->alloc(nbOfTuples1,1);
5769 throw INTERP_KERNEL::Exception(msg);
5772 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5774 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5777 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5779 std::ostringstream oss;
5780 self->reprQuickOverview(oss);
5784 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5786 return self->iterator();
5789 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5791 char tmp[2]; tmp[1]='\0';
5792 tmp[0]=self->getIJ(tupleId,compoId);
5793 return std::string(tmp);
5796 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5798 char tmp[2]; tmp[1]='\0';
5799 tmp[0]=self->getIJSafe(tupleId,compoId);
5800 return std::string(tmp);
5803 std::string __str__() const throw(INTERP_KERNEL::Exception)
5805 return self->repr();
5808 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5810 const char *vals=self->getConstPointer();
5811 int nbOfComp=self->getNumberOfComponents();
5812 int nbOfTuples=self->getNumberOfTuples();
5813 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5816 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5818 if(PyString_Check(tupl))
5820 Py_ssize_t sz=PyString_Size(tupl);
5821 std::vector<char> vals(sz);
5822 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5823 return self->presenceOfTuple(vals);
5826 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5829 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5831 if(PyString_Check(vals))
5833 Py_ssize_t sz=PyString_Size(vals);
5834 std::vector<char> vals2(sz);
5835 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5836 return self->presenceOfValue(vals2);
5839 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5842 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5844 if(PyString_Check(vals))
5846 Py_ssize_t sz=PyString_Size(vals);
5847 std::vector<char> vals2(sz);
5848 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5849 return self->findIdFirstEqual(vals2);
5852 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5855 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5857 if(PyString_Check(tupl))
5859 Py_ssize_t sz=PyString_Size(tupl);
5860 std::vector<char> vals(sz);
5861 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5862 return self->findIdFirstEqualTuple(vals);
5865 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5868 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5870 if(PyString_Check(strOrListOfInt))
5872 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5873 std::vector<char> vals(sz);
5874 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5875 return self->findIdSequence(vals);
5878 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5881 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5883 int sz=self->getNumberOfComponents();
5884 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5885 self->getTuple(tupleId,tmp);
5886 return PyString_FromString(tmp);
5889 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5892 char tmp2[2]; tmp2[1]='\0';
5893 tmp2[0]=self->getMaxValue(tmp);
5894 PyObject *ret=PyTuple_New(2);
5895 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5896 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5900 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5903 char tmp2[2]; tmp2[1]='\0';
5904 tmp2[0]=self->getMinValue(tmp);
5905 PyObject *ret=PyTuple_New(2);
5906 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5907 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5911 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5913 int nbOfCompo=self->getNumberOfComponents();
5918 if(PyString_Check(obj))
5920 Py_ssize_t sz=PyString_Size(obj);
5921 char *pt=PyString_AsString(obj);
5923 return self->findIdFirstEqual(pt[0]);
5925 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5928 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5931 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5935 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5937 int nbOfCompo=self->getNumberOfComponents();
5944 if(PyString_Check(obj))
5946 Py_ssize_t sz=PyString_Size(obj);
5947 char *pt=PyString_AsString(obj);
5949 return self->presenceOfValue(pt[0]);
5951 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5954 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5957 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5961 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5964 std::vector<int> stdvecTyyppArr;
5965 std::pair<int, std::pair<int,int> > sTyyppArr;
5966 MEDCoupling::DataArrayInt *daIntTyypp=0;
5967 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5971 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5973 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5975 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5977 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5979 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5983 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5985 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.";
5987 std::vector<int> stdvecTyyppArr;
5988 std::pair<int, std::pair<int,int> > sTyyppArr;
5989 MEDCoupling::DataArrayInt *daIntTyypp=0;
5990 int nbOfCompo=self->getNumberOfComponents();
5991 int nbOfTuples=self->getNumberOfTuples();
5992 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5994 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5995 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6004 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6010 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6011 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6014 //value vector<string>
6017 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6018 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6021 //value DataArrayChar
6024 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6028 throw INTERP_KERNEL::Exception(msg);
6032 {//obj list-tuple[int]
6038 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6044 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6045 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6048 //value vector<string>
6051 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6052 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6055 //value DataArrayChar
6058 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6062 throw INTERP_KERNEL::Exception(msg);
6073 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6079 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6080 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6083 //value vector<string>
6086 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6087 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6090 //value DataArrayChar
6093 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6097 throw INTERP_KERNEL::Exception(msg);
6108 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6114 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6115 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6118 //value vector<string>
6121 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6122 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6125 //value DataArrayChar
6128 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6132 throw INTERP_KERNEL::Exception(msg);
6137 throw INTERP_KERNEL::Exception(msg);
6143 class DataArrayAsciiCharTuple;
6145 class DataArrayAsciiCharIterator
6148 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6149 ~DataArrayAsciiCharIterator();
6154 DataArrayAsciiCharTuple *ret=self->nextt();
6156 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6159 PyErr_SetString(PyExc_StopIteration,"No more data.");
6166 class DataArrayAsciiCharTuple
6169 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6170 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6173 std::string __str__() const throw(INTERP_KERNEL::Exception)
6175 return self->repr();
6178 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6180 return self->buildDAAsciiChar(1,self->getNumberOfCompo());