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 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2260 if(!PyTuple_Check(args))
2261 throw INTERP_KERNEL::Exception(MSG);
2262 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2263 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2264 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2266 PyObject *tmp0(PyTuple_New(1));
2267 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2268 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2270 Py_DECREF(selfMeth);
2271 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2272 int sz(PyTuple_Size(args));
2274 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2275 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2276 PyObject *zeNumpyRepr(0);
2277 PyObject *tmp1(PyInt_FromLong(0));
2278 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2280 PyObject *tmp3(PyTuple_New(1));
2281 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2282 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2286 Py_DECREF(initMeth);
2290 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2293 if(!self->isAllocated())
2294 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2295 PyObject *ret(PyTuple_New(1));
2296 PyObject *ret0(PyDict_New());
2297 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2298 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2299 PyObject *tmp1(PyInt_FromLong(0));
2300 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2301 PyTuple_SetItem(ret,0,ret0);
2305 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2311 class DataArrayDoubleTuple;
2313 class DataArrayDoubleIterator
2316 DataArrayDoubleIterator(DataArrayDouble *da);
2317 ~DataArrayDoubleIterator();
2322 DataArrayDoubleTuple *ret=self->nextt();
2324 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2327 PyErr_SetString(PyExc_StopIteration,"No more data.");
2334 class DataArrayDoubleTuple
2337 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2338 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2341 std::string __str__() const throw(INTERP_KERNEL::Exception)
2343 return self->repr();
2346 double __float__() const throw(INTERP_KERNEL::Exception)
2348 return self->doubleValue();
2351 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2353 return self->buildDADouble(1,self->getNumberOfCompo());
2356 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2358 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2359 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2360 Py_XINCREF(trueSelf);
2364 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2366 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2367 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2368 Py_XINCREF(trueSelf);
2372 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2374 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2375 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2376 Py_XINCREF(trueSelf);
2380 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2382 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2383 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2384 Py_XINCREF(trueSelf);
2388 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2390 return PyInt_FromLong(self->getNumberOfCompo());
2393 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2395 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2398 std::vector<int> multiVal;
2399 std::pair<int, std::pair<int,int> > slic;
2400 MEDCoupling::DataArrayInt *daIntTyypp=0;
2401 const double *pt=self->getConstPointer();
2402 int nbc=self->getNumberOfCompo();
2403 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2410 std::ostringstream oss;
2411 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2412 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2416 return PyFloat_FromDouble(pt[singleVal]);
2420 return PyFloat_FromDouble(pt[nbc+singleVal]);
2423 std::ostringstream oss;
2424 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2425 throw INTERP_KERNEL::Exception(oss.str().c_str());
2431 PyObject *t=PyTuple_New(multiVal.size());
2432 for(int j=0;j<(int)multiVal.size();j++)
2434 int cid=multiVal[j];
2437 std::ostringstream oss;
2438 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2439 throw INTERP_KERNEL::Exception(oss.str().c_str());
2441 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2447 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2448 PyObject *t=PyTuple_New(sz);
2449 for(int j=0;j<sz;j++)
2450 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2454 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2458 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2460 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2461 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2464 std::vector<double> multiValV;
2465 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2466 int nbc=self->getNumberOfCompo();
2467 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2469 std::vector<int> multiVal;
2470 std::pair<int, std::pair<int,int> > slic;
2471 MEDCoupling::DataArrayInt *daIntTyypp=0;
2472 double *pt=self->getPointer();
2473 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2480 std::ostringstream oss;
2481 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2482 throw INTERP_KERNEL::Exception(oss.str().c_str());
2488 pt[singleVal]=singleValV;
2493 if(multiValV.size()!=1)
2495 std::ostringstream oss;
2496 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2497 throw INTERP_KERNEL::Exception(oss.str().c_str());
2499 pt[singleVal]=multiValV[0];
2504 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2508 throw INTERP_KERNEL::Exception(msg);
2517 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2521 std::ostringstream oss;
2522 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2523 throw INTERP_KERNEL::Exception(oss.str().c_str());
2531 if(multiVal.size()!=multiValV.size())
2533 std::ostringstream oss;
2534 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2535 throw INTERP_KERNEL::Exception(oss.str().c_str());
2537 for(int i=0;i<(int)multiVal.size();i++)
2539 int pos=multiVal[i];
2542 std::ostringstream oss;
2543 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2544 throw INTERP_KERNEL::Exception(oss.str().c_str());
2546 pt[multiVal[i]]=multiValV[i];
2552 const double *ptV=daIntTyyppV->getConstPointer();
2553 if(nbc>daIntTyyppV->getNumberOfCompo())
2555 std::ostringstream oss;
2556 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2557 throw INTERP_KERNEL::Exception(oss.str().c_str());
2559 std::copy(ptV,ptV+nbc,pt);
2563 throw INTERP_KERNEL::Exception(msg);
2568 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2573 for(int j=0;j<sz;j++)
2574 pt[slic.first+j*slic.second.second]=singleValV;
2579 if(sz!=(int)multiValV.size())
2581 std::ostringstream oss;
2582 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2583 throw INTERP_KERNEL::Exception(oss.str().c_str());
2585 for(int j=0;j<sz;j++)
2586 pt[slic.first+j*slic.second.second]=multiValV[j];
2591 const double *ptV=daIntTyyppV->getConstPointer();
2592 if(sz>daIntTyyppV->getNumberOfCompo())
2594 std::ostringstream oss;
2595 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2596 throw INTERP_KERNEL::Exception(oss.str().c_str());
2598 for(int j=0;j<sz;j++)
2599 pt[slic.first+j*slic.second.second]=ptV[j];
2603 throw INTERP_KERNEL::Exception(msg);
2607 throw INTERP_KERNEL::Exception(msg);
2613 class DataArrayIntIterator;
2615 class DataArrayInt : public DataArray
2618 static DataArrayInt *New();
2619 int intValue() const throw(INTERP_KERNEL::Exception);
2620 int getHashCode() const throw(INTERP_KERNEL::Exception);
2621 bool empty() const throw(INTERP_KERNEL::Exception);
2622 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2623 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2624 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2625 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2626 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2627 int popBackSilent() throw(INTERP_KERNEL::Exception);
2628 void pack() const throw(INTERP_KERNEL::Exception);
2629 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2630 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2631 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2632 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2633 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2634 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2635 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2636 void reverse() throw(INTERP_KERNEL::Exception);
2637 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2638 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2639 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2640 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2641 void fillWithZero() throw(INTERP_KERNEL::Exception);
2642 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2643 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2644 std::string repr() const throw(INTERP_KERNEL::Exception);
2645 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2646 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2647 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2648 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2649 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2650 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2651 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2652 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2653 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2654 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2655 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2656 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2657 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2658 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2659 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2660 void transpose() throw(INTERP_KERNEL::Exception);
2661 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2662 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2663 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2664 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2665 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2666 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2667 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2668 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2669 int front() const throw(INTERP_KERNEL::Exception);
2670 int back() const throw(INTERP_KERNEL::Exception);
2671 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2672 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2673 int *getPointer() throw(INTERP_KERNEL::Exception);
2674 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2675 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2676 const int *begin() const throw(INTERP_KERNEL::Exception);
2677 const int *end() const throw(INTERP_KERNEL::Exception);
2678 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2679 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2680 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2681 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2682 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2683 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2684 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2685 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2686 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2687 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2688 int count(int value) const throw(INTERP_KERNEL::Exception);
2689 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2690 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2691 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2692 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2693 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2694 void abs() throw(INTERP_KERNEL::Exception);
2695 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2696 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2697 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2698 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2699 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2700 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2701 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2702 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2703 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2704 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2705 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2706 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2707 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2708 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2709 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2710 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2711 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2712 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2713 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2714 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2715 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2716 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2717 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2718 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2719 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2720 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2721 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2722 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2723 void computeOffsets() throw(INTERP_KERNEL::Exception);
2724 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2725 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2726 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2727 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2728 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2729 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2730 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2731 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2732 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2733 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2734 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2735 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2736 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2737 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2738 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2739 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2740 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2741 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2742 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2744 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2747 DataArrayInt() throw(INTERP_KERNEL::Exception)
2749 return DataArrayInt::New();
2752 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2754 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)";
2755 std::string msg(msgBase);
2757 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2760 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2764 if(PyInt_Check(nbOfTuples))
2766 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2768 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2771 if(PyInt_Check(nbOfComp))
2772 {//DataArrayInt.New([1,3,4,5],2,2)
2773 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2775 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2776 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2777 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2778 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2782 throw INTERP_KERNEL::Exception(msg.c_str());
2785 {//DataArrayInt.New([1,3,4],3)
2786 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2788 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2789 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2794 throw INTERP_KERNEL::Exception(msg.c_str());
2797 {// DataArrayInt.New([1,3,4])
2798 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2799 int tmpp1=-1,tmpp2=-1;
2800 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2801 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2805 else if(PyInt_Check(elt0))
2807 int nbOfTuples1=PyInt_AS_LONG(elt0);
2809 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2814 if(PyInt_Check(nbOfTuples))
2815 {//DataArrayInt.New(5,2)
2816 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2818 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2819 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2820 ret->alloc(nbOfTuples1,nbOfCompo);
2824 throw INTERP_KERNEL::Exception(msg.c_str());
2827 throw INTERP_KERNEL::Exception(msg.c_str());
2830 {//DataArrayInt.New(5)
2831 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2832 ret->alloc(nbOfTuples1,1);
2837 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2838 {//DataArrayInt.New(numpyArray)
2839 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2843 throw INTERP_KERNEL::Exception(msg.c_str());
2844 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2847 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2849 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2852 std::string __str__() const throw(INTERP_KERNEL::Exception)
2854 return self->reprNotTooLong();
2857 int __len__() const throw(INTERP_KERNEL::Exception)
2859 if(self->isAllocated())
2861 return self->getNumberOfTuples();
2865 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2869 int __int__() const throw(INTERP_KERNEL::Exception)
2871 return self->intValue();
2874 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2876 return self->iterator();
2879 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2881 int sz=self->getNumberOfComponents();
2882 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2883 self->accumulate(tmp);
2884 return convertIntArrToPyList(tmp,sz);
2887 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2890 std::vector<int> val2;
2891 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2892 return self->accumulatePerChunck(bg,bg+sz);
2895 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2898 std::vector<int> val2;
2899 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2900 return self->findIdsEqualTuple(bg,bg+sz);
2903 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2905 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2906 PyObject *ret=PyList_New(slcs.size());
2907 for(std::size_t i=0;i<slcs.size();i++)
2908 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2912 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2914 if(!PySlice_Check(slic))
2915 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2916 Py_ssize_t strt=2,stp=2,step=2;
2917 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2918 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2919 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2920 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 !");
2921 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2924 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2927 self->getMinMaxValues(a,b);
2928 PyObject *ret=PyTuple_New(2);
2929 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2930 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2934 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2936 int newNbOfTuples=-1;
2937 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2938 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2939 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2940 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2941 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2942 PyObject *ret=PyTuple_New(2);
2943 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2944 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2948 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2950 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2951 int szArr,sw,iTypppArr;
2952 std::vector<int> stdvecTyyppArr;
2953 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2954 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2955 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2959 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2961 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 !";
2962 if(PyList_Check(li) || PyTuple_Check(li))
2966 if(PyInt_Check(nbOfTuples))
2968 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2970 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2973 if(PyInt_Check(nbOfComp))
2974 {//DataArrayInt.setValues([1,3,4,5],2,2)
2975 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2977 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2978 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2979 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2982 throw INTERP_KERNEL::Exception(msg);
2985 {//DataArrayInt.setValues([1,3,4],3)
2987 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2988 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2992 throw INTERP_KERNEL::Exception(msg);
2995 {// DataArrayInt.setValues([1,3,4])
2996 int tmpp1=-1,tmpp2=-1;
2997 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2998 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3002 throw INTERP_KERNEL::Exception(msg);
3005 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3007 const int *vals=self->getConstPointer();
3008 return convertIntArrToPyList(vals,self->getNbOfElems());
3012 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3014 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3018 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3021 bool ret0=self->isEqualIfNotWhy(other,ret1);
3022 PyObject *ret=PyTuple_New(2);
3023 PyObject *ret0Py=ret0?Py_True:Py_False;
3025 PyTuple_SetItem(ret,0,ret0Py);
3026 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3030 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3032 const int *vals=self->getConstPointer();
3033 int nbOfComp=self->getNumberOfComponents();
3034 int nbOfTuples=self->getNumberOfTuples();
3035 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3038 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3040 std::vector<const DataArrayInt *> groups;
3041 std::vector< std::vector<int> > fidsOfGroups;
3042 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3043 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3044 PyObject *ret = PyList_New(2);
3045 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3046 int sz=fidsOfGroups.size();
3047 PyObject *ret1 = PyList_New(sz);
3048 for(int i=0;i<sz;i++)
3049 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3050 PyList_SetItem(ret,1,ret1);
3054 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3057 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3058 if (!SWIG_IsOK(res1))
3061 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3062 self->transformWithIndArr(tmp,tmp+size);
3066 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3067 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3071 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3075 std::vector<int> multiVal;
3076 std::pair<int, std::pair<int,int> > slic;
3077 MEDCoupling::DataArrayInt *daIntTyypp=0;
3078 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3082 return self->findIdsEqualList(&singleVal,&singleVal+1);
3084 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3086 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3088 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3092 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3096 std::vector<int> multiVal;
3097 std::pair<int, std::pair<int,int> > slic;
3098 MEDCoupling::DataArrayInt *daIntTyypp=0;
3099 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3103 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3105 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3107 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3109 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3113 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3115 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3117 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3118 if (!SWIG_IsOK(res1))
3121 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3122 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3126 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3128 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3129 da2->checkAllocated();
3130 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3132 PyObject *ret = PyList_New(3);
3133 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3134 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3135 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3139 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3142 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3143 if (!SWIG_IsOK(res1))
3146 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3147 return self->transformWithIndArrR(tmp,tmp+size);
3151 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3152 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3156 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3159 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3160 if (!SWIG_IsOK(res1))
3163 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3164 if(size!=self->getNumberOfTuples())
3166 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3168 return self->renumberAndReduce(tmp,newNbOfTuple);
3172 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3174 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3175 da2->checkAllocated();
3176 int size=self->getNumberOfTuples();
3177 if(size!=self->getNumberOfTuples())
3179 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3181 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3185 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3188 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3189 if (!SWIG_IsOK(res1))
3192 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3193 if(size!=self->getNumberOfTuples())
3195 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3197 return self->renumber(tmp);
3201 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3203 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3204 da2->checkAllocated();
3205 int size=self->getNumberOfTuples();
3206 if(size!=self->getNumberOfTuples())
3208 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3210 return self->renumber(da2->getConstPointer());
3214 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3217 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3218 if (!SWIG_IsOK(res1))
3221 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3222 if(size!=self->getNumberOfTuples())
3224 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3226 return self->renumberR(tmp);
3230 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3232 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3233 da2->checkAllocated();
3234 int size=self->getNumberOfTuples();
3235 if(size!=self->getNumberOfTuples())
3237 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3239 return self->renumberR(da2->getConstPointer());
3243 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3245 std::vector<int> tmp;
3246 convertPyToNewIntArr3(li,tmp);
3247 self->setSelectedComponents(a,tmp);
3250 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3252 int sz=self->getNumberOfComponents();
3253 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3254 self->getTuple(tupleId,tmp);
3255 return convertIntArrToPyList(tmp,sz);
3258 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3260 DataArrayInt *arr=0;
3261 DataArrayInt *arrI=0;
3262 self->changeSurjectiveFormat(targetNb,arr,arrI);
3263 PyObject *res = PyList_New(2);
3264 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3265 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3269 static DataArrayInt *Meld(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::Meld(tmp);
3276 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3278 std::vector<const DataArrayInt *> tmp;
3279 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3280 return DataArrayInt::Aggregate(tmp);
3283 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3285 std::vector<const DataArrayInt *> tmp;
3286 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3287 return DataArrayInt::AggregateIndexes(tmp);
3290 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3292 std::vector<const DataArrayInt *> tmp;
3293 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3294 return DataArrayInt::BuildUnion(tmp);
3297 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3299 std::vector<const DataArrayInt *> tmp;
3300 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3301 return DataArrayInt::BuildIntersection(tmp);
3304 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3307 int r1=self->getMaxValue(tmp);
3308 PyObject *ret=PyTuple_New(2);
3309 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3310 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3314 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3317 int r1=self->getMinValue(tmp);
3318 PyObject *ret=PyTuple_New(2);
3319 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3320 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3324 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3326 int nbOfCompo=self->getNumberOfComponents();
3331 if(PyInt_Check(obj))
3333 int val=(int)PyInt_AS_LONG(obj);
3334 return self->findIdFirstEqual(val);
3337 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3341 std::vector<int> arr;
3342 convertPyToNewIntArr3(obj,arr);
3343 return self->findIdFirstEqualTuple(arr);
3348 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3350 int nbOfCompo=self->getNumberOfComponents();
3357 if(PyInt_Check(obj))
3359 int val=(int)PyInt_AS_LONG(obj);
3360 return self->presenceOfValue(val);
3363 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3367 std::vector<int> arr;
3368 convertPyToNewIntArr3(obj,arr);
3369 return self->presenceOfTuple(arr);
3374 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3376 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3377 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3378 self->checkAllocated();
3379 int nbOfTuples=self->getNumberOfTuples();
3380 int nbOfComponents=self->getNumberOfComponents();
3382 std::vector<int> vt1,vc1;
3383 std::pair<int, std::pair<int,int> > pt1,pc1;
3384 DataArrayInt *dt1=0,*dc1=0;
3386 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3387 MCAuto<DataArrayInt> ret;
3392 if(nbOfComponents==1)
3393 return PyInt_FromLong(self->getIJSafe(it1,0));
3394 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3397 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3399 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3401 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3403 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3406 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3407 std::vector<int> v2(1,ic1);
3408 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3412 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3413 std::vector<int> v2(1,ic1);
3414 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3418 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3419 std::vector<int> v2(1,ic1);
3420 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3424 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3425 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3429 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3430 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3434 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3435 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3439 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3440 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3444 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3445 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3446 std::vector<int> v2(nbOfComp);
3447 for(int i=0;i<nbOfComp;i++)
3448 v2[i]=pc1.first+i*pc1.second.second;
3449 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3453 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3454 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3455 std::vector<int> v2(nbOfComp);
3456 for(int i=0;i<nbOfComp;i++)
3457 v2[i]=pc1.first+i*pc1.second.second;
3458 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3462 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3463 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3464 std::vector<int> v2(nbOfComp);
3465 for(int i=0;i<nbOfComp;i++)
3466 v2[i]=pc1.first+i*pc1.second.second;
3467 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3471 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3472 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3473 std::vector<int> v2(nbOfComp);
3474 for(int i=0;i<nbOfComp;i++)
3475 v2[i]=pc1.first+i*pc1.second.second;
3476 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3479 throw INTERP_KERNEL::Exception(msg);
3483 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3485 self->checkAllocated();
3486 const char msg[]="Unexpected situation in __setitem__ !";
3487 int nbOfTuples=self->getNumberOfTuples();
3488 int nbOfComponents=self->getNumberOfComponents();
3491 std::vector<int> v1;
3493 DataArrayIntTuple *dd1=0;
3494 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3496 std::vector<int> vt1,vc1;
3497 std::pair<int, std::pair<int,int> > pt1,pc1;
3498 DataArrayInt *dt1=0,*dc1=0;
3499 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3500 MCAuto<DataArrayInt> tmp;
3508 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3511 tmp=DataArrayInt::New();
3512 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3513 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3516 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3519 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3520 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3523 throw INTERP_KERNEL::Exception(msg);
3532 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3535 tmp=DataArrayInt::New();
3536 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3537 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3540 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3543 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3544 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3547 throw INTERP_KERNEL::Exception(msg);
3556 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3559 tmp=DataArrayInt::New();
3560 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3561 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3564 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3567 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3568 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3571 throw INTERP_KERNEL::Exception(msg);
3580 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3583 tmp=DataArrayInt::New();
3584 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3585 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3588 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3591 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3592 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3595 throw INTERP_KERNEL::Exception(msg);
3604 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3607 tmp=DataArrayInt::New();
3608 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3609 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3612 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3615 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3616 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3619 throw INTERP_KERNEL::Exception(msg);
3628 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3631 tmp=DataArrayInt::New();
3632 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3633 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3636 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3639 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3640 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3643 throw INTERP_KERNEL::Exception(msg);
3652 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3655 tmp=DataArrayInt::New();
3656 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3657 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3660 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3663 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3664 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3667 throw INTERP_KERNEL::Exception(msg);
3676 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3679 tmp=DataArrayInt::New();
3680 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3681 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3684 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3687 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3688 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3691 throw INTERP_KERNEL::Exception(msg);
3700 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3703 tmp=DataArrayInt::New();
3704 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3705 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3708 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3711 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3712 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3715 throw INTERP_KERNEL::Exception(msg);
3724 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3727 tmp=DataArrayInt::New();
3728 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3729 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3732 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3735 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3736 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3739 throw INTERP_KERNEL::Exception(msg);
3748 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3751 tmp=DataArrayInt::New();
3752 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3753 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3756 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3759 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3760 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3763 throw INTERP_KERNEL::Exception(msg);
3772 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3775 tmp=DataArrayInt::New();
3776 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3777 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3780 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3783 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3784 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3787 throw INTERP_KERNEL::Exception(msg);
3796 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3799 tmp=DataArrayInt::New();
3800 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3801 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3804 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3807 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3808 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3811 throw INTERP_KERNEL::Exception(msg);
3820 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3823 tmp=DataArrayInt::New();
3824 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3825 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3828 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3831 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3832 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3835 throw INTERP_KERNEL::Exception(msg);
3844 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3847 tmp=DataArrayInt::New();
3848 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3849 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3852 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3855 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3856 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3859 throw INTERP_KERNEL::Exception(msg);
3868 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3871 tmp=DataArrayInt::New();
3872 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3873 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3876 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3879 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3880 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3883 throw INTERP_KERNEL::Exception(msg);
3888 throw INTERP_KERNEL::Exception(msg);
3893 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3895 return self->negate();
3898 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3900 const char msg[]="Unexpected situation in __add__ !";
3903 std::vector<int> aa;
3904 DataArrayIntTuple *aaa;
3906 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3911 MCAuto<DataArrayInt> ret=self->deepCopy();
3912 ret->applyLin(1,val);
3917 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3918 return DataArrayInt::Add(self,aaaa);
3922 return DataArrayInt::Add(self,a);
3926 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3927 return DataArrayInt::Add(self,aaaa);
3930 throw INTERP_KERNEL::Exception(msg);
3934 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3936 const char msg[]="Unexpected situation in __radd__ !";
3939 std::vector<int> aa;
3940 DataArrayIntTuple *aaa;
3942 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3947 MCAuto<DataArrayInt> ret=self->deepCopy();
3948 ret->applyLin(1,val);
3953 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3954 return DataArrayInt::Add(self,aaaa);
3958 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3959 return DataArrayInt::Add(self,aaaa);
3962 throw INTERP_KERNEL::Exception(msg);
3966 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3968 const char msg[]="Unexpected situation in __iadd__ !";
3971 std::vector<int> aa;
3972 DataArrayIntTuple *aaa;
3974 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3979 self->applyLin(1,val);
3980 Py_XINCREF(trueSelf);
3985 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3987 Py_XINCREF(trueSelf);
3993 Py_XINCREF(trueSelf);
3998 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3999 self->addEqual(aaaa);
4000 Py_XINCREF(trueSelf);
4004 throw INTERP_KERNEL::Exception(msg);
4008 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4010 const char msg[]="Unexpected situation in __sub__ !";
4013 std::vector<int> aa;
4014 DataArrayIntTuple *aaa;
4016 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4021 MCAuto<DataArrayInt> ret=self->deepCopy();
4022 ret->applyLin(1,-val);
4027 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4028 return DataArrayInt::Substract(self,aaaa);
4032 return DataArrayInt::Substract(self,a);
4036 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4037 return DataArrayInt::Substract(self,aaaa);
4040 throw INTERP_KERNEL::Exception(msg);
4044 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4046 const char msg[]="Unexpected situation in __rsub__ !";
4049 std::vector<int> aa;
4050 DataArrayIntTuple *aaa;
4052 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4057 MCAuto<DataArrayInt> ret=self->deepCopy();
4058 ret->applyLin(-1,val);
4063 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4064 return DataArrayInt::Substract(aaaa,self);
4068 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4069 return DataArrayInt::Substract(aaaa,self);
4072 throw INTERP_KERNEL::Exception(msg);
4076 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4078 const char msg[]="Unexpected situation in __isub__ !";
4081 std::vector<int> aa;
4082 DataArrayIntTuple *aaa;
4084 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4089 self->applyLin(1,-val);
4090 Py_XINCREF(trueSelf);
4095 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4096 self->substractEqual(bb);
4097 Py_XINCREF(trueSelf);
4102 self->substractEqual(a);
4103 Py_XINCREF(trueSelf);
4108 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4109 self->substractEqual(aaaa);
4110 Py_XINCREF(trueSelf);
4114 throw INTERP_KERNEL::Exception(msg);
4118 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4120 const char msg[]="Unexpected situation in __mul__ !";
4123 std::vector<int> aa;
4124 DataArrayIntTuple *aaa;
4126 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4131 MCAuto<DataArrayInt> ret=self->deepCopy();
4132 ret->applyLin(val,0);
4137 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4138 return DataArrayInt::Multiply(self,aaaa);
4142 return DataArrayInt::Multiply(self,a);
4146 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4147 return DataArrayInt::Multiply(self,aaaa);
4150 throw INTERP_KERNEL::Exception(msg);
4154 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4156 const char msg[]="Unexpected situation in __rmul__ !";
4159 std::vector<int> aa;
4160 DataArrayIntTuple *aaa;
4162 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4167 MCAuto<DataArrayInt> ret=self->deepCopy();
4168 ret->applyLin(val,0);
4173 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4174 return DataArrayInt::Multiply(self,aaaa);
4178 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4179 return DataArrayInt::Multiply(self,aaaa);
4182 throw INTERP_KERNEL::Exception(msg);
4186 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4188 const char msg[]="Unexpected situation in __imul__ !";
4191 std::vector<int> aa;
4192 DataArrayIntTuple *aaa;
4194 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4199 self->applyLin(val,0);
4200 Py_XINCREF(trueSelf);
4205 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4206 self->multiplyEqual(bb);
4207 Py_XINCREF(trueSelf);
4212 self->multiplyEqual(a);
4213 Py_XINCREF(trueSelf);
4218 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4219 self->multiplyEqual(aaaa);
4220 Py_XINCREF(trueSelf);
4224 throw INTERP_KERNEL::Exception(msg);
4228 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4230 const char msg[]="Unexpected situation in __div__ !";
4233 std::vector<int> aa;
4234 DataArrayIntTuple *aaa;
4236 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4241 MCAuto<DataArrayInt> ret=self->deepCopy();
4242 ret->applyDivideBy(val);
4247 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4248 return DataArrayInt::Divide(self,aaaa);
4252 return DataArrayInt::Divide(self,a);
4256 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4257 return DataArrayInt::Divide(self,aaaa);
4260 throw INTERP_KERNEL::Exception(msg);
4264 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4266 const char msg[]="Unexpected situation in __rdiv__ !";
4269 std::vector<int> aa;
4270 DataArrayIntTuple *aaa;
4272 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4277 MCAuto<DataArrayInt> ret=self->deepCopy();
4283 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4284 return DataArrayInt::Divide(aaaa,self);
4288 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4289 return DataArrayInt::Divide(aaaa,self);
4292 throw INTERP_KERNEL::Exception(msg);
4296 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4298 const char msg[]="Unexpected situation in __idiv__ !";
4301 std::vector<int> aa;
4302 DataArrayIntTuple *aaa;
4304 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4309 self->applyDivideBy(val);
4310 Py_XINCREF(trueSelf);
4315 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4316 self->divideEqual(bb);
4317 Py_XINCREF(trueSelf);
4322 self->divideEqual(a);
4323 Py_XINCREF(trueSelf);
4328 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4329 self->divideEqual(aaaa);
4330 Py_XINCREF(trueSelf);
4334 throw INTERP_KERNEL::Exception(msg);
4338 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4340 const char msg[]="Unexpected situation in __mod__ !";
4343 std::vector<int> aa;
4344 DataArrayIntTuple *aaa;
4346 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4351 MCAuto<DataArrayInt> ret=self->deepCopy();
4352 ret->applyModulus(val);
4357 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4358 return DataArrayInt::Modulus(self,aaaa);
4362 return DataArrayInt::Modulus(self,a);
4366 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4367 return DataArrayInt::Modulus(self,aaaa);
4370 throw INTERP_KERNEL::Exception(msg);
4374 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4376 const char msg[]="Unexpected situation in __rmod__ !";
4379 std::vector<int> aa;
4380 DataArrayIntTuple *aaa;
4382 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4387 MCAuto<DataArrayInt> ret=self->deepCopy();
4388 ret->applyRModulus(val);
4393 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4394 return DataArrayInt::Modulus(aaaa,self);
4398 return DataArrayInt::Modulus(a,self);
4402 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4403 return DataArrayInt::Modulus(aaaa,self);
4406 throw INTERP_KERNEL::Exception(msg);
4410 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4412 const char msg[]="Unexpected situation in __imod__ !";
4415 std::vector<int> aa;
4416 DataArrayIntTuple *aaa;
4418 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4423 self->applyModulus(val);
4424 Py_XINCREF(trueSelf);
4429 self->modulusEqual(a);
4430 Py_XINCREF(trueSelf);
4435 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4436 self->modulusEqual(aaaa);
4437 Py_XINCREF(trueSelf);
4441 throw INTERP_KERNEL::Exception(msg);
4445 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4447 const char msg[]="Unexpected situation in __pow__ !";
4450 std::vector<int> aa;
4451 DataArrayIntTuple *aaa;
4453 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4458 MCAuto<DataArrayInt> ret=self->deepCopy();
4464 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4465 return DataArrayInt::Pow(self,aaaa);
4469 return DataArrayInt::Pow(self,a);
4473 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4474 return DataArrayInt::Pow(self,aaaa);
4477 throw INTERP_KERNEL::Exception(msg);
4481 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4483 const char msg[]="Unexpected situation in __rpow__ !";
4486 std::vector<int> aa;
4487 DataArrayIntTuple *aaa;
4489 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4494 MCAuto<DataArrayInt> ret=self->deepCopy();
4495 ret->applyRPow(val);
4500 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4501 return DataArrayInt::Pow(aaaa,self);
4505 return DataArrayInt::Pow(a,self);
4509 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4510 return DataArrayInt::Pow(aaaa,self);
4513 throw INTERP_KERNEL::Exception(msg);
4517 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4519 const char msg[]="Unexpected situation in __ipow__ !";
4522 std::vector<int> aa;
4523 DataArrayIntTuple *aaa;
4525 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4530 self->applyPow(val);
4531 Py_XINCREF(trueSelf);
4537 Py_XINCREF(trueSelf);
4542 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4543 self->powEqual(aaaa);
4544 Py_XINCREF(trueSelf);
4548 throw INTERP_KERNEL::Exception(msg);
4552 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4554 std::ostringstream oss;
4555 self->reprQuickOverview(oss);
4559 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4561 int szArr,sw,iTypppArr;
4562 std::vector<int> stdvecTyyppArr;
4563 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4564 self->pushBackValsSilent(tmp,tmp+szArr);
4567 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4569 std::vector<int> ret1;
4570 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4571 std::size_t sz=ret0.size();
4572 PyObject *pyRet=PyTuple_New(2);
4573 PyObject *pyRet0=PyList_New((int)sz);
4574 PyObject *pyRet1=PyList_New((int)sz);
4575 for(std::size_t i=0;i<sz;i++)
4577 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4578 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4580 PyTuple_SetItem(pyRet,0,pyRet0);
4581 PyTuple_SetItem(pyRet,1,pyRet1);
4585 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4587 DataArrayInt *ret0=0,*ret1=0;
4588 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4589 PyObject *pyRet=PyTuple_New(2);
4590 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4591 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4595 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4598 bool ret(self->isRange(a,b,c));
4599 PyObject *pyRet=PyTuple_New(2);
4600 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4602 PyTuple_SetItem(pyRet,0,ret0Py);
4604 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4610 PyTuple_SetItem(pyRet,1,ret1Py);
4615 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4617 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4618 if(!PyTuple_Check(args))
4619 throw INTERP_KERNEL::Exception(MSG);
4620 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4621 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4622 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4624 PyObject *tmp0(PyTuple_New(1));
4625 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4626 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4628 Py_DECREF(selfMeth);
4629 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4630 int sz(PyTuple_Size(args));
4632 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4633 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4634 PyObject *zeNumpyRepr(0);
4635 PyObject *tmp1(PyInt_FromLong(0));
4636 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4638 PyObject *tmp3(PyTuple_New(1));
4639 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4640 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4644 Py_DECREF(initMeth);
4648 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4651 if(!self->isAllocated())
4652 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4653 PyObject *ret(PyTuple_New(1));
4654 PyObject *ret0(PyDict_New());
4655 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4656 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4657 PyObject *tmp1(PyInt_FromLong(0));
4658 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4659 PyTuple_SetItem(ret,0,ret0);
4663 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4669 class DataArrayIntTuple;
4671 class DataArrayIntIterator
4674 DataArrayIntIterator(DataArrayInt *da);
4675 ~DataArrayIntIterator();
4680 DataArrayIntTuple *ret=self->nextt();
4682 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4685 PyErr_SetString(PyExc_StopIteration,"No more data.");
4692 class DataArrayIntTuple
4695 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4696 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4699 std::string __str__() const throw(INTERP_KERNEL::Exception)
4701 return self->repr();
4704 int __int__() const throw(INTERP_KERNEL::Exception)
4706 return self->intValue();
4709 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4711 return self->buildDAInt(1,self->getNumberOfCompo());
4714 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4716 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4717 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4718 Py_XINCREF(trueSelf);
4722 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4724 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4725 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4726 Py_XINCREF(trueSelf);
4730 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4732 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4733 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4734 Py_XINCREF(trueSelf);
4738 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4740 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4741 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4742 Py_XINCREF(trueSelf);
4746 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4748 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4749 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4750 Py_XINCREF(trueSelf);
4754 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4756 return PyInt_FromLong(self->getNumberOfCompo());
4759 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4761 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4764 std::vector<int> multiVal;
4765 std::pair<int, std::pair<int,int> > slic;
4766 MEDCoupling::DataArrayInt *daIntTyypp=0;
4767 const int *pt=self->getConstPointer();
4768 int nbc=self->getNumberOfCompo();
4769 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4776 std::ostringstream oss;
4777 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4778 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4782 return PyInt_FromLong(pt[singleVal]);
4786 return PyInt_FromLong(pt[nbc+singleVal]);
4789 std::ostringstream oss;
4790 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4791 throw INTERP_KERNEL::Exception(oss.str().c_str());
4797 PyObject *t=PyTuple_New(multiVal.size());
4798 for(int j=0;j<(int)multiVal.size();j++)
4800 int cid=multiVal[j];
4803 std::ostringstream oss;
4804 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4805 throw INTERP_KERNEL::Exception(oss.str().c_str());
4807 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4813 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4814 PyObject *t=PyTuple_New(sz);
4815 for(int j=0;j<sz;j++)
4816 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4820 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4824 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4826 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4827 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4830 std::vector<int> multiValV;
4831 std::pair<int, std::pair<int,int> > slicV;
4832 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4833 int nbc=self->getNumberOfCompo();
4834 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4836 std::vector<int> multiVal;
4837 std::pair<int, std::pair<int,int> > slic;
4838 MEDCoupling::DataArrayInt *daIntTyypp=0;
4839 int *pt=self->getPointer();
4840 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4847 std::ostringstream oss;
4848 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4849 throw INTERP_KERNEL::Exception(oss.str().c_str());
4855 pt[singleVal]=singleValV;
4860 if(multiValV.size()!=1)
4862 std::ostringstream oss;
4863 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4864 throw INTERP_KERNEL::Exception(oss.str().c_str());
4866 pt[singleVal]=multiValV[0];
4871 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4875 throw INTERP_KERNEL::Exception(msg);
4884 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4888 std::ostringstream oss;
4889 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4890 throw INTERP_KERNEL::Exception(oss.str().c_str());
4898 if(multiVal.size()!=multiValV.size())
4900 std::ostringstream oss;
4901 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4902 throw INTERP_KERNEL::Exception(oss.str().c_str());
4904 for(int i=0;i<(int)multiVal.size();i++)
4906 int pos=multiVal[i];
4909 std::ostringstream oss;
4910 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4911 throw INTERP_KERNEL::Exception(oss.str().c_str());
4913 pt[multiVal[i]]=multiValV[i];
4919 const int *ptV=daIntTyyppV->getConstPointer();
4920 if(nbc>daIntTyyppV->getNumberOfCompo())
4922 std::ostringstream oss;
4923 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4924 throw INTERP_KERNEL::Exception(oss.str().c_str());
4926 std::copy(ptV,ptV+nbc,pt);
4930 throw INTERP_KERNEL::Exception(msg);
4935 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4940 for(int j=0;j<sz;j++)
4941 pt[slic.first+j*slic.second.second]=singleValV;
4946 if(sz!=(int)multiValV.size())
4948 std::ostringstream oss;
4949 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4950 throw INTERP_KERNEL::Exception(oss.str().c_str());
4952 for(int j=0;j<sz;j++)
4953 pt[slic.first+j*slic.second.second]=multiValV[j];
4958 const int *ptV=daIntTyyppV->getConstPointer();
4959 if(sz>daIntTyyppV->getNumberOfCompo())
4961 std::ostringstream oss;
4962 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4963 throw INTERP_KERNEL::Exception(oss.str().c_str());
4965 for(int j=0;j<sz;j++)
4966 pt[slic.first+j*slic.second.second]=ptV[j];
4970 throw INTERP_KERNEL::Exception(msg);
4974 throw INTERP_KERNEL::Exception(msg);
4980 class DataArrayChar : public DataArray
4983 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4984 int getHashCode() const throw(INTERP_KERNEL::Exception);
4985 bool empty() const throw(INTERP_KERNEL::Exception);
4986 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4987 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4988 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4989 char popBackSilent() throw(INTERP_KERNEL::Exception);
4990 void pack() const throw(INTERP_KERNEL::Exception);
4991 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4992 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4993 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4994 void reverse() throw(INTERP_KERNEL::Exception);
4995 void fillWithZero() throw(INTERP_KERNEL::Exception);
4996 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4997 std::string repr() const throw(INTERP_KERNEL::Exception);
4998 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4999 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
5000 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
5001 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
5002 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
5003 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
5004 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
5005 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
5006 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
5007 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
5008 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
5009 char front() const throw(INTERP_KERNEL::Exception);
5010 char back() const throw(INTERP_KERNEL::Exception);
5011 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5012 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5013 char *getPointer() throw(INTERP_KERNEL::Exception);
5014 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
5015 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
5016 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5017 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5018 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5019 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
5020 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5021 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
5022 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
5023 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5024 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5027 int __len__() const throw(INTERP_KERNEL::Exception)
5029 if(self->isAllocated())
5031 return self->getNumberOfTuples();
5035 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5039 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5042 bool ret0=self->isEqualIfNotWhy(other,ret1);
5043 PyObject *ret=PyTuple_New(2);
5044 PyObject *ret0Py=ret0?Py_True:Py_False;
5046 PyTuple_SetItem(ret,0,ret0Py);
5047 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5051 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5054 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5055 if (!SWIG_IsOK(res1))
5058 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5059 if(size!=self->getNumberOfTuples())
5061 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5063 return self->renumber(tmp);
5067 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5069 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5070 da2->checkAllocated();
5071 int size=self->getNumberOfTuples();
5072 if(size!=self->getNumberOfTuples())
5074 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5076 return self->renumber(da2->getConstPointer());
5080 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5083 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5084 if (!SWIG_IsOK(res1))
5087 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5088 if(size!=self->getNumberOfTuples())
5090 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5092 return self->renumberR(tmp);
5096 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5098 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5099 da2->checkAllocated();
5100 int size=self->getNumberOfTuples();
5101 if(size!=self->getNumberOfTuples())
5103 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5105 return self->renumberR(da2->getConstPointer());
5109 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5112 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5113 if (!SWIG_IsOK(res1))
5116 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5117 if(size!=self->getNumberOfTuples())
5119 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5121 return self->renumberAndReduce(tmp,newNbOfTuple);
5125 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5127 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5128 da2->checkAllocated();
5129 int size=self->getNumberOfTuples();
5130 if(size!=self->getNumberOfTuples())
5132 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5134 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5138 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5140 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5141 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5142 return DataArrayChar::Aggregate(tmp);
5145 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5147 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5148 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5149 return DataArrayChar::Meld(tmp);
5154 class DataArrayByteIterator;
5156 class DataArrayByte : public DataArrayChar
5159 static DataArrayByte *New();
5160 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5161 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5162 char byteValue() const throw(INTERP_KERNEL::Exception);
5165 DataArrayByte() throw(INTERP_KERNEL::Exception)
5167 return DataArrayByte::New();
5170 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5172 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) !";
5173 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5177 if(PyInt_Check(nbOfTuples))
5179 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5181 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5184 if(PyInt_Check(nbOfComp))
5185 {//DataArrayByte.New([1,3,4,5],2,2)
5186 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5188 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5189 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5190 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5191 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5195 throw INTERP_KERNEL::Exception(msg);
5198 {//DataArrayByte.New([1,3,4],3)
5199 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5201 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5202 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5207 throw INTERP_KERNEL::Exception(msg);
5210 {// DataArrayByte.New([1,3,4])
5211 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5212 int tmpp1=-1,tmpp2=-1;
5213 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5214 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5218 else if(PyInt_Check(elt0))
5220 int nbOfTuples1=PyInt_AS_LONG(elt0);
5222 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5227 if(PyInt_Check(nbOfTuples))
5228 {//DataArrayByte.New(5,2)
5229 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5231 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5232 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5233 ret->alloc(nbOfTuples1,nbOfCompo);
5237 throw INTERP_KERNEL::Exception(msg);
5240 throw INTERP_KERNEL::Exception(msg);
5243 {//DataArrayByte.New(5)
5244 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5245 ret->alloc(nbOfTuples1,1);
5250 throw INTERP_KERNEL::Exception(msg);
5253 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5255 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5258 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5260 std::ostringstream oss;
5261 self->reprQuickOverview(oss);
5265 int __int__() const throw(INTERP_KERNEL::Exception)
5267 return (int) self->byteValue();
5270 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5272 return self->iterator();
5275 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5277 return (int)self->getIJ(tupleId,compoId);
5280 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5282 return (int)self->getIJSafe(tupleId,compoId);
5285 std::string __str__() const throw(INTERP_KERNEL::Exception)
5287 return self->repr();
5290 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5292 const char *vals=self->getConstPointer();
5293 int nbOfComp=self->getNumberOfComponents();
5294 int nbOfTuples=self->getNumberOfTuples();
5295 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5298 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5301 int ival=-1; std::vector<int> ivval;
5302 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5303 std::vector<char> vals(sz);
5304 std::copy(pt,pt+sz,vals.begin());
5305 return self->presenceOfTuple(vals);
5308 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5311 int ival=-1; std::vector<int> ivval;
5312 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5313 std::vector<char> vals2(sz);
5314 std::copy(pt,pt+sz,vals2.begin());
5315 return self->presenceOfValue(vals2);
5318 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5321 int ival=-1; std::vector<int> ivval;
5322 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5323 std::vector<char> vals2(sz);
5324 std::copy(pt,pt+sz,vals2.begin());
5325 return self->findIdFirstEqual(vals2);
5328 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5331 int ival=-1; std::vector<int> ivval;
5332 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5333 std::vector<char> vals(sz);
5334 std::copy(pt,pt+sz,vals.begin());
5335 return self->findIdFirstEqualTuple(vals);
5338 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5341 int ival=-1; std::vector<int> ivval;
5342 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5343 std::vector<char> vals(sz);
5344 std::copy(pt,pt+sz,vals.begin());
5345 return self->findIdSequence(vals);
5348 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5350 int sz=self->getNumberOfComponents();
5351 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5352 self->getTuple(tupleId,tmp);
5353 PyObject *ret=PyTuple_New(sz);
5354 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5358 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5361 int r1=(int)self->getMaxValue(tmp);
5362 PyObject *ret=PyTuple_New(2);
5363 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5364 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5368 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5371 int r1=(int)self->getMinValue(tmp);
5372 PyObject *ret=PyTuple_New(2);
5373 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5374 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5378 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5380 int nbOfCompo=self->getNumberOfComponents();
5385 if(PyInt_Check(obj))
5387 int val=(int)PyInt_AS_LONG(obj);
5388 return self->findIdFirstEqual(val);
5391 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5394 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5398 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5400 int nbOfCompo=self->getNumberOfComponents();
5407 if(PyInt_Check(obj))
5409 int val=(int)PyInt_AS_LONG(obj);
5410 return self->presenceOfValue(val);
5413 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5416 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5420 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5422 self->checkAllocated();
5423 const char msg[]="Unexpected situation in __setitem__ !";
5424 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5427 std::vector<int> v1;
5429 DataArrayIntTuple *dd1=0;
5430 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5432 std::vector<int> vt1,vc1;
5433 std::pair<int, std::pair<int,int> > pt1,pc1;
5434 DataArrayInt *dt1=0,*dc1=0;
5435 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5436 MCAuto<DataArrayInt> tmp;
5444 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5447 throw INTERP_KERNEL::Exception(msg);
5456 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5459 throw INTERP_KERNEL::Exception(msg);
5468 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5471 throw INTERP_KERNEL::Exception(msg);
5480 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5483 throw INTERP_KERNEL::Exception(msg);
5492 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5495 throw INTERP_KERNEL::Exception(msg);
5504 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5507 throw INTERP_KERNEL::Exception(msg);
5516 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5519 throw INTERP_KERNEL::Exception(msg);
5528 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5531 throw INTERP_KERNEL::Exception(msg);
5540 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5543 throw INTERP_KERNEL::Exception(msg);
5552 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5555 throw INTERP_KERNEL::Exception(msg);
5564 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5567 throw INTERP_KERNEL::Exception(msg);
5576 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5579 throw INTERP_KERNEL::Exception(msg);
5588 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5591 throw INTERP_KERNEL::Exception(msg);
5600 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5603 throw INTERP_KERNEL::Exception(msg);
5612 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5615 throw INTERP_KERNEL::Exception(msg);
5624 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5627 throw INTERP_KERNEL::Exception(msg);
5632 throw INTERP_KERNEL::Exception(msg);
5639 class DataArrayByteTuple;
5641 class DataArrayByteIterator
5644 DataArrayByteIterator(DataArrayByte *da);
5645 ~DataArrayByteIterator();
5648 class DataArrayByteTuple
5651 std::string repr() const throw(INTERP_KERNEL::Exception);
5652 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5655 std::string __str__() const throw(INTERP_KERNEL::Exception)
5657 return self->repr();
5660 char __int__() const throw(INTERP_KERNEL::Exception)
5662 return self->byteValue();
5665 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5667 return self->buildDAByte(1,self->getNumberOfCompo());
5672 class DataArrayAsciiCharIterator;
5674 class DataArrayAsciiChar : public DataArrayChar
5677 static DataArrayAsciiChar *New();
5678 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5679 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5680 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5683 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5685 return DataArrayAsciiChar::New();
5688 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5690 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) !";
5691 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5695 if(PyInt_Check(nbOfTuples))
5697 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5699 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5702 if(PyInt_Check(nbOfComp))
5703 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5704 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5706 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5707 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5708 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5709 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5713 throw INTERP_KERNEL::Exception(msg);
5716 {//DataArrayAsciiChar.New([1,3,4],3)
5717 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5719 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5720 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5724 else if(PyString_Check(nbOfTuples))
5726 if(PyString_Size(nbOfTuples)!=1)
5727 throw INTERP_KERNEL::Exception(msg);
5728 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5729 std::vector<std::string> tmp;
5730 if(fillStringVector(elt0,tmp))
5731 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5733 throw INTERP_KERNEL::Exception(msg);
5736 throw INTERP_KERNEL::Exception(msg);
5740 std::vector<std::string> tmmp;
5741 if(fillStringVector(elt0,tmmp))
5742 //DataArrayAsciiChar.New(["abc","de","fghi"])
5743 return DataArrayAsciiChar::New(tmmp,' ');
5746 // DataArrayAsciiChar.New([1,3,4])
5747 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5748 int tmpp1=-1,tmpp2=-1;
5749 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5750 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5755 else if(PyInt_Check(elt0))
5757 int nbOfTuples1=PyInt_AS_LONG(elt0);
5759 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5764 if(PyInt_Check(nbOfTuples))
5765 {//DataArrayAsciiChar.New(5,2)
5766 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5768 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5769 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5770 ret->alloc(nbOfTuples1,nbOfCompo);
5774 throw INTERP_KERNEL::Exception(msg);
5777 throw INTERP_KERNEL::Exception(msg);
5780 {//DataArrayAsciiChar.New(5)
5781 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5782 ret->alloc(nbOfTuples1,1);
5787 throw INTERP_KERNEL::Exception(msg);
5790 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5792 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5795 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5797 std::ostringstream oss;
5798 self->reprQuickOverview(oss);
5802 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5804 return self->iterator();
5807 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5809 char tmp[2]; tmp[1]='\0';
5810 tmp[0]=self->getIJ(tupleId,compoId);
5811 return std::string(tmp);
5814 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5816 char tmp[2]; tmp[1]='\0';
5817 tmp[0]=self->getIJSafe(tupleId,compoId);
5818 return std::string(tmp);
5821 std::string __str__() const throw(INTERP_KERNEL::Exception)
5823 return self->repr();
5826 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5828 const char *vals=self->getConstPointer();
5829 int nbOfComp=self->getNumberOfComponents();
5830 int nbOfTuples=self->getNumberOfTuples();
5831 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5834 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5836 if(PyString_Check(tupl))
5838 Py_ssize_t sz=PyString_Size(tupl);
5839 std::vector<char> vals(sz);
5840 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5841 return self->presenceOfTuple(vals);
5844 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5847 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5849 if(PyString_Check(vals))
5851 Py_ssize_t sz=PyString_Size(vals);
5852 std::vector<char> vals2(sz);
5853 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5854 return self->presenceOfValue(vals2);
5857 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5860 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5862 if(PyString_Check(vals))
5864 Py_ssize_t sz=PyString_Size(vals);
5865 std::vector<char> vals2(sz);
5866 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5867 return self->findIdFirstEqual(vals2);
5870 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5873 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5875 if(PyString_Check(tupl))
5877 Py_ssize_t sz=PyString_Size(tupl);
5878 std::vector<char> vals(sz);
5879 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5880 return self->findIdFirstEqualTuple(vals);
5883 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5886 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5888 if(PyString_Check(strOrListOfInt))
5890 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5891 std::vector<char> vals(sz);
5892 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5893 return self->findIdSequence(vals);
5896 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5899 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5901 int sz=self->getNumberOfComponents();
5902 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5903 self->getTuple(tupleId,tmp);
5904 return PyString_FromString(tmp);
5907 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5910 char tmp2[2]; tmp2[1]='\0';
5911 tmp2[0]=self->getMaxValue(tmp);
5912 PyObject *ret=PyTuple_New(2);
5913 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5914 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5918 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5921 char tmp2[2]; tmp2[1]='\0';
5922 tmp2[0]=self->getMinValue(tmp);
5923 PyObject *ret=PyTuple_New(2);
5924 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5925 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5929 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5931 int nbOfCompo=self->getNumberOfComponents();
5936 if(PyString_Check(obj))
5938 Py_ssize_t sz=PyString_Size(obj);
5939 char *pt=PyString_AsString(obj);
5941 return self->findIdFirstEqual(pt[0]);
5943 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5946 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5949 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5953 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5955 int nbOfCompo=self->getNumberOfComponents();
5962 if(PyString_Check(obj))
5964 Py_ssize_t sz=PyString_Size(obj);
5965 char *pt=PyString_AsString(obj);
5967 return self->presenceOfValue(pt[0]);
5969 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5972 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5975 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5979 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5982 std::vector<int> stdvecTyyppArr;
5983 std::pair<int, std::pair<int,int> > sTyyppArr;
5984 MEDCoupling::DataArrayInt *daIntTyypp=0;
5985 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5989 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5991 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5993 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5995 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5997 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6001 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6003 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.";
6005 std::vector<int> stdvecTyyppArr;
6006 std::pair<int, std::pair<int,int> > sTyyppArr;
6007 MEDCoupling::DataArrayInt *daIntTyypp=0;
6008 int nbOfCompo=self->getNumberOfComponents();
6009 int nbOfTuples=self->getNumberOfTuples();
6010 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6012 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6013 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6022 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6028 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6029 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6032 //value vector<string>
6035 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6036 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6039 //value DataArrayChar
6042 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6046 throw INTERP_KERNEL::Exception(msg);
6050 {//obj list-tuple[int]
6056 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6062 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6063 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6066 //value vector<string>
6069 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6070 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6073 //value DataArrayChar
6076 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6080 throw INTERP_KERNEL::Exception(msg);
6091 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6097 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6098 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6101 //value vector<string>
6104 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6105 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6108 //value DataArrayChar
6111 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6115 throw INTERP_KERNEL::Exception(msg);
6126 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6132 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6133 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6136 //value vector<string>
6139 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6140 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6143 //value DataArrayChar
6146 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6150 throw INTERP_KERNEL::Exception(msg);
6155 throw INTERP_KERNEL::Exception(msg);
6161 class DataArrayAsciiCharTuple;
6163 class DataArrayAsciiCharIterator
6166 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6167 ~DataArrayAsciiCharIterator();
6172 DataArrayAsciiCharTuple *ret=self->nextt();
6174 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6177 PyErr_SetString(PyExc_StopIteration,"No more data.");
6184 class DataArrayAsciiCharTuple
6187 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6188 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6191 std::string __str__() const throw(INTERP_KERNEL::Exception)
6193 return self->repr();
6196 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6198 return self->buildDAAsciiChar(1,self->getNumberOfCompo());