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::subArray;
155 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
156 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
157 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
158 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
159 %newobject MEDCoupling::DataArrayDouble::negate;
160 %newobject MEDCoupling::DataArrayDouble::computeAbs;
161 %newobject MEDCoupling::DataArrayDouble::applyFunc;
162 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
163 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
164 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
165 %newobject MEDCoupling::DataArrayDouble::determinant;
166 %newobject MEDCoupling::DataArrayDouble::eigenValues;
167 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
168 %newobject MEDCoupling::DataArrayDouble::inverse;
169 %newobject MEDCoupling::DataArrayDouble::trace;
170 %newobject MEDCoupling::DataArrayDouble::deviator;
171 %newobject MEDCoupling::DataArrayDouble::magnitude;
172 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
173 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
174 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
175 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
176 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
177 %newobject MEDCoupling::DataArrayDouble::renumber;
178 %newobject MEDCoupling::DataArrayDouble::renumberR;
179 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
180 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
181 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
182 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
183 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
184 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
185 %newobject MEDCoupling::DataArrayDouble::cartesianize;
186 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
187 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
188 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
189 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
190 %newobject MEDCoupling::DataArrayDouble::__neg__;
191 %newobject MEDCoupling::DataArrayDouble::__radd__;
192 %newobject MEDCoupling::DataArrayDouble::__rsub__;
193 %newobject MEDCoupling::DataArrayDouble::__rmul__;
194 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
195 %newobject MEDCoupling::DataArrayDouble::__pow__;
196 %newobject MEDCoupling::DataArrayDouble::__rpow__;
197 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
199 %feature("unref") DataArray "$this->decrRef();"
200 %feature("unref") DataArrayDouble "$this->decrRef();"
201 %feature("unref") DataArrayInt "$this->decrRef();"
202 %feature("unref") DataArrayChar "$this->decrRef();"
203 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
204 %feature("unref") DataArrayByte "$this->decrRef();"
206 namespace MEDCoupling
213 } MEDCouplingAxisType;
215 class DataArray : public RefCountObject, public TimeLabel
218 void setName(const std::string& name);
219 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
220 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
221 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
222 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
223 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
224 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
225 std::string getName() const;
226 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
227 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
228 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
229 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
230 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
231 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
232 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
233 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
234 int getNumberOfComponents() const;
235 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
236 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
237 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
238 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
239 virtual void desallocate() throw(INTERP_KERNEL::Exception);
240 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
241 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
242 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
243 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
244 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
245 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
246 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
247 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
248 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
249 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
250 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
251 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
252 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
253 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
254 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
255 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
256 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
257 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
258 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
259 void updateTime() const;
262 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
264 const std::vector<std::string>& comps=self->getInfoOnComponents();
265 PyObject *ret=PyList_New((int)comps.size());
266 for(int i=0;i<(int)comps.size();i++)
267 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
271 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
273 std::vector<int> tmp;
274 convertPyToNewIntArr3(li,tmp);
275 self->copyPartOfStringInfoFrom(other,tmp);
278 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
280 std::vector<int> tmp;
281 convertPyToNewIntArr3(li,tmp);
282 self->copyPartOfStringInfoFrom2(tmp,other);
285 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
288 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
289 if (!SWIG_IsOK(res1))
292 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
293 if(size!=self->getNumberOfTuples())
295 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
297 self->renumberInPlace(tmp);
301 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
303 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
304 da2->checkAllocated();
305 int size=self->getNumberOfTuples();
306 if(size!=self->getNumberOfTuples())
308 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
310 self->renumberInPlace(da2->getConstPointer());
314 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
317 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
318 if (!SWIG_IsOK(res1))
321 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
322 if(size!=self->getNumberOfTuples())
324 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
326 self->renumberInPlaceR(tmp);
330 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
332 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
333 da2->checkAllocated();
334 int size=self->getNumberOfTuples();
335 if(size!=self->getNumberOfTuples())
337 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
339 self->renumberInPlaceR(da2->getConstPointer());
343 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
344 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
346 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
347 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
348 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
349 DataArrayInt *tuplesSelecPtr2=0;
352 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
354 throw INTERP_KERNEL::Exception(msg);
356 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
359 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
361 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
362 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
365 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
367 std::vector<std::pair<int,int> > ranges;
368 convertPyToVectorPairInt(li,ranges);
369 return self->selectByTupleRanges(ranges);
372 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
375 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
376 if (!SWIG_IsOK(res1))
379 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
380 return self->selectByTupleId(tmp,tmp+size);
384 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
386 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
387 da2->checkAllocated();
388 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
392 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
395 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
396 if (!SWIG_IsOK(res1))
399 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
400 return self->selectByTupleIdSafe(tmp,tmp+size);
404 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
406 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
407 da2->checkAllocated();
408 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
412 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
414 std::vector<int> tmp;
415 convertPyToNewIntArr3(li,tmp);
416 DataArray *ret=self->keepSelectedComponents(tmp);
417 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
420 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
422 if(!PySlice_Check(slic))
423 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
424 Py_ssize_t strt=2,stp=2,step=2;
425 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
426 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
428 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
429 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
432 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
434 if(!PySlice_Check(slic))
435 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
436 Py_ssize_t strt=2,stp=2,step=2;
437 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
438 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
440 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
441 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
444 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
446 if(!PySlice_Check(slic))
447 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
448 Py_ssize_t strt=2,stp=2,step=2;
449 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
450 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
451 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
454 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
456 if(!PySlice_Check(slic))
457 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
458 Py_ssize_t strt=2,stp=2,step=2;
459 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
460 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
461 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
464 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
466 std::vector<const DataArray *> tmp;
467 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
468 return DataArray::Aggregate(tmp);
471 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
473 if(!PySlice_Check(slic))
474 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
475 Py_ssize_t strt=2,stp=2,step=2;
476 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
477 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
478 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
481 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
483 if(!PySlice_Check(slic))
484 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
485 Py_ssize_t strt=2,stp=2,step=2;
486 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
487 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
488 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
491 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
493 PyObject *ret(PyTuple_New(2));
494 std::string a0(self->getName());
495 const std::vector<std::string> &a1(self->getInfoOnComponents());
496 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
499 PyObject *ret1(PyList_New(sz));
500 for(int i=0;i<sz;i++)
501 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
502 PyTuple_SetItem(ret,1,ret1);
507 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
509 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 !";
510 if(!PyTuple_Check(inp))
511 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
512 int sz(PyTuple_Size(inp));
514 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
515 PyObject *a0(PyTuple_GetItem(inp,0));
516 if(!PyString_Check(a0))
517 throw INTERP_KERNEL::Exception(MSG);
518 PyObject *a1(PyTuple_GetItem(inp,1));
519 std::vector<std::string> a1cpp;
520 if(!fillStringVector(a1,a1cpp))
521 throw INTERP_KERNEL::Exception(MSG);
522 self->setName(PyString_AsString(a0));
523 self->setInfoOnComponents(a1cpp);
529 class DataArrayDoubleIterator;
531 class DataArrayDouble : public DataArray
534 static DataArrayDouble *New();
535 double doubleValue() const throw(INTERP_KERNEL::Exception);
536 bool empty() const throw(INTERP_KERNEL::Exception);
537 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
538 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
539 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
540 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
541 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
542 double popBackSilent() throw(INTERP_KERNEL::Exception);
543 void pack() const throw(INTERP_KERNEL::Exception);
544 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
545 void fillWithZero() throw(INTERP_KERNEL::Exception);
546 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
547 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
548 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
549 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
550 void reverse() throw(INTERP_KERNEL::Exception);
551 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
552 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
553 std::string repr() const throw(INTERP_KERNEL::Exception);
554 std::string reprZip() const throw(INTERP_KERNEL::Exception);
555 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
556 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
557 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
558 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
562 void transpose() throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
564 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
567 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
568 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
569 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
570 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
571 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
572 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
573 double front() const throw(INTERP_KERNEL::Exception);
574 double back() const throw(INTERP_KERNEL::Exception);
575 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
576 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
577 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
578 double *getPointer() throw(INTERP_KERNEL::Exception);
579 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
580 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
581 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
582 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
583 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
584 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
585 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
586 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
587 double getAverageValue() const throw(INTERP_KERNEL::Exception);
588 double norm2() const throw(INTERP_KERNEL::Exception);
589 double normMax() const throw(INTERP_KERNEL::Exception);
590 double normMin() const throw(INTERP_KERNEL::Exception);
591 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
595 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
596 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
608 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
609 void abs() throw(INTERP_KERNEL::Exception);
610 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
611 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
612 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
613 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
614 void applyPow(double val) throw(INTERP_KERNEL::Exception);
615 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
617 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
620 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
621 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
622 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
623 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
624 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
625 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
626 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
627 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
630 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
631 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
632 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
633 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
634 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
635 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
636 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
637 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
638 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
639 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
640 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
641 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
642 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
645 DataArrayDouble() throw(INTERP_KERNEL::Exception)
647 return DataArrayDouble::New();
650 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
652 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)";
653 std::string msg(msgBase);
655 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
658 if(PyList_Check(elt0) || PyTuple_Check(elt0))
662 if(PyInt_Check(nbOfTuples))
664 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
666 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
669 if(PyInt_Check(elt2))
670 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
671 int nbOfCompo=PyInt_AS_LONG(elt2);
673 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
674 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
675 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
676 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
680 throw INTERP_KERNEL::Exception(msg.c_str());
683 {//DataArrayDouble.New([1.,3.,4.],3)
684 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
686 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
687 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
692 throw INTERP_KERNEL::Exception(msg.c_str());
695 {// DataArrayDouble.New([1.,3.,4.])
696 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
697 int tmpp1=-1,tmpp2=-1;
698 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
699 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
703 else if(PyInt_Check(elt0))
705 int nbOfTuples1=PyInt_AS_LONG(elt0);
707 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
712 if(PyInt_Check(nbOfTuples))
713 {//DataArrayDouble.New(5,2)
714 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
716 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
717 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
718 ret->alloc(nbOfTuples1,nbOfCompo);
722 throw INTERP_KERNEL::Exception(msg.c_str());
725 throw INTERP_KERNEL::Exception(msg.c_str());
728 {//DataArrayDouble.New(5)
729 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
730 ret->alloc(nbOfTuples1,1);
735 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
736 {//DataArrayDouble.New(numpyArray)
737 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
741 throw INTERP_KERNEL::Exception(msg.c_str());
742 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
745 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
747 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
750 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
753 std::vector<double> bb;
755 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
756 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
757 self->pushBackValsSilent(tmp,tmp+nbTuples);
760 std::string __repr__() const throw(INTERP_KERNEL::Exception)
762 std::ostringstream oss;
763 self->reprQuickOverview(oss);
767 std::string __str__() const throw(INTERP_KERNEL::Exception)
769 return self->reprNotTooLong();
772 double __float__() const throw(INTERP_KERNEL::Exception)
774 return self->doubleValue();
777 int __len__() const throw(INTERP_KERNEL::Exception)
779 if(self->isAllocated())
781 return self->getNumberOfTuples();
785 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
789 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
791 return self->iterator();
794 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
796 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 !";
797 if(PyList_Check(li) || PyTuple_Check(li))
801 if(PyInt_Check(nbOfTuples))
803 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
805 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
808 if(PyInt_Check(nbOfComp))
809 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
810 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
812 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
813 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
814 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
817 throw INTERP_KERNEL::Exception(msg);
820 {//DataArrayDouble.setValues([1.,3.,4.],3)
822 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
823 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
827 throw INTERP_KERNEL::Exception(msg);
830 {// DataArrayDouble.setValues([1.,3.,4.])
831 int tmpp1=-1,tmpp2=-1;
832 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
833 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
837 throw INTERP_KERNEL::Exception(msg);
840 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
842 const double *vals=self->getConstPointer();
843 return convertDblArrToPyList(vals,self->getNbOfElems());
847 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
849 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
853 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
856 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
857 PyObject *ret=PyTuple_New(2);
858 PyObject *ret0Py=ret0?Py_True:Py_False;
860 PyTuple_SetItem(ret,0,ret0Py);
861 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
865 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
867 const double *vals=self->getConstPointer();
868 int nbOfComp=self->getNumberOfComponents();
869 int nbOfTuples=self->getNumberOfTuples();
870 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
873 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
876 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
877 if (!SWIG_IsOK(res1))
880 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
881 if(size!=self->getNumberOfTuples())
883 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
885 return self->renumber(tmp);
889 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
891 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
892 da2->checkAllocated();
893 int size=self->getNumberOfTuples();
894 if(size!=self->getNumberOfTuples())
896 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
898 return self->renumber(da2->getConstPointer());
902 DataArrayDouble *renumberR(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->renumberR(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->renumberR(da2->getConstPointer());
931 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) 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->renumberAndReduce(tmp,newNbOfTuple);
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->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
960 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
962 int thisTupleId,otherTupleId;
963 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
964 PyObject *ret=PyTuple_New(3);
965 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
966 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
967 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
971 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
974 double r1=self->getMaxValue(tmp);
975 PyObject *ret=PyTuple_New(2);
976 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
977 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
981 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
984 double r1=self->getMaxValue2(tmp);
985 PyObject *ret=PyTuple_New(2);
986 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
987 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
991 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
994 double r1=self->getMinValue(tmp);
995 PyObject *ret=PyTuple_New(2);
996 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
997 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1001 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1004 double r1=self->getMinValue2(tmp);
1005 PyObject *ret=PyTuple_New(2);
1006 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1007 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1011 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1013 int nbOfCompo=self->getNumberOfComponents();
1014 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1015 self->getMinMaxPerComponent(tmp);
1016 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1020 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1022 int sz=self->getNumberOfComponents();
1023 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1024 self->accumulate(tmp);
1025 return convertDblArrToPyList(tmp,sz);
1028 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1031 std::vector<int> val2;
1032 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1033 return self->accumulatePerChunck(bg,bg+sz);
1036 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1038 DataArrayInt *comm, *commIndex;
1039 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1040 PyObject *res = PyList_New(2);
1041 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1042 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1046 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1050 DataArrayDoubleTuple *aa;
1051 std::vector<double> bb;
1053 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1054 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1056 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1057 PyObject *ret=PyTuple_New(2);
1058 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1059 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1063 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1065 std::vector<int> tmp;
1066 convertPyToNewIntArr3(li,tmp);
1067 self->setSelectedComponents(a,tmp);
1070 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1072 int sz=self->getNumberOfComponents();
1073 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1074 self->getTuple(tupleId,tmp);
1075 return convertDblArrToPyList(tmp,sz);
1078 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1080 std::vector<const DataArrayDouble *> tmp;
1081 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1082 return DataArrayDouble::Aggregate(tmp);
1085 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1087 std::vector<const DataArrayDouble *> tmp;
1088 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1089 return DataArrayDouble::Meld(tmp);
1092 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1096 DataArrayDoubleTuple *aa;
1097 std::vector<double> bb;
1099 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1100 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1101 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1102 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1103 DataArrayInt *c=0,*cI=0;
1104 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1105 PyObject *ret=PyTuple_New(2);
1106 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1107 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1111 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1113 DataArrayInt *ret1=0;
1114 bool ret0=self->areIncludedInMe(other,prec,ret1);
1115 PyObject *ret=PyTuple_New(2);
1116 PyObject *ret0Py=ret0?Py_True:Py_False;
1118 PyTuple_SetItem(ret,0,ret0Py);
1119 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1123 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1125 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1126 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1127 self->checkAllocated();
1128 int nbOfTuples=self->getNumberOfTuples();
1129 int nbOfComponents=self->getNumberOfComponents();
1131 std::vector<int> vt1,vc1;
1132 std::pair<int, std::pair<int,int> > pt1,pc1;
1133 DataArrayInt *dt1=0,*dc1=0;
1135 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1136 MCAuto<DataArrayDouble> ret;
1140 if(nbOfComponents==1)
1141 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1142 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1144 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1146 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1148 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1150 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1153 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1154 std::vector<int> v2(1,ic1);
1155 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1159 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1160 std::vector<int> v2(1,ic1);
1161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1165 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1166 std::vector<int> v2(1,ic1);
1167 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1171 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1172 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1176 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1177 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1181 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1182 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1186 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1187 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1191 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1192 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1193 std::vector<int> v2(nbOfComp);
1194 for(int i=0;i<nbOfComp;i++)
1195 v2[i]=pc1.first+i*pc1.second.second;
1196 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1200 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1201 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1202 std::vector<int> v2(nbOfComp);
1203 for(int i=0;i<nbOfComp;i++)
1204 v2[i]=pc1.first+i*pc1.second.second;
1205 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1209 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1210 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1211 std::vector<int> v2(nbOfComp);
1212 for(int i=0;i<nbOfComp;i++)
1213 v2[i]=pc1.first+i*pc1.second.second;
1214 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1218 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1219 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1220 std::vector<int> v2(nbOfComp);
1221 for(int i=0;i<nbOfComp;i++)
1222 v2[i]=pc1.first+i*pc1.second.second;
1223 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1226 throw INTERP_KERNEL::Exception(msg);
1230 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1232 self->checkAllocated();
1233 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1234 int nbOfTuples=self->getNumberOfTuples();
1235 int nbOfComponents=self->getNumberOfComponents();
1238 std::vector<double> v1;
1239 DataArrayDouble *d1=0;
1240 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1242 std::vector<int> vt1,vc1;
1243 std::pair<int, std::pair<int,int> > pt1,pc1;
1244 DataArrayInt *dt1=0,*dc1=0;
1245 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1246 MCAuto<DataArrayDouble> tmp;
1254 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1257 tmp=DataArrayDouble::New();
1258 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1259 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1262 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1265 throw INTERP_KERNEL::Exception(msg);
1274 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1277 tmp=DataArrayDouble::New();
1278 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1279 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1282 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1285 throw INTERP_KERNEL::Exception(msg);
1294 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1297 tmp=DataArrayDouble::New();
1298 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1299 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1302 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1305 throw INTERP_KERNEL::Exception(msg);
1314 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1317 tmp=DataArrayDouble::New();
1318 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1319 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1322 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1325 throw INTERP_KERNEL::Exception(msg);
1334 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1337 tmp=DataArrayDouble::New();
1338 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1339 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1342 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1345 throw INTERP_KERNEL::Exception(msg);
1354 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1357 tmp=DataArrayDouble::New();
1358 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1359 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1362 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1365 throw INTERP_KERNEL::Exception(msg);
1374 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1377 tmp=DataArrayDouble::New();
1378 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1379 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1382 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1385 throw INTERP_KERNEL::Exception(msg);
1394 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1397 tmp=DataArrayDouble::New();
1398 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1399 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1402 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1405 throw INTERP_KERNEL::Exception(msg);
1414 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1417 tmp=DataArrayDouble::New();
1418 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1419 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1422 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1425 throw INTERP_KERNEL::Exception(msg);
1434 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1437 tmp=DataArrayDouble::New();
1438 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1439 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1442 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1445 throw INTERP_KERNEL::Exception(msg);
1454 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1457 tmp=DataArrayDouble::New();
1458 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1459 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1462 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1465 throw INTERP_KERNEL::Exception(msg);
1474 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1477 tmp=DataArrayDouble::New();
1478 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1479 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1482 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1485 throw INTERP_KERNEL::Exception(msg);
1494 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1497 tmp=DataArrayDouble::New();
1498 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1499 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1502 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1505 throw INTERP_KERNEL::Exception(msg);
1514 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1517 tmp=DataArrayDouble::New();
1518 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1519 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1522 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1525 throw INTERP_KERNEL::Exception(msg);
1534 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1537 tmp=DataArrayDouble::New();
1538 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1539 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1542 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1545 throw INTERP_KERNEL::Exception(msg);
1554 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1557 tmp=DataArrayDouble::New();
1558 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1559 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1562 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1565 throw INTERP_KERNEL::Exception(msg);
1570 throw INTERP_KERNEL::Exception(msg);
1575 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1577 return self->negate();
1580 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1582 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1585 DataArrayDoubleTuple *aa;
1586 std::vector<double> bb;
1589 #ifndef WITHOUT_AUTOFIELD
1591 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1593 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1596 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1597 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1599 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1602 throw INTERP_KERNEL::Exception(msg);
1606 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1611 MCAuto<DataArrayDouble> ret=self->deepCopy();
1612 ret->applyLin(1.,val);
1613 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1617 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1621 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1622 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1626 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1627 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1630 throw INTERP_KERNEL::Exception(msg);
1634 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1636 const char msg[]="Unexpected situation in __radd__ !";
1639 DataArrayDoubleTuple *aa;
1640 std::vector<double> bb;
1642 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1647 MCAuto<DataArrayDouble> ret=self->deepCopy();
1648 ret->applyLin(1.,val);
1653 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1654 return DataArrayDouble::Add(self,aaa);
1658 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1659 return DataArrayDouble::Add(self,aaa);
1662 throw INTERP_KERNEL::Exception(msg);
1666 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1668 const char msg[]="Unexpected situation in __iadd__ !";
1671 DataArrayDoubleTuple *aa;
1672 std::vector<double> bb;
1674 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1679 self->applyLin(1.,val);
1680 Py_XINCREF(trueSelf);
1686 Py_XINCREF(trueSelf);
1691 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1692 self->addEqual(aaa);
1693 Py_XINCREF(trueSelf);
1698 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1699 self->addEqual(aaa);
1700 Py_XINCREF(trueSelf);
1704 throw INTERP_KERNEL::Exception(msg);
1708 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1710 const char msg[]="Unexpected situation in __sub__ !";
1713 DataArrayDoubleTuple *aa;
1714 std::vector<double> bb;
1717 #ifndef WITHOUT_AUTOFIELD
1719 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1721 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1724 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1725 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1727 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1730 throw INTERP_KERNEL::Exception(msg);
1734 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1739 MCAuto<DataArrayDouble> ret=self->deepCopy();
1740 ret->applyLin(1.,-val);
1741 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1745 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1749 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1750 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1754 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1755 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1758 throw INTERP_KERNEL::Exception(msg);
1762 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1764 const char msg[]="Unexpected situation in __rsub__ !";
1767 DataArrayDoubleTuple *aa;
1768 std::vector<double> bb;
1770 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1775 MCAuto<DataArrayDouble> ret=self->deepCopy();
1776 ret->applyLin(-1.,val);
1781 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1782 return DataArrayDouble::Substract(aaa,self);
1786 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1787 return DataArrayDouble::Substract(aaa,self);
1790 throw INTERP_KERNEL::Exception(msg);
1794 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1796 const char msg[]="Unexpected situation in __isub__ !";
1799 DataArrayDoubleTuple *aa;
1800 std::vector<double> bb;
1802 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1807 self->applyLin(1,-val);
1808 Py_XINCREF(trueSelf);
1813 self->substractEqual(a);
1814 Py_XINCREF(trueSelf);
1819 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1820 self->substractEqual(aaa);
1821 Py_XINCREF(trueSelf);
1826 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1827 self->substractEqual(aaa);
1828 Py_XINCREF(trueSelf);
1832 throw INTERP_KERNEL::Exception(msg);
1836 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1838 const char msg[]="Unexpected situation in __mul__ !";
1841 DataArrayDoubleTuple *aa;
1842 std::vector<double> bb;
1845 #ifndef WITHOUT_AUTOFIELD
1847 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1849 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1852 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1853 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1855 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1858 throw INTERP_KERNEL::Exception(msg);
1862 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1867 MCAuto<DataArrayDouble> ret=self->deepCopy();
1868 ret->applyLin(val,0.);
1869 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1873 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1877 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1878 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1882 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1883 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1886 throw INTERP_KERNEL::Exception(msg);
1890 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1892 const char msg[]="Unexpected situation in __rmul__ !";
1895 DataArrayDoubleTuple *aa;
1896 std::vector<double> bb;
1898 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1903 MCAuto<DataArrayDouble> ret=self->deepCopy();
1904 ret->applyLin(val,0.);
1909 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1910 return DataArrayDouble::Multiply(self,aaa);
1914 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1915 return DataArrayDouble::Multiply(self,aaa);
1918 throw INTERP_KERNEL::Exception(msg);
1922 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1924 const char msg[]="Unexpected situation in __imul__ !";
1927 DataArrayDoubleTuple *aa;
1928 std::vector<double> bb;
1930 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1935 self->applyLin(val,0.);
1936 Py_XINCREF(trueSelf);
1941 self->multiplyEqual(a);
1942 Py_XINCREF(trueSelf);
1947 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1948 self->multiplyEqual(aaa);
1949 Py_XINCREF(trueSelf);
1954 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1955 self->multiplyEqual(aaa);
1956 Py_XINCREF(trueSelf);
1960 throw INTERP_KERNEL::Exception(msg);
1964 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1966 const char msg[]="Unexpected situation in __div__ !";
1969 DataArrayDoubleTuple *aa;
1970 std::vector<double> bb;
1973 #ifndef WITHOUT_AUTOFIELD
1975 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1977 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1980 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1981 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1983 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1986 throw INTERP_KERNEL::Exception(msg);
1990 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1996 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1997 MCAuto<DataArrayDouble> ret=self->deepCopy();
1998 ret->applyLin(1/val,0.);
1999 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2003 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2007 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2008 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2012 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2013 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2016 throw INTERP_KERNEL::Exception(msg);
2020 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2022 const char msg[]="Unexpected situation in __rdiv__ !";
2025 DataArrayDoubleTuple *aa;
2026 std::vector<double> bb;
2028 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2033 MCAuto<DataArrayDouble> ret=self->deepCopy();
2039 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2040 return DataArrayDouble::Divide(aaa,self);
2044 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2045 return DataArrayDouble::Divide(aaa,self);
2048 throw INTERP_KERNEL::Exception(msg);
2052 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2054 const char msg[]="Unexpected situation in __idiv__ !";
2057 DataArrayDoubleTuple *aa;
2058 std::vector<double> bb;
2060 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2066 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2067 self->applyLin(1./val,0.);
2068 Py_XINCREF(trueSelf);
2073 self->divideEqual(a);
2074 Py_XINCREF(trueSelf);
2079 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2080 self->divideEqual(aaa);
2081 Py_XINCREF(trueSelf);
2086 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2087 self->divideEqual(aaa);
2088 Py_XINCREF(trueSelf);
2092 throw INTERP_KERNEL::Exception(msg);
2096 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2098 const char msg[]="Unexpected situation in __pow__ !";
2101 DataArrayDoubleTuple *aa;
2102 std::vector<double> bb;
2104 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2109 MCAuto<DataArrayDouble> ret=self->deepCopy();
2115 return DataArrayDouble::Pow(self,a);
2119 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2120 return DataArrayDouble::Pow(self,aaa);
2124 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2125 return DataArrayDouble::Pow(self,aaa);
2128 throw INTERP_KERNEL::Exception(msg);
2132 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2134 const char msg[]="Unexpected situation in __rpow__ !";
2137 DataArrayDoubleTuple *aa;
2138 std::vector<double> bb;
2140 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2145 MCAuto<DataArrayDouble> ret=self->deepCopy();
2146 ret->applyRPow(val);
2151 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2152 return DataArrayDouble::Pow(aaa,self);
2156 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2157 return DataArrayDouble::Pow(aaa,self);
2160 throw INTERP_KERNEL::Exception(msg);
2164 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2166 const char msg[]="Unexpected situation in __ipow__ !";
2169 DataArrayDoubleTuple *aa;
2170 std::vector<double> bb;
2172 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2177 self->applyPow(val);
2178 Py_XINCREF(trueSelf);
2184 Py_XINCREF(trueSelf);
2189 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2190 self->powEqual(aaa);
2191 Py_XINCREF(trueSelf);
2196 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2197 self->powEqual(aaa);
2198 Py_XINCREF(trueSelf);
2202 throw INTERP_KERNEL::Exception(msg);
2206 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2208 DataArrayInt *c=0,*cI=0;
2210 self->computeTupleIdsNearTuples(other,eps,c,cI);
2211 PyObject *ret=PyTuple_New(2);
2212 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2213 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2217 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2219 DataArrayInt *ret1=0;
2220 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2221 PyObject *ret=PyTuple_New(2);
2222 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2223 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2228 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2230 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2231 if(!PyTuple_Check(args))
2232 throw INTERP_KERNEL::Exception(MSG);
2233 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2234 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2235 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2237 PyObject *tmp0(PyTuple_New(1));
2238 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2239 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2241 Py_DECREF(selfMeth);
2242 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2243 int sz(PyTuple_Size(args));
2245 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2246 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2247 PyObject *zeNumpyRepr(0);
2248 PyObject *tmp1(PyInt_FromLong(0));
2249 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2251 PyObject *tmp3(PyTuple_New(1));
2252 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2253 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2257 Py_DECREF(initMeth);
2261 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2264 if(!self->isAllocated())
2265 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2266 PyObject *ret(PyTuple_New(1));
2267 PyObject *ret0(PyDict_New());
2268 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2269 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2270 PyObject *tmp1(PyInt_FromLong(0));
2271 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2272 PyTuple_SetItem(ret,0,ret0);
2276 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2282 class DataArrayDoubleTuple;
2284 class DataArrayDoubleIterator
2287 DataArrayDoubleIterator(DataArrayDouble *da);
2288 ~DataArrayDoubleIterator();
2293 DataArrayDoubleTuple *ret=self->nextt();
2295 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2298 PyErr_SetString(PyExc_StopIteration,"No more data.");
2305 class DataArrayDoubleTuple
2308 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2309 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2312 std::string __str__() const throw(INTERP_KERNEL::Exception)
2314 return self->repr();
2317 double __float__() const throw(INTERP_KERNEL::Exception)
2319 return self->doubleValue();
2322 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2324 return self->buildDADouble(1,self->getNumberOfCompo());
2327 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2329 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2330 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2331 Py_XINCREF(trueSelf);
2335 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2337 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2338 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2339 Py_XINCREF(trueSelf);
2343 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2345 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2346 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2347 Py_XINCREF(trueSelf);
2351 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2353 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2354 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2355 Py_XINCREF(trueSelf);
2359 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2361 return PyInt_FromLong(self->getNumberOfCompo());
2364 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2366 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2369 std::vector<int> multiVal;
2370 std::pair<int, std::pair<int,int> > slic;
2371 MEDCoupling::DataArrayInt *daIntTyypp=0;
2372 const double *pt=self->getConstPointer();
2373 int nbc=self->getNumberOfCompo();
2374 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2381 std::ostringstream oss;
2382 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2383 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2387 return PyFloat_FromDouble(pt[singleVal]);
2391 return PyFloat_FromDouble(pt[nbc+singleVal]);
2394 std::ostringstream oss;
2395 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2396 throw INTERP_KERNEL::Exception(oss.str().c_str());
2402 PyObject *t=PyTuple_New(multiVal.size());
2403 for(int j=0;j<(int)multiVal.size();j++)
2405 int cid=multiVal[j];
2408 std::ostringstream oss;
2409 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2410 throw INTERP_KERNEL::Exception(oss.str().c_str());
2412 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2418 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2419 PyObject *t=PyTuple_New(sz);
2420 for(int j=0;j<sz;j++)
2421 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2425 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2429 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2431 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2432 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2435 std::vector<double> multiValV;
2436 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2437 int nbc=self->getNumberOfCompo();
2438 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2440 std::vector<int> multiVal;
2441 std::pair<int, std::pair<int,int> > slic;
2442 MEDCoupling::DataArrayInt *daIntTyypp=0;
2443 double *pt=self->getPointer();
2444 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2451 std::ostringstream oss;
2452 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2453 throw INTERP_KERNEL::Exception(oss.str().c_str());
2459 pt[singleVal]=singleValV;
2464 if(multiValV.size()!=1)
2466 std::ostringstream oss;
2467 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2468 throw INTERP_KERNEL::Exception(oss.str().c_str());
2470 pt[singleVal]=multiValV[0];
2475 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2479 throw INTERP_KERNEL::Exception(msg);
2488 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2492 std::ostringstream oss;
2493 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2494 throw INTERP_KERNEL::Exception(oss.str().c_str());
2502 if(multiVal.size()!=multiValV.size())
2504 std::ostringstream oss;
2505 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2506 throw INTERP_KERNEL::Exception(oss.str().c_str());
2508 for(int i=0;i<(int)multiVal.size();i++)
2510 int pos=multiVal[i];
2513 std::ostringstream oss;
2514 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2515 throw INTERP_KERNEL::Exception(oss.str().c_str());
2517 pt[multiVal[i]]=multiValV[i];
2523 const double *ptV=daIntTyyppV->getConstPointer();
2524 if(nbc>daIntTyyppV->getNumberOfCompo())
2526 std::ostringstream oss;
2527 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2528 throw INTERP_KERNEL::Exception(oss.str().c_str());
2530 std::copy(ptV,ptV+nbc,pt);
2534 throw INTERP_KERNEL::Exception(msg);
2539 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2544 for(int j=0;j<sz;j++)
2545 pt[slic.first+j*slic.second.second]=singleValV;
2550 if(sz!=(int)multiValV.size())
2552 std::ostringstream oss;
2553 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2554 throw INTERP_KERNEL::Exception(oss.str().c_str());
2556 for(int j=0;j<sz;j++)
2557 pt[slic.first+j*slic.second.second]=multiValV[j];
2562 const double *ptV=daIntTyyppV->getConstPointer();
2563 if(sz>daIntTyyppV->getNumberOfCompo())
2565 std::ostringstream oss;
2566 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2567 throw INTERP_KERNEL::Exception(oss.str().c_str());
2569 for(int j=0;j<sz;j++)
2570 pt[slic.first+j*slic.second.second]=ptV[j];
2574 throw INTERP_KERNEL::Exception(msg);
2578 throw INTERP_KERNEL::Exception(msg);
2584 class DataArrayIntIterator;
2586 class DataArrayInt : public DataArray
2589 static DataArrayInt *New();
2590 int intValue() const throw(INTERP_KERNEL::Exception);
2591 int getHashCode() const throw(INTERP_KERNEL::Exception);
2592 bool empty() const throw(INTERP_KERNEL::Exception);
2593 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2594 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2595 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2596 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2597 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2598 int popBackSilent() throw(INTERP_KERNEL::Exception);
2599 void pack() const throw(INTERP_KERNEL::Exception);
2600 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2601 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2602 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2603 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2604 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2605 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2606 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2607 void reverse() throw(INTERP_KERNEL::Exception);
2608 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2609 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2610 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2611 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2612 void fillWithZero() throw(INTERP_KERNEL::Exception);
2613 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2614 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2615 std::string repr() const throw(INTERP_KERNEL::Exception);
2616 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2617 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2618 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2619 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2620 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2621 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2622 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2623 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2624 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2625 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2626 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2627 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2628 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2629 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2630 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2631 void transpose() throw(INTERP_KERNEL::Exception);
2632 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2633 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2634 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2635 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2636 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2637 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2638 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2639 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2640 int front() const throw(INTERP_KERNEL::Exception);
2641 int back() const throw(INTERP_KERNEL::Exception);
2642 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2643 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2644 int *getPointer() throw(INTERP_KERNEL::Exception);
2645 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2646 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2647 const int *begin() const throw(INTERP_KERNEL::Exception);
2648 const int *end() const throw(INTERP_KERNEL::Exception);
2649 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2650 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2651 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2652 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2653 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2654 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2655 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2656 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2657 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2658 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2659 int count(int value) const throw(INTERP_KERNEL::Exception);
2660 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2661 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2662 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2663 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2664 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2665 void abs() throw(INTERP_KERNEL::Exception);
2666 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2667 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2668 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2669 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2670 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2671 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2672 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2673 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2674 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2675 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2676 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2677 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2678 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2679 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2680 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2681 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2682 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2683 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2684 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2685 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2686 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2688 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2689 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2690 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2691 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2692 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2693 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2694 void computeOffsets() throw(INTERP_KERNEL::Exception);
2695 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2696 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2697 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2698 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2699 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2700 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2701 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2702 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2703 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2704 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2705 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2706 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2707 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2708 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2709 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2710 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2711 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2712 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2713 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2715 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2718 DataArrayInt() throw(INTERP_KERNEL::Exception)
2720 return DataArrayInt::New();
2723 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2725 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)";
2726 std::string msg(msgBase);
2728 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2731 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2735 if(PyInt_Check(nbOfTuples))
2737 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2739 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2742 if(PyInt_Check(nbOfComp))
2743 {//DataArrayInt.New([1,3,4,5],2,2)
2744 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2746 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2747 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2748 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2749 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2753 throw INTERP_KERNEL::Exception(msg.c_str());
2756 {//DataArrayInt.New([1,3,4],3)
2757 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2759 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2760 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2765 throw INTERP_KERNEL::Exception(msg.c_str());
2768 {// DataArrayInt.New([1,3,4])
2769 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2770 int tmpp1=-1,tmpp2=-1;
2771 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2772 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2776 else if(PyInt_Check(elt0))
2778 int nbOfTuples1=PyInt_AS_LONG(elt0);
2780 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2785 if(PyInt_Check(nbOfTuples))
2786 {//DataArrayInt.New(5,2)
2787 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2789 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2790 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2791 ret->alloc(nbOfTuples1,nbOfCompo);
2795 throw INTERP_KERNEL::Exception(msg.c_str());
2798 throw INTERP_KERNEL::Exception(msg.c_str());
2801 {//DataArrayInt.New(5)
2802 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2803 ret->alloc(nbOfTuples1,1);
2808 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2809 {//DataArrayInt.New(numpyArray)
2810 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2814 throw INTERP_KERNEL::Exception(msg.c_str());
2815 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2818 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2820 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2823 std::string __str__() const throw(INTERP_KERNEL::Exception)
2825 return self->reprNotTooLong();
2828 int __len__() const throw(INTERP_KERNEL::Exception)
2830 if(self->isAllocated())
2832 return self->getNumberOfTuples();
2836 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2840 int __int__() const throw(INTERP_KERNEL::Exception)
2842 return self->intValue();
2845 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2847 return self->iterator();
2850 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2852 int sz=self->getNumberOfComponents();
2853 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2854 self->accumulate(tmp);
2855 return convertIntArrToPyList(tmp,sz);
2858 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2861 std::vector<int> val2;
2862 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2863 return self->accumulatePerChunck(bg,bg+sz);
2866 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2869 std::vector<int> val2;
2870 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2871 return self->findIdsEqualTuple(bg,bg+sz);
2874 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2876 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2877 PyObject *ret=PyList_New(slcs.size());
2878 for(std::size_t i=0;i<slcs.size();i++)
2879 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2883 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2885 if(!PySlice_Check(slic))
2886 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2887 Py_ssize_t strt=2,stp=2,step=2;
2888 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2889 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2890 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2891 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 !");
2892 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2895 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2898 self->getMinMaxValues(a,b);
2899 PyObject *ret=PyTuple_New(2);
2900 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2901 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2905 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2907 int newNbOfTuples=-1;
2908 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2909 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2910 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2911 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2912 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2913 PyObject *ret=PyTuple_New(2);
2914 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2915 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2919 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2921 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2922 int szArr,sw,iTypppArr;
2923 std::vector<int> stdvecTyyppArr;
2924 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2925 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2926 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2930 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2932 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 !";
2933 if(PyList_Check(li) || PyTuple_Check(li))
2937 if(PyInt_Check(nbOfTuples))
2939 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2941 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2944 if(PyInt_Check(nbOfComp))
2945 {//DataArrayInt.setValues([1,3,4,5],2,2)
2946 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2948 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2949 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2950 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2953 throw INTERP_KERNEL::Exception(msg);
2956 {//DataArrayInt.setValues([1,3,4],3)
2958 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2959 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2963 throw INTERP_KERNEL::Exception(msg);
2966 {// DataArrayInt.setValues([1,3,4])
2967 int tmpp1=-1,tmpp2=-1;
2968 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2969 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2973 throw INTERP_KERNEL::Exception(msg);
2976 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2978 const int *vals=self->getConstPointer();
2979 return convertIntArrToPyList(vals,self->getNbOfElems());
2983 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2985 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2989 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2992 bool ret0=self->isEqualIfNotWhy(other,ret1);
2993 PyObject *ret=PyTuple_New(2);
2994 PyObject *ret0Py=ret0?Py_True:Py_False;
2996 PyTuple_SetItem(ret,0,ret0Py);
2997 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3001 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3003 const int *vals=self->getConstPointer();
3004 int nbOfComp=self->getNumberOfComponents();
3005 int nbOfTuples=self->getNumberOfTuples();
3006 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3009 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3011 std::vector<const DataArrayInt *> groups;
3012 std::vector< std::vector<int> > fidsOfGroups;
3013 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3014 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3015 PyObject *ret = PyList_New(2);
3016 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3017 int sz=fidsOfGroups.size();
3018 PyObject *ret1 = PyList_New(sz);
3019 for(int i=0;i<sz;i++)
3020 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3021 PyList_SetItem(ret,1,ret1);
3025 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3028 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3029 if (!SWIG_IsOK(res1))
3032 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3033 self->transformWithIndArr(tmp,tmp+size);
3037 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3038 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3042 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3046 std::vector<int> multiVal;
3047 std::pair<int, std::pair<int,int> > slic;
3048 MEDCoupling::DataArrayInt *daIntTyypp=0;
3049 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3053 return self->findIdsEqualList(&singleVal,&singleVal+1);
3055 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3057 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3059 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3063 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3067 std::vector<int> multiVal;
3068 std::pair<int, std::pair<int,int> > slic;
3069 MEDCoupling::DataArrayInt *daIntTyypp=0;
3070 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3074 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3076 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3078 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3080 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3084 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3086 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3088 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3089 if (!SWIG_IsOK(res1))
3092 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3093 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3097 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3099 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3100 da2->checkAllocated();
3101 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3103 PyObject *ret = PyList_New(3);
3104 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3105 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3106 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3110 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3113 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3114 if (!SWIG_IsOK(res1))
3117 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3118 return self->transformWithIndArrR(tmp,tmp+size);
3122 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3123 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3127 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3130 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3131 if (!SWIG_IsOK(res1))
3134 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3135 if(size!=self->getNumberOfTuples())
3137 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3139 return self->renumberAndReduce(tmp,newNbOfTuple);
3143 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3145 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3146 da2->checkAllocated();
3147 int size=self->getNumberOfTuples();
3148 if(size!=self->getNumberOfTuples())
3150 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3152 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3156 DataArrayInt *renumber(PyObject *li) 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->renumber(tmp);
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->renumber(da2->getConstPointer());
3185 DataArrayInt *renumberR(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->renumberR(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->renumberR(da2->getConstPointer());
3214 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3216 std::vector<int> tmp;
3217 convertPyToNewIntArr3(li,tmp);
3218 self->setSelectedComponents(a,tmp);
3221 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3223 int sz=self->getNumberOfComponents();
3224 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3225 self->getTuple(tupleId,tmp);
3226 return convertIntArrToPyList(tmp,sz);
3229 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3231 DataArrayInt *arr=0;
3232 DataArrayInt *arrI=0;
3233 self->changeSurjectiveFormat(targetNb,arr,arrI);
3234 PyObject *res = PyList_New(2);
3235 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3236 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3240 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3242 std::vector<const DataArrayInt *> tmp;
3243 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3244 return DataArrayInt::Meld(tmp);
3247 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3249 std::vector<const DataArrayInt *> tmp;
3250 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3251 return DataArrayInt::Aggregate(tmp);
3254 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3256 std::vector<const DataArrayInt *> tmp;
3257 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3258 return DataArrayInt::AggregateIndexes(tmp);
3261 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3263 std::vector<const DataArrayInt *> tmp;
3264 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3265 return DataArrayInt::BuildUnion(tmp);
3268 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3270 std::vector<const DataArrayInt *> tmp;
3271 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3272 return DataArrayInt::BuildIntersection(tmp);
3275 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3278 int r1=self->getMaxValue(tmp);
3279 PyObject *ret=PyTuple_New(2);
3280 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3281 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3285 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3288 int r1=self->getMinValue(tmp);
3289 PyObject *ret=PyTuple_New(2);
3290 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3291 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3295 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3297 int nbOfCompo=self->getNumberOfComponents();
3302 if(PyInt_Check(obj))
3304 int val=(int)PyInt_AS_LONG(obj);
3305 return self->findIdFirstEqual(val);
3308 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3312 std::vector<int> arr;
3313 convertPyToNewIntArr3(obj,arr);
3314 return self->findIdFirstEqualTuple(arr);
3319 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3321 int nbOfCompo=self->getNumberOfComponents();
3328 if(PyInt_Check(obj))
3330 int val=(int)PyInt_AS_LONG(obj);
3331 return self->presenceOfValue(val);
3334 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3338 std::vector<int> arr;
3339 convertPyToNewIntArr3(obj,arr);
3340 return self->presenceOfTuple(arr);
3345 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3347 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3348 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3349 self->checkAllocated();
3350 int nbOfTuples=self->getNumberOfTuples();
3351 int nbOfComponents=self->getNumberOfComponents();
3353 std::vector<int> vt1,vc1;
3354 std::pair<int, std::pair<int,int> > pt1,pc1;
3355 DataArrayInt *dt1=0,*dc1=0;
3357 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3358 MCAuto<DataArrayInt> ret;
3363 if(nbOfComponents==1)
3364 return PyInt_FromLong(self->getIJSafe(it1,0));
3365 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3368 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3370 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3372 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3374 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3377 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3378 std::vector<int> v2(1,ic1);
3379 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3383 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3384 std::vector<int> v2(1,ic1);
3385 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3389 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3390 std::vector<int> v2(1,ic1);
3391 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3395 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3396 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3400 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3401 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3405 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3406 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3410 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3411 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3415 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3416 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3417 std::vector<int> v2(nbOfComp);
3418 for(int i=0;i<nbOfComp;i++)
3419 v2[i]=pc1.first+i*pc1.second.second;
3420 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3424 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3425 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3426 std::vector<int> v2(nbOfComp);
3427 for(int i=0;i<nbOfComp;i++)
3428 v2[i]=pc1.first+i*pc1.second.second;
3429 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3433 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3434 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3435 std::vector<int> v2(nbOfComp);
3436 for(int i=0;i<nbOfComp;i++)
3437 v2[i]=pc1.first+i*pc1.second.second;
3438 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3442 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3443 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3444 std::vector<int> v2(nbOfComp);
3445 for(int i=0;i<nbOfComp;i++)
3446 v2[i]=pc1.first+i*pc1.second.second;
3447 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3450 throw INTERP_KERNEL::Exception(msg);
3454 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3456 self->checkAllocated();
3457 const char msg[]="Unexpected situation in __setitem__ !";
3458 int nbOfTuples=self->getNumberOfTuples();
3459 int nbOfComponents=self->getNumberOfComponents();
3462 std::vector<int> v1;
3464 DataArrayIntTuple *dd1=0;
3465 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3467 std::vector<int> vt1,vc1;
3468 std::pair<int, std::pair<int,int> > pt1,pc1;
3469 DataArrayInt *dt1=0,*dc1=0;
3470 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3471 MCAuto<DataArrayInt> tmp;
3479 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3482 tmp=DataArrayInt::New();
3483 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3484 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3487 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3490 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3491 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3494 throw INTERP_KERNEL::Exception(msg);
3503 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3506 tmp=DataArrayInt::New();
3507 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3508 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3511 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3514 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3515 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3518 throw INTERP_KERNEL::Exception(msg);
3527 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3530 tmp=DataArrayInt::New();
3531 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3532 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3535 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3538 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3539 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3542 throw INTERP_KERNEL::Exception(msg);
3551 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3554 tmp=DataArrayInt::New();
3555 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3556 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3559 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3562 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3563 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3566 throw INTERP_KERNEL::Exception(msg);
3575 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3578 tmp=DataArrayInt::New();
3579 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3580 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3583 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3586 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3587 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3590 throw INTERP_KERNEL::Exception(msg);
3599 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3602 tmp=DataArrayInt::New();
3603 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3604 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3607 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3610 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3611 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3614 throw INTERP_KERNEL::Exception(msg);
3623 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3626 tmp=DataArrayInt::New();
3627 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3628 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3631 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3634 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3635 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3638 throw INTERP_KERNEL::Exception(msg);
3647 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3650 tmp=DataArrayInt::New();
3651 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3652 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3655 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3658 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3659 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3662 throw INTERP_KERNEL::Exception(msg);
3671 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3674 tmp=DataArrayInt::New();
3675 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3676 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3679 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3682 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3683 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3686 throw INTERP_KERNEL::Exception(msg);
3695 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3698 tmp=DataArrayInt::New();
3699 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3700 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3703 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3706 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3707 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3710 throw INTERP_KERNEL::Exception(msg);
3719 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3722 tmp=DataArrayInt::New();
3723 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3724 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3727 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3730 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3731 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3734 throw INTERP_KERNEL::Exception(msg);
3743 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3746 tmp=DataArrayInt::New();
3747 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3748 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3751 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3754 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3755 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3758 throw INTERP_KERNEL::Exception(msg);
3767 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3770 tmp=DataArrayInt::New();
3771 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3772 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3775 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3778 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3779 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3782 throw INTERP_KERNEL::Exception(msg);
3791 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3794 tmp=DataArrayInt::New();
3795 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3796 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3799 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3802 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3803 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3806 throw INTERP_KERNEL::Exception(msg);
3815 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3818 tmp=DataArrayInt::New();
3819 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3820 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3823 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3826 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3827 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3830 throw INTERP_KERNEL::Exception(msg);
3839 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3842 tmp=DataArrayInt::New();
3843 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3844 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3847 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3850 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3851 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3854 throw INTERP_KERNEL::Exception(msg);
3859 throw INTERP_KERNEL::Exception(msg);
3864 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3866 return self->negate();
3869 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3871 const char msg[]="Unexpected situation in __add__ !";
3874 std::vector<int> aa;
3875 DataArrayIntTuple *aaa;
3877 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3882 MCAuto<DataArrayInt> ret=self->deepCopy();
3883 ret->applyLin(1,val);
3888 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3889 return DataArrayInt::Add(self,aaaa);
3893 return DataArrayInt::Add(self,a);
3897 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3898 return DataArrayInt::Add(self,aaaa);
3901 throw INTERP_KERNEL::Exception(msg);
3905 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3907 const char msg[]="Unexpected situation in __radd__ !";
3910 std::vector<int> aa;
3911 DataArrayIntTuple *aaa;
3913 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3918 MCAuto<DataArrayInt> ret=self->deepCopy();
3919 ret->applyLin(1,val);
3924 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3925 return DataArrayInt::Add(self,aaaa);
3929 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3930 return DataArrayInt::Add(self,aaaa);
3933 throw INTERP_KERNEL::Exception(msg);
3937 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3939 const char msg[]="Unexpected situation in __iadd__ !";
3942 std::vector<int> aa;
3943 DataArrayIntTuple *aaa;
3945 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3950 self->applyLin(1,val);
3951 Py_XINCREF(trueSelf);
3956 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3958 Py_XINCREF(trueSelf);
3964 Py_XINCREF(trueSelf);
3969 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3970 self->addEqual(aaaa);
3971 Py_XINCREF(trueSelf);
3975 throw INTERP_KERNEL::Exception(msg);
3979 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3981 const char msg[]="Unexpected situation in __sub__ !";
3984 std::vector<int> aa;
3985 DataArrayIntTuple *aaa;
3987 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3992 MCAuto<DataArrayInt> ret=self->deepCopy();
3993 ret->applyLin(1,-val);
3998 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3999 return DataArrayInt::Substract(self,aaaa);
4003 return DataArrayInt::Substract(self,a);
4007 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4008 return DataArrayInt::Substract(self,aaaa);
4011 throw INTERP_KERNEL::Exception(msg);
4015 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4017 const char msg[]="Unexpected situation in __rsub__ !";
4020 std::vector<int> aa;
4021 DataArrayIntTuple *aaa;
4023 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4028 MCAuto<DataArrayInt> ret=self->deepCopy();
4029 ret->applyLin(-1,val);
4034 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4035 return DataArrayInt::Substract(aaaa,self);
4039 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4040 return DataArrayInt::Substract(aaaa,self);
4043 throw INTERP_KERNEL::Exception(msg);
4047 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4049 const char msg[]="Unexpected situation in __isub__ !";
4052 std::vector<int> aa;
4053 DataArrayIntTuple *aaa;
4055 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4060 self->applyLin(1,-val);
4061 Py_XINCREF(trueSelf);
4066 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4067 self->substractEqual(bb);
4068 Py_XINCREF(trueSelf);
4073 self->substractEqual(a);
4074 Py_XINCREF(trueSelf);
4079 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4080 self->substractEqual(aaaa);
4081 Py_XINCREF(trueSelf);
4085 throw INTERP_KERNEL::Exception(msg);
4089 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4091 const char msg[]="Unexpected situation in __mul__ !";
4094 std::vector<int> aa;
4095 DataArrayIntTuple *aaa;
4097 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4102 MCAuto<DataArrayInt> ret=self->deepCopy();
4103 ret->applyLin(val,0);
4108 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4109 return DataArrayInt::Multiply(self,aaaa);
4113 return DataArrayInt::Multiply(self,a);
4117 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4118 return DataArrayInt::Multiply(self,aaaa);
4121 throw INTERP_KERNEL::Exception(msg);
4125 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4127 const char msg[]="Unexpected situation in __rmul__ !";
4130 std::vector<int> aa;
4131 DataArrayIntTuple *aaa;
4133 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4138 MCAuto<DataArrayInt> ret=self->deepCopy();
4139 ret->applyLin(val,0);
4144 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4145 return DataArrayInt::Multiply(self,aaaa);
4149 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4150 return DataArrayInt::Multiply(self,aaaa);
4153 throw INTERP_KERNEL::Exception(msg);
4157 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4159 const char msg[]="Unexpected situation in __imul__ !";
4162 std::vector<int> aa;
4163 DataArrayIntTuple *aaa;
4165 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4170 self->applyLin(val,0);
4171 Py_XINCREF(trueSelf);
4176 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4177 self->multiplyEqual(bb);
4178 Py_XINCREF(trueSelf);
4183 self->multiplyEqual(a);
4184 Py_XINCREF(trueSelf);
4189 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4190 self->multiplyEqual(aaaa);
4191 Py_XINCREF(trueSelf);
4195 throw INTERP_KERNEL::Exception(msg);
4199 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4201 const char msg[]="Unexpected situation in __div__ !";
4204 std::vector<int> aa;
4205 DataArrayIntTuple *aaa;
4207 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4212 MCAuto<DataArrayInt> ret=self->deepCopy();
4213 ret->applyDivideBy(val);
4218 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4219 return DataArrayInt::Divide(self,aaaa);
4223 return DataArrayInt::Divide(self,a);
4227 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4228 return DataArrayInt::Divide(self,aaaa);
4231 throw INTERP_KERNEL::Exception(msg);
4235 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4237 const char msg[]="Unexpected situation in __rdiv__ !";
4240 std::vector<int> aa;
4241 DataArrayIntTuple *aaa;
4243 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4248 MCAuto<DataArrayInt> ret=self->deepCopy();
4254 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4255 return DataArrayInt::Divide(aaaa,self);
4259 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4260 return DataArrayInt::Divide(aaaa,self);
4263 throw INTERP_KERNEL::Exception(msg);
4267 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4269 const char msg[]="Unexpected situation in __idiv__ !";
4272 std::vector<int> aa;
4273 DataArrayIntTuple *aaa;
4275 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4280 self->applyDivideBy(val);
4281 Py_XINCREF(trueSelf);
4286 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4287 self->divideEqual(bb);
4288 Py_XINCREF(trueSelf);
4293 self->divideEqual(a);
4294 Py_XINCREF(trueSelf);
4299 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4300 self->divideEqual(aaaa);
4301 Py_XINCREF(trueSelf);
4305 throw INTERP_KERNEL::Exception(msg);
4309 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4311 const char msg[]="Unexpected situation in __mod__ !";
4314 std::vector<int> aa;
4315 DataArrayIntTuple *aaa;
4317 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4322 MCAuto<DataArrayInt> ret=self->deepCopy();
4323 ret->applyModulus(val);
4328 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4329 return DataArrayInt::Modulus(self,aaaa);
4333 return DataArrayInt::Modulus(self,a);
4337 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4338 return DataArrayInt::Modulus(self,aaaa);
4341 throw INTERP_KERNEL::Exception(msg);
4345 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4347 const char msg[]="Unexpected situation in __rmod__ !";
4350 std::vector<int> aa;
4351 DataArrayIntTuple *aaa;
4353 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4358 MCAuto<DataArrayInt> ret=self->deepCopy();
4359 ret->applyRModulus(val);
4364 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4365 return DataArrayInt::Modulus(aaaa,self);
4369 return DataArrayInt::Modulus(a,self);
4373 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4374 return DataArrayInt::Modulus(aaaa,self);
4377 throw INTERP_KERNEL::Exception(msg);
4381 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4383 const char msg[]="Unexpected situation in __imod__ !";
4386 std::vector<int> aa;
4387 DataArrayIntTuple *aaa;
4389 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4394 self->applyModulus(val);
4395 Py_XINCREF(trueSelf);
4400 self->modulusEqual(a);
4401 Py_XINCREF(trueSelf);
4406 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4407 self->modulusEqual(aaaa);
4408 Py_XINCREF(trueSelf);
4412 throw INTERP_KERNEL::Exception(msg);
4416 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4418 const char msg[]="Unexpected situation in __pow__ !";
4421 std::vector<int> aa;
4422 DataArrayIntTuple *aaa;
4424 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4429 MCAuto<DataArrayInt> ret=self->deepCopy();
4435 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4436 return DataArrayInt::Pow(self,aaaa);
4440 return DataArrayInt::Pow(self,a);
4444 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4445 return DataArrayInt::Pow(self,aaaa);
4448 throw INTERP_KERNEL::Exception(msg);
4452 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4454 const char msg[]="Unexpected situation in __rpow__ !";
4457 std::vector<int> aa;
4458 DataArrayIntTuple *aaa;
4460 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4465 MCAuto<DataArrayInt> ret=self->deepCopy();
4466 ret->applyRPow(val);
4471 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4472 return DataArrayInt::Pow(aaaa,self);
4476 return DataArrayInt::Pow(a,self);
4480 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4481 return DataArrayInt::Pow(aaaa,self);
4484 throw INTERP_KERNEL::Exception(msg);
4488 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4490 const char msg[]="Unexpected situation in __ipow__ !";
4493 std::vector<int> aa;
4494 DataArrayIntTuple *aaa;
4496 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4501 self->applyPow(val);
4502 Py_XINCREF(trueSelf);
4508 Py_XINCREF(trueSelf);
4513 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4514 self->powEqual(aaaa);
4515 Py_XINCREF(trueSelf);
4519 throw INTERP_KERNEL::Exception(msg);
4523 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4525 std::ostringstream oss;
4526 self->reprQuickOverview(oss);
4530 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4532 int szArr,sw,iTypppArr;
4533 std::vector<int> stdvecTyyppArr;
4534 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4535 self->pushBackValsSilent(tmp,tmp+szArr);
4538 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4540 std::vector<int> ret1;
4541 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4542 std::size_t sz=ret0.size();
4543 PyObject *pyRet=PyTuple_New(2);
4544 PyObject *pyRet0=PyList_New((int)sz);
4545 PyObject *pyRet1=PyList_New((int)sz);
4546 for(std::size_t i=0;i<sz;i++)
4548 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4549 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4551 PyTuple_SetItem(pyRet,0,pyRet0);
4552 PyTuple_SetItem(pyRet,1,pyRet1);
4556 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4558 DataArrayInt *ret0=0,*ret1=0;
4559 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4560 PyObject *pyRet=PyTuple_New(2);
4561 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4562 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4566 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4569 bool ret(self->isRange(a,b,c));
4570 PyObject *pyRet=PyTuple_New(2);
4571 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4573 PyTuple_SetItem(pyRet,0,ret0Py);
4575 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4581 PyTuple_SetItem(pyRet,1,ret1Py);
4586 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4588 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4589 if(!PyTuple_Check(args))
4590 throw INTERP_KERNEL::Exception(MSG);
4591 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4592 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4593 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4595 PyObject *tmp0(PyTuple_New(1));
4596 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4597 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4599 Py_DECREF(selfMeth);
4600 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4601 int sz(PyTuple_Size(args));
4603 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4604 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4605 PyObject *zeNumpyRepr(0);
4606 PyObject *tmp1(PyInt_FromLong(0));
4607 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4609 PyObject *tmp3(PyTuple_New(1));
4610 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4611 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4615 Py_DECREF(initMeth);
4619 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4622 if(!self->isAllocated())
4623 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4624 PyObject *ret(PyTuple_New(1));
4625 PyObject *ret0(PyDict_New());
4626 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4627 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4628 PyObject *tmp1(PyInt_FromLong(0));
4629 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4630 PyTuple_SetItem(ret,0,ret0);
4634 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4640 class DataArrayIntTuple;
4642 class DataArrayIntIterator
4645 DataArrayIntIterator(DataArrayInt *da);
4646 ~DataArrayIntIterator();
4651 DataArrayIntTuple *ret=self->nextt();
4653 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4656 PyErr_SetString(PyExc_StopIteration,"No more data.");
4663 class DataArrayIntTuple
4666 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4667 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4670 std::string __str__() const throw(INTERP_KERNEL::Exception)
4672 return self->repr();
4675 int __int__() const throw(INTERP_KERNEL::Exception)
4677 return self->intValue();
4680 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4682 return self->buildDAInt(1,self->getNumberOfCompo());
4685 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4687 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4688 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4689 Py_XINCREF(trueSelf);
4693 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4695 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4696 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4697 Py_XINCREF(trueSelf);
4701 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4703 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4704 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4705 Py_XINCREF(trueSelf);
4709 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4711 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4712 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4713 Py_XINCREF(trueSelf);
4717 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4719 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4720 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4721 Py_XINCREF(trueSelf);
4725 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4727 return PyInt_FromLong(self->getNumberOfCompo());
4730 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4732 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4735 std::vector<int> multiVal;
4736 std::pair<int, std::pair<int,int> > slic;
4737 MEDCoupling::DataArrayInt *daIntTyypp=0;
4738 const int *pt=self->getConstPointer();
4739 int nbc=self->getNumberOfCompo();
4740 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4747 std::ostringstream oss;
4748 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4749 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4753 return PyInt_FromLong(pt[singleVal]);
4757 return PyInt_FromLong(pt[nbc+singleVal]);
4760 std::ostringstream oss;
4761 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4762 throw INTERP_KERNEL::Exception(oss.str().c_str());
4768 PyObject *t=PyTuple_New(multiVal.size());
4769 for(int j=0;j<(int)multiVal.size();j++)
4771 int cid=multiVal[j];
4774 std::ostringstream oss;
4775 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4776 throw INTERP_KERNEL::Exception(oss.str().c_str());
4778 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4784 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4785 PyObject *t=PyTuple_New(sz);
4786 for(int j=0;j<sz;j++)
4787 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4791 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4795 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4797 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4798 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4801 std::vector<int> multiValV;
4802 std::pair<int, std::pair<int,int> > slicV;
4803 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4804 int nbc=self->getNumberOfCompo();
4805 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4807 std::vector<int> multiVal;
4808 std::pair<int, std::pair<int,int> > slic;
4809 MEDCoupling::DataArrayInt *daIntTyypp=0;
4810 int *pt=self->getPointer();
4811 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4818 std::ostringstream oss;
4819 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4820 throw INTERP_KERNEL::Exception(oss.str().c_str());
4826 pt[singleVal]=singleValV;
4831 if(multiValV.size()!=1)
4833 std::ostringstream oss;
4834 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4835 throw INTERP_KERNEL::Exception(oss.str().c_str());
4837 pt[singleVal]=multiValV[0];
4842 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4846 throw INTERP_KERNEL::Exception(msg);
4855 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4859 std::ostringstream oss;
4860 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4861 throw INTERP_KERNEL::Exception(oss.str().c_str());
4869 if(multiVal.size()!=multiValV.size())
4871 std::ostringstream oss;
4872 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4873 throw INTERP_KERNEL::Exception(oss.str().c_str());
4875 for(int i=0;i<(int)multiVal.size();i++)
4877 int pos=multiVal[i];
4880 std::ostringstream oss;
4881 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4882 throw INTERP_KERNEL::Exception(oss.str().c_str());
4884 pt[multiVal[i]]=multiValV[i];
4890 const int *ptV=daIntTyyppV->getConstPointer();
4891 if(nbc>daIntTyyppV->getNumberOfCompo())
4893 std::ostringstream oss;
4894 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4895 throw INTERP_KERNEL::Exception(oss.str().c_str());
4897 std::copy(ptV,ptV+nbc,pt);
4901 throw INTERP_KERNEL::Exception(msg);
4906 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4911 for(int j=0;j<sz;j++)
4912 pt[slic.first+j*slic.second.second]=singleValV;
4917 if(sz!=(int)multiValV.size())
4919 std::ostringstream oss;
4920 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4921 throw INTERP_KERNEL::Exception(oss.str().c_str());
4923 for(int j=0;j<sz;j++)
4924 pt[slic.first+j*slic.second.second]=multiValV[j];
4929 const int *ptV=daIntTyyppV->getConstPointer();
4930 if(sz>daIntTyyppV->getNumberOfCompo())
4932 std::ostringstream oss;
4933 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4934 throw INTERP_KERNEL::Exception(oss.str().c_str());
4936 for(int j=0;j<sz;j++)
4937 pt[slic.first+j*slic.second.second]=ptV[j];
4941 throw INTERP_KERNEL::Exception(msg);
4945 throw INTERP_KERNEL::Exception(msg);
4951 class DataArrayChar : public DataArray
4954 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4955 int getHashCode() const throw(INTERP_KERNEL::Exception);
4956 bool empty() const throw(INTERP_KERNEL::Exception);
4957 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4958 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4959 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4960 char popBackSilent() throw(INTERP_KERNEL::Exception);
4961 void pack() const throw(INTERP_KERNEL::Exception);
4962 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4963 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4964 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4965 void reverse() throw(INTERP_KERNEL::Exception);
4966 void fillWithZero() throw(INTERP_KERNEL::Exception);
4967 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4968 std::string repr() const throw(INTERP_KERNEL::Exception);
4969 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4970 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4971 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4972 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4973 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4974 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4975 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4976 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4977 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4978 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4979 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4980 char front() const throw(INTERP_KERNEL::Exception);
4981 char back() const throw(INTERP_KERNEL::Exception);
4982 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4983 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4984 char *getPointer() throw(INTERP_KERNEL::Exception);
4985 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4986 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4987 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4988 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4989 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4990 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4991 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4992 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4993 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4994 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4995 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4998 int __len__() const throw(INTERP_KERNEL::Exception)
5000 if(self->isAllocated())
5002 return self->getNumberOfTuples();
5006 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5010 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5013 bool ret0=self->isEqualIfNotWhy(other,ret1);
5014 PyObject *ret=PyTuple_New(2);
5015 PyObject *ret0Py=ret0?Py_True:Py_False;
5017 PyTuple_SetItem(ret,0,ret0Py);
5018 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5022 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5025 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5026 if (!SWIG_IsOK(res1))
5029 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5030 if(size!=self->getNumberOfTuples())
5032 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5034 return self->renumber(tmp);
5038 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5040 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5041 da2->checkAllocated();
5042 int size=self->getNumberOfTuples();
5043 if(size!=self->getNumberOfTuples())
5045 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5047 return self->renumber(da2->getConstPointer());
5051 DataArrayChar *renumberR(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->renumberR(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->renumberR(da2->getConstPointer());
5080 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) 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->renumberAndReduce(tmp,newNbOfTuple);
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->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5109 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5111 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5112 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5113 return DataArrayChar::Aggregate(tmp);
5116 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5118 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5119 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5120 return DataArrayChar::Meld(tmp);
5125 class DataArrayByteIterator;
5127 class DataArrayByte : public DataArrayChar
5130 static DataArrayByte *New();
5131 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5132 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5133 char byteValue() const throw(INTERP_KERNEL::Exception);
5136 DataArrayByte() throw(INTERP_KERNEL::Exception)
5138 return DataArrayByte::New();
5141 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5143 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) !";
5144 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5148 if(PyInt_Check(nbOfTuples))
5150 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5152 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5155 if(PyInt_Check(nbOfComp))
5156 {//DataArrayByte.New([1,3,4,5],2,2)
5157 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5159 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5160 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5161 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5162 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5166 throw INTERP_KERNEL::Exception(msg);
5169 {//DataArrayByte.New([1,3,4],3)
5170 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5172 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5173 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5178 throw INTERP_KERNEL::Exception(msg);
5181 {// DataArrayByte.New([1,3,4])
5182 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5183 int tmpp1=-1,tmpp2=-1;
5184 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5185 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5189 else if(PyInt_Check(elt0))
5191 int nbOfTuples1=PyInt_AS_LONG(elt0);
5193 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5198 if(PyInt_Check(nbOfTuples))
5199 {//DataArrayByte.New(5,2)
5200 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5202 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5203 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5204 ret->alloc(nbOfTuples1,nbOfCompo);
5208 throw INTERP_KERNEL::Exception(msg);
5211 throw INTERP_KERNEL::Exception(msg);
5214 {//DataArrayByte.New(5)
5215 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5216 ret->alloc(nbOfTuples1,1);
5221 throw INTERP_KERNEL::Exception(msg);
5224 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5226 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5229 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5231 std::ostringstream oss;
5232 self->reprQuickOverview(oss);
5236 int __int__() const throw(INTERP_KERNEL::Exception)
5238 return (int) self->byteValue();
5241 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5243 return self->iterator();
5246 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5248 return (int)self->getIJ(tupleId,compoId);
5251 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5253 return (int)self->getIJSafe(tupleId,compoId);
5256 std::string __str__() const throw(INTERP_KERNEL::Exception)
5258 return self->repr();
5261 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5263 const char *vals=self->getConstPointer();
5264 int nbOfComp=self->getNumberOfComponents();
5265 int nbOfTuples=self->getNumberOfTuples();
5266 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5269 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5272 int ival=-1; std::vector<int> ivval;
5273 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5274 std::vector<char> vals(sz);
5275 std::copy(pt,pt+sz,vals.begin());
5276 return self->presenceOfTuple(vals);
5279 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5282 int ival=-1; std::vector<int> ivval;
5283 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5284 std::vector<char> vals2(sz);
5285 std::copy(pt,pt+sz,vals2.begin());
5286 return self->presenceOfValue(vals2);
5289 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5292 int ival=-1; std::vector<int> ivval;
5293 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5294 std::vector<char> vals2(sz);
5295 std::copy(pt,pt+sz,vals2.begin());
5296 return self->findIdFirstEqual(vals2);
5299 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5302 int ival=-1; std::vector<int> ivval;
5303 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5304 std::vector<char> vals(sz);
5305 std::copy(pt,pt+sz,vals.begin());
5306 return self->findIdFirstEqualTuple(vals);
5309 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5312 int ival=-1; std::vector<int> ivval;
5313 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5314 std::vector<char> vals(sz);
5315 std::copy(pt,pt+sz,vals.begin());
5316 return self->findIdSequence(vals);
5319 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5321 int sz=self->getNumberOfComponents();
5322 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5323 self->getTuple(tupleId,tmp);
5324 PyObject *ret=PyTuple_New(sz);
5325 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5329 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5332 int r1=(int)self->getMaxValue(tmp);
5333 PyObject *ret=PyTuple_New(2);
5334 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5335 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5339 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5342 int r1=(int)self->getMinValue(tmp);
5343 PyObject *ret=PyTuple_New(2);
5344 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5345 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5349 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5351 int nbOfCompo=self->getNumberOfComponents();
5356 if(PyInt_Check(obj))
5358 int val=(int)PyInt_AS_LONG(obj);
5359 return self->findIdFirstEqual(val);
5362 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5365 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5369 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5371 int nbOfCompo=self->getNumberOfComponents();
5378 if(PyInt_Check(obj))
5380 int val=(int)PyInt_AS_LONG(obj);
5381 return self->presenceOfValue(val);
5384 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5387 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5391 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5393 self->checkAllocated();
5394 const char msg[]="Unexpected situation in __setitem__ !";
5395 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5398 std::vector<int> v1;
5400 DataArrayIntTuple *dd1=0;
5401 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5403 std::vector<int> vt1,vc1;
5404 std::pair<int, std::pair<int,int> > pt1,pc1;
5405 DataArrayInt *dt1=0,*dc1=0;
5406 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5407 MCAuto<DataArrayInt> tmp;
5415 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5418 throw INTERP_KERNEL::Exception(msg);
5427 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5430 throw INTERP_KERNEL::Exception(msg);
5439 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5442 throw INTERP_KERNEL::Exception(msg);
5451 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5454 throw INTERP_KERNEL::Exception(msg);
5463 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5466 throw INTERP_KERNEL::Exception(msg);
5475 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5478 throw INTERP_KERNEL::Exception(msg);
5487 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5490 throw INTERP_KERNEL::Exception(msg);
5499 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5502 throw INTERP_KERNEL::Exception(msg);
5511 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5514 throw INTERP_KERNEL::Exception(msg);
5523 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5526 throw INTERP_KERNEL::Exception(msg);
5535 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5538 throw INTERP_KERNEL::Exception(msg);
5547 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5550 throw INTERP_KERNEL::Exception(msg);
5559 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5562 throw INTERP_KERNEL::Exception(msg);
5571 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5574 throw INTERP_KERNEL::Exception(msg);
5583 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5586 throw INTERP_KERNEL::Exception(msg);
5595 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5598 throw INTERP_KERNEL::Exception(msg);
5603 throw INTERP_KERNEL::Exception(msg);
5610 class DataArrayByteTuple;
5612 class DataArrayByteIterator
5615 DataArrayByteIterator(DataArrayByte *da);
5616 ~DataArrayByteIterator();
5619 class DataArrayByteTuple
5622 std::string repr() const throw(INTERP_KERNEL::Exception);
5623 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5626 std::string __str__() const throw(INTERP_KERNEL::Exception)
5628 return self->repr();
5631 char __int__() const throw(INTERP_KERNEL::Exception)
5633 return self->byteValue();
5636 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5638 return self->buildDAByte(1,self->getNumberOfCompo());
5643 class DataArrayAsciiCharIterator;
5645 class DataArrayAsciiChar : public DataArrayChar
5648 static DataArrayAsciiChar *New();
5649 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5650 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5651 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5654 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5656 return DataArrayAsciiChar::New();
5659 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5661 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) !";
5662 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5666 if(PyInt_Check(nbOfTuples))
5668 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5670 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5673 if(PyInt_Check(nbOfComp))
5674 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5675 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5677 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5678 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5679 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5680 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5684 throw INTERP_KERNEL::Exception(msg);
5687 {//DataArrayAsciiChar.New([1,3,4],3)
5688 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5690 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5691 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5695 else if(PyString_Check(nbOfTuples))
5697 if(PyString_Size(nbOfTuples)!=1)
5698 throw INTERP_KERNEL::Exception(msg);
5699 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5700 std::vector<std::string> tmp;
5701 if(fillStringVector(elt0,tmp))
5702 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5704 throw INTERP_KERNEL::Exception(msg);
5707 throw INTERP_KERNEL::Exception(msg);
5711 std::vector<std::string> tmmp;
5712 if(fillStringVector(elt0,tmmp))
5713 //DataArrayAsciiChar.New(["abc","de","fghi"])
5714 return DataArrayAsciiChar::New(tmmp,' ');
5717 // DataArrayAsciiChar.New([1,3,4])
5718 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5719 int tmpp1=-1,tmpp2=-1;
5720 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5721 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5726 else if(PyInt_Check(elt0))
5728 int nbOfTuples1=PyInt_AS_LONG(elt0);
5730 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5735 if(PyInt_Check(nbOfTuples))
5736 {//DataArrayAsciiChar.New(5,2)
5737 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5739 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5740 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5741 ret->alloc(nbOfTuples1,nbOfCompo);
5745 throw INTERP_KERNEL::Exception(msg);
5748 throw INTERP_KERNEL::Exception(msg);
5751 {//DataArrayAsciiChar.New(5)
5752 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5753 ret->alloc(nbOfTuples1,1);
5758 throw INTERP_KERNEL::Exception(msg);
5761 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5763 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5766 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5768 std::ostringstream oss;
5769 self->reprQuickOverview(oss);
5773 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5775 return self->iterator();
5778 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5780 char tmp[2]; tmp[1]='\0';
5781 tmp[0]=self->getIJ(tupleId,compoId);
5782 return std::string(tmp);
5785 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5787 char tmp[2]; tmp[1]='\0';
5788 tmp[0]=self->getIJSafe(tupleId,compoId);
5789 return std::string(tmp);
5792 std::string __str__() const throw(INTERP_KERNEL::Exception)
5794 return self->repr();
5797 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5799 const char *vals=self->getConstPointer();
5800 int nbOfComp=self->getNumberOfComponents();
5801 int nbOfTuples=self->getNumberOfTuples();
5802 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5805 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5807 if(PyString_Check(tupl))
5809 Py_ssize_t sz=PyString_Size(tupl);
5810 std::vector<char> vals(sz);
5811 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5812 return self->presenceOfTuple(vals);
5815 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5818 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5820 if(PyString_Check(vals))
5822 Py_ssize_t sz=PyString_Size(vals);
5823 std::vector<char> vals2(sz);
5824 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5825 return self->presenceOfValue(vals2);
5828 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5831 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5833 if(PyString_Check(vals))
5835 Py_ssize_t sz=PyString_Size(vals);
5836 std::vector<char> vals2(sz);
5837 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5838 return self->findIdFirstEqual(vals2);
5841 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5844 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5846 if(PyString_Check(tupl))
5848 Py_ssize_t sz=PyString_Size(tupl);
5849 std::vector<char> vals(sz);
5850 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5851 return self->findIdFirstEqualTuple(vals);
5854 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5857 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5859 if(PyString_Check(strOrListOfInt))
5861 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5862 std::vector<char> vals(sz);
5863 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5864 return self->findIdSequence(vals);
5867 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5870 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5872 int sz=self->getNumberOfComponents();
5873 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5874 self->getTuple(tupleId,tmp);
5875 return PyString_FromString(tmp);
5878 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5881 char tmp2[2]; tmp2[1]='\0';
5882 tmp2[0]=self->getMaxValue(tmp);
5883 PyObject *ret=PyTuple_New(2);
5884 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5885 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5889 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5892 char tmp2[2]; tmp2[1]='\0';
5893 tmp2[0]=self->getMinValue(tmp);
5894 PyObject *ret=PyTuple_New(2);
5895 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5896 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5900 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5902 int nbOfCompo=self->getNumberOfComponents();
5907 if(PyString_Check(obj))
5909 Py_ssize_t sz=PyString_Size(obj);
5910 char *pt=PyString_AsString(obj);
5912 return self->findIdFirstEqual(pt[0]);
5914 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5917 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5920 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5924 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5926 int nbOfCompo=self->getNumberOfComponents();
5933 if(PyString_Check(obj))
5935 Py_ssize_t sz=PyString_Size(obj);
5936 char *pt=PyString_AsString(obj);
5938 return self->presenceOfValue(pt[0]);
5940 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5943 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5946 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5950 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5953 std::vector<int> stdvecTyyppArr;
5954 std::pair<int, std::pair<int,int> > sTyyppArr;
5955 MEDCoupling::DataArrayInt *daIntTyypp=0;
5956 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5960 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5962 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5964 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5966 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5968 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5972 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5974 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.";
5976 std::vector<int> stdvecTyyppArr;
5977 std::pair<int, std::pair<int,int> > sTyyppArr;
5978 MEDCoupling::DataArrayInt *daIntTyypp=0;
5979 int nbOfCompo=self->getNumberOfComponents();
5980 int nbOfTuples=self->getNumberOfTuples();
5981 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5983 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5984 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5993 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5999 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6000 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6003 //value vector<string>
6006 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6007 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6010 //value DataArrayChar
6013 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6017 throw INTERP_KERNEL::Exception(msg);
6021 {//obj list-tuple[int]
6027 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6033 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6034 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6037 //value vector<string>
6040 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6041 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6044 //value DataArrayChar
6047 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6051 throw INTERP_KERNEL::Exception(msg);
6062 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6068 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6069 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6072 //value vector<string>
6075 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6076 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6079 //value DataArrayChar
6082 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6086 throw INTERP_KERNEL::Exception(msg);
6097 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6103 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6104 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6107 //value vector<string>
6110 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6111 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6114 //value DataArrayChar
6117 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6121 throw INTERP_KERNEL::Exception(msg);
6126 throw INTERP_KERNEL::Exception(msg);
6132 class DataArrayAsciiCharTuple;
6134 class DataArrayAsciiCharIterator
6137 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6138 ~DataArrayAsciiCharIterator();
6143 DataArrayAsciiCharTuple *ret=self->nextt();
6145 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6148 PyErr_SetString(PyExc_StopIteration,"No more data.");
6155 class DataArrayAsciiCharTuple
6158 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6159 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6162 std::string __str__() const throw(INTERP_KERNEL::Exception)
6164 return self->repr();
6167 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6169 return self->buildDAAsciiChar(1,self->getNumberOfCompo());