1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject MEDCoupling::DataArray::deepCopy;
46 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
47 %newobject MEDCoupling::DataArray::selectByTupleRanges;
48 %newobject MEDCoupling::DataArray::selectByTupleId;
49 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
50 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
51 %newobject MEDCoupling::DataArray::Aggregate;
52 %newobject MEDCoupling::DataArrayInt::New;
53 %newobject MEDCoupling::DataArrayInt::__iter__;
54 %newobject MEDCoupling::DataArrayInt::convertToDblArr;
55 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
56 %newobject MEDCoupling::DataArrayInt::subArray;
57 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
58 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
59 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
60 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
61 %newobject MEDCoupling::DataArrayInt::renumber;
62 %newobject MEDCoupling::DataArrayInt::renumberR;
63 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
64 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
65 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
66 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
67 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
68 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
69 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
70 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
71 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
72 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
73 %newobject MEDCoupling::DataArrayInt::negate;
74 %newobject MEDCoupling::DataArrayInt::computeAbs;
75 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
76 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
77 %newobject MEDCoupling::DataArrayInt::findIdsStricltyNegative;
78 %newobject MEDCoupling::DataArrayInt::Aggregate;
79 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
80 %newobject MEDCoupling::DataArrayInt::Meld;
81 %newobject MEDCoupling::DataArrayInt::Add;
82 %newobject MEDCoupling::DataArrayInt::Substract;
83 %newobject MEDCoupling::DataArrayInt::Multiply;
84 %newobject MEDCoupling::DataArrayInt::Divide;
85 %newobject MEDCoupling::DataArrayInt::Pow;
86 %newobject MEDCoupling::DataArrayInt::BuildUnion;
87 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
88 %newobject MEDCoupling::DataArrayInt::Range;
89 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
90 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
91 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
92 %newobject MEDCoupling::DataArrayInt::buildComplement;
93 %newobject MEDCoupling::DataArrayInt::buildUnion;
94 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
95 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
96 %newobject MEDCoupling::DataArrayInt::buildIntersection;
97 %newobject MEDCoupling::DataArrayInt::buildUnique;
98 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
99 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
100 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
101 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
102 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
103 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
104 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
105 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
106 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
107 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
108 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
109 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
110 %newobject MEDCoupling::DataArrayInt::__neg__;
111 %newobject MEDCoupling::DataArrayInt::__add__;
112 %newobject MEDCoupling::DataArrayInt::__radd__;
113 %newobject MEDCoupling::DataArrayInt::__sub__;
114 %newobject MEDCoupling::DataArrayInt::__rsub__;
115 %newobject MEDCoupling::DataArrayInt::__mul__;
116 %newobject MEDCoupling::DataArrayInt::__rmul__;
117 %newobject MEDCoupling::DataArrayInt::__div__;
118 %newobject MEDCoupling::DataArrayInt::__rdiv__;
119 %newobject MEDCoupling::DataArrayInt::__mod__;
120 %newobject MEDCoupling::DataArrayInt::__rmod__;
121 %newobject MEDCoupling::DataArrayInt::__pow__;
122 %newobject MEDCoupling::DataArrayInt::__rpow__;
123 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
124 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
125 %newobject MEDCoupling::DataArrayChar::renumber;
126 %newobject MEDCoupling::DataArrayChar::renumberR;
127 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
128 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
129 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
130 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
131 %newobject MEDCoupling::DataArrayChar::Aggregate;
132 %newobject MEDCoupling::DataArrayChar::Meld;
133 %newobject MEDCoupling::DataArrayByte::New;
134 %newobject MEDCoupling::DataArrayByte::__iter__;
135 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
136 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
137 %newobject MEDCoupling::DataArrayChar::subArray;
138 %newobject MEDCoupling::DataArrayAsciiChar::New;
139 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
140 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
141 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
142 %newobject MEDCoupling::DataArrayDouble::New;
143 %newobject MEDCoupling::DataArrayDouble::__iter__;
144 %newobject MEDCoupling::DataArrayDouble::convertToIntArr;
145 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
146 %newobject MEDCoupling::DataArrayDouble::Aggregate;
147 %newobject MEDCoupling::DataArrayDouble::Meld;
148 %newobject MEDCoupling::DataArrayDouble::Dot;
149 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
150 %newobject MEDCoupling::DataArrayDouble::Add;
151 %newobject MEDCoupling::DataArrayDouble::Substract;
152 %newobject MEDCoupling::DataArrayDouble::Multiply;
153 %newobject MEDCoupling::DataArrayDouble::Divide;
154 %newobject MEDCoupling::DataArrayDouble::Pow;
155 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
156 %newobject MEDCoupling::DataArrayDouble::subArray;
157 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
158 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
159 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
160 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
161 %newobject MEDCoupling::DataArrayDouble::negate;
162 %newobject MEDCoupling::DataArrayDouble::computeAbs;
163 %newobject MEDCoupling::DataArrayDouble::applyFunc;
164 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
165 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
166 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
167 %newobject MEDCoupling::DataArrayDouble::determinant;
168 %newobject MEDCoupling::DataArrayDouble::eigenValues;
169 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
170 %newobject MEDCoupling::DataArrayDouble::inverse;
171 %newobject MEDCoupling::DataArrayDouble::trace;
172 %newobject MEDCoupling::DataArrayDouble::deviator;
173 %newobject MEDCoupling::DataArrayDouble::magnitude;
174 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
175 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
176 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
177 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
178 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
179 %newobject MEDCoupling::DataArrayDouble::renumber;
180 %newobject MEDCoupling::DataArrayDouble::renumberR;
181 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
182 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
183 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
184 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
185 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
186 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
187 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
188 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
189 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
190 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
191 %newobject MEDCoupling::DataArrayDouble::cartesianize;
192 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
193 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
194 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
195 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
196 %newobject MEDCoupling::DataArrayDouble::__neg__;
197 %newobject MEDCoupling::DataArrayDouble::__radd__;
198 %newobject MEDCoupling::DataArrayDouble::__rsub__;
199 %newobject MEDCoupling::DataArrayDouble::__rmul__;
200 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
201 %newobject MEDCoupling::DataArrayDouble::__pow__;
202 %newobject MEDCoupling::DataArrayDouble::__rpow__;
203 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
205 %feature("unref") DataArray "$this->decrRef();"
206 %feature("unref") DataArrayDouble "$this->decrRef();"
207 %feature("unref") DataArrayInt "$this->decrRef();"
208 %feature("unref") DataArrayChar "$this->decrRef();"
209 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
210 %feature("unref") DataArrayByte "$this->decrRef();"
212 namespace MEDCoupling
219 } MEDCouplingAxisType;
221 class DataArray : public RefCountObject, public TimeLabel
224 void setName(const std::string& name);
225 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
226 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
227 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
228 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
229 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
230 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
231 std::string getName() const;
232 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
233 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
234 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
235 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
236 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
237 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
238 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
239 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
240 int getNumberOfComponents() const;
241 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
242 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
243 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
244 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
245 virtual void desallocate() throw(INTERP_KERNEL::Exception);
246 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
247 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
248 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
249 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
250 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
251 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
252 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
253 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
254 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
255 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
256 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
257 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
258 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
259 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
260 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
261 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
262 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
263 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
264 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
265 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
266 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
267 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
268 void updateTime() const;
271 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
273 const std::vector<std::string>& comps=self->getInfoOnComponents();
274 PyObject *ret=PyList_New((int)comps.size());
275 for(int i=0;i<(int)comps.size();i++)
276 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
280 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
282 std::vector<int> tmp;
283 convertPyToNewIntArr3(li,tmp);
284 self->copyPartOfStringInfoFrom(other,tmp);
287 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
289 std::vector<int> tmp;
290 convertPyToNewIntArr3(li,tmp);
291 self->copyPartOfStringInfoFrom2(tmp,other);
294 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
297 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
298 if (!SWIG_IsOK(res1))
301 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
302 if(size!=self->getNumberOfTuples())
304 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
306 self->renumberInPlace(tmp);
310 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
312 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
313 da2->checkAllocated();
314 int size=self->getNumberOfTuples();
315 if(size!=self->getNumberOfTuples())
317 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
319 self->renumberInPlace(da2->getConstPointer());
323 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
326 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
327 if (!SWIG_IsOK(res1))
330 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
331 if(size!=self->getNumberOfTuples())
333 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
335 self->renumberInPlaceR(tmp);
339 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
341 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
342 da2->checkAllocated();
343 int size=self->getNumberOfTuples();
344 if(size!=self->getNumberOfTuples())
346 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
348 self->renumberInPlaceR(da2->getConstPointer());
352 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
353 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
355 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
356 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
357 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
358 DataArrayInt *tuplesSelecPtr2=0;
361 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
363 throw INTERP_KERNEL::Exception(msg);
365 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
368 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
370 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
371 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
374 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
376 std::vector<std::pair<int,int> > ranges;
377 convertPyToVectorPairInt(li,ranges);
378 return self->selectByTupleRanges(ranges);
381 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
384 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
385 if (!SWIG_IsOK(res1))
388 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
389 return self->selectByTupleId(tmp,tmp+size);
393 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
395 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
396 da2->checkAllocated();
397 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
401 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
404 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
405 if (!SWIG_IsOK(res1))
408 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
409 return self->selectByTupleIdSafe(tmp,tmp+size);
413 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
415 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
416 da2->checkAllocated();
417 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
421 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
423 std::vector<int> tmp;
424 convertPyToNewIntArr3(li,tmp);
425 DataArray *ret=self->keepSelectedComponents(tmp);
426 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
429 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
431 if(!PySlice_Check(slic))
432 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
433 Py_ssize_t strt=2,stp=2,step=2;
434 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
435 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
437 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
438 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
441 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
443 if(!PySlice_Check(slic))
444 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
445 Py_ssize_t strt=2,stp=2,step=2;
446 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
447 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
449 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
450 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
453 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
455 if(!PySlice_Check(slic))
456 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
457 Py_ssize_t strt=2,stp=2,step=2;
458 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
459 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
460 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
463 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
465 if(!PySlice_Check(slic))
466 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
467 Py_ssize_t strt=2,stp=2,step=2;
468 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
469 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
470 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
473 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
475 std::vector<const DataArray *> tmp;
476 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
477 return DataArray::Aggregate(tmp);
480 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
482 if(!PySlice_Check(slic))
483 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
484 Py_ssize_t strt=2,stp=2,step=2;
485 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
486 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
487 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
490 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
492 if(!PySlice_Check(slic))
493 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
494 Py_ssize_t strt=2,stp=2,step=2;
495 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
496 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
497 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
500 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
502 PyObject *ret(PyTuple_New(2));
503 std::string a0(self->getName());
504 const std::vector<std::string> &a1(self->getInfoOnComponents());
505 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
508 PyObject *ret1(PyList_New(sz));
509 for(int i=0;i<sz;i++)
510 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
511 PyTuple_SetItem(ret,1,ret1);
516 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
518 static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
519 if(!PyTuple_Check(inp))
520 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
521 int sz(PyTuple_Size(inp));
523 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
524 PyObject *a0(PyTuple_GetItem(inp,0));
525 if(!PyString_Check(a0))
526 throw INTERP_KERNEL::Exception(MSG);
527 PyObject *a1(PyTuple_GetItem(inp,1));
528 std::vector<std::string> a1cpp;
529 if(!fillStringVector(a1,a1cpp))
530 throw INTERP_KERNEL::Exception(MSG);
531 self->setName(PyString_AsString(a0));
532 self->setInfoOnComponents(a1cpp);
538 class DataArrayDoubleIterator;
540 class DataArrayDouble : public DataArray
543 static DataArrayDouble *New();
544 double doubleValue() const throw(INTERP_KERNEL::Exception);
545 bool empty() const throw(INTERP_KERNEL::Exception);
546 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
548 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
549 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
550 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
551 double popBackSilent() throw(INTERP_KERNEL::Exception);
552 void pack() const throw(INTERP_KERNEL::Exception);
553 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
554 void fillWithZero() throw(INTERP_KERNEL::Exception);
555 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
556 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
557 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
558 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
559 void reverse() throw(INTERP_KERNEL::Exception);
560 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
561 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
562 std::string repr() const throw(INTERP_KERNEL::Exception);
563 std::string reprZip() const throw(INTERP_KERNEL::Exception);
564 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
565 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
566 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
567 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
570 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
571 void transpose() throw(INTERP_KERNEL::Exception);
572 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
573 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
574 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
575 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
576 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
577 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
578 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
579 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
580 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
581 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
582 double front() const throw(INTERP_KERNEL::Exception);
583 double back() const throw(INTERP_KERNEL::Exception);
584 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
585 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
586 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
587 double *getPointer() throw(INTERP_KERNEL::Exception);
588 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
590 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
591 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
592 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
593 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
594 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
595 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
596 double getAverageValue() const throw(INTERP_KERNEL::Exception);
597 double norm2() const throw(INTERP_KERNEL::Exception);
598 double normMax() const throw(INTERP_KERNEL::Exception);
599 double normMin() const throw(INTERP_KERNEL::Exception);
600 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
605 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
606 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
608 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
609 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
610 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
611 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
612 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
613 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
617 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
620 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
621 void abs() throw(INTERP_KERNEL::Exception);
622 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
623 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
624 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
625 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
626 void applyPow(double val) throw(INTERP_KERNEL::Exception);
627 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
628 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
629 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
630 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
631 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
632 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
633 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
634 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
635 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
636 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
637 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
638 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
639 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
640 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
641 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
642 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
643 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
644 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
645 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
646 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
647 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
648 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
649 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
650 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
651 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
652 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
653 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
654 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
657 DataArrayDouble() throw(INTERP_KERNEL::Exception)
659 return DataArrayDouble::New();
662 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
664 const char *msgBase="MEDCoupling::DataArrayDouble::New : Available API are : \n-DataArrayDouble.New()\n-DataArrayDouble.New([1.,3.,4.])\n-DataArrayDouble.New([1.,3.,4.],3)\n-DataArrayDouble.New([1.,3.,4.,5.],2,2)\n-DataArrayDouble.New([1.,3.,4.,5.,7,8.],3,2)\n-DataArrayDouble.New([(1.,3.),(4.,5.),(7,8.)])\n-DataArrayDouble.New(5)\n-DataArrayDouble.New(5,2)";
665 std::string msg(msgBase);
667 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
670 if(PyList_Check(elt0) || PyTuple_Check(elt0))
674 if(PyInt_Check(nbOfTuples))
676 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
678 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
681 if(PyInt_Check(elt2))
682 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
683 int nbOfCompo=PyInt_AS_LONG(elt2);
685 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
686 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
687 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
688 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
692 throw INTERP_KERNEL::Exception(msg.c_str());
695 {//DataArrayDouble.New([1.,3.,4.],3)
696 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
698 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
699 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
704 throw INTERP_KERNEL::Exception(msg.c_str());
707 {// DataArrayDouble.New([1.,3.,4.])
708 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
709 int tmpp1=-1,tmpp2=-1;
710 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
711 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
715 else if(PyInt_Check(elt0))
717 int nbOfTuples1=PyInt_AS_LONG(elt0);
719 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
724 if(PyInt_Check(nbOfTuples))
725 {//DataArrayDouble.New(5,2)
726 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
728 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
729 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
730 ret->alloc(nbOfTuples1,nbOfCompo);
734 throw INTERP_KERNEL::Exception(msg.c_str());
737 throw INTERP_KERNEL::Exception(msg.c_str());
740 {//DataArrayDouble.New(5)
741 MCAuto<DataArrayDouble> ret=DataArrayDouble::New();
742 ret->alloc(nbOfTuples1,1);
747 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
748 {//DataArrayDouble.New(numpyArray)
749 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
753 throw INTERP_KERNEL::Exception(msg.c_str());
754 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
757 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
759 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
762 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
765 std::vector<double> bb;
767 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
768 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
769 self->pushBackValsSilent(tmp,tmp+nbTuples);
772 std::string __repr__() const throw(INTERP_KERNEL::Exception)
774 std::ostringstream oss;
775 self->reprQuickOverview(oss);
779 std::string __str__() const throw(INTERP_KERNEL::Exception)
781 return self->reprNotTooLong();
784 double __float__() const throw(INTERP_KERNEL::Exception)
786 return self->doubleValue();
789 int __len__() const throw(INTERP_KERNEL::Exception)
791 if(self->isAllocated())
793 return self->getNumberOfTuples();
797 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
801 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
803 return self->iterator();
806 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
808 const char *msg="MEDCoupling::DataArrayDouble::setValues : Available API are : \n-DataArrayDouble.setValues([1.,3.,4.])\n-DataArrayDouble.setValues([1.,3.,4.],3)\n-DataArrayDouble.setValues([1.,3.,4.,5.],2,2)\n-DataArrayDouble.setValues([(1.,1.7),(3.,3.7),(4.,4.7)])\n !";
809 if(PyList_Check(li) || PyTuple_Check(li))
813 if(PyInt_Check(nbOfTuples))
815 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
817 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
820 if(PyInt_Check(nbOfComp))
821 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
822 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
824 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
825 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
826 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
829 throw INTERP_KERNEL::Exception(msg);
832 {//DataArrayDouble.setValues([1.,3.,4.],3)
834 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
835 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
839 throw INTERP_KERNEL::Exception(msg);
842 {// DataArrayDouble.setValues([1.,3.,4.])
843 int tmpp1=-1,tmpp2=-1;
844 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
845 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
849 throw INTERP_KERNEL::Exception(msg);
852 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
854 const double *vals=self->getConstPointer();
855 return convertDblArrToPyList(vals,self->getNbOfElems());
859 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
861 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
865 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
868 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
869 PyObject *ret=PyTuple_New(2);
870 PyObject *ret0Py=ret0?Py_True:Py_False;
872 PyTuple_SetItem(ret,0,ret0Py);
873 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
877 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
879 const double *vals=self->getConstPointer();
880 int nbOfComp=self->getNumberOfComponents();
881 int nbOfTuples=self->getNumberOfTuples();
882 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
885 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
887 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
889 DataArrayDouble *a,*a2;
890 DataArrayDoubleTuple *aa,*aa2;
891 std::vector<double> bb,bb2;
893 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
894 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
895 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
899 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
901 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
903 DataArrayDouble *a,*a2;
904 DataArrayDoubleTuple *aa,*aa2;
905 std::vector<double> bb,bb2;
907 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
909 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
910 return convertDblArrToPyListOfTuple(res,3,3);
913 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
915 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
917 DataArrayDouble *a,*a2;
918 DataArrayDoubleTuple *aa,*aa2;
919 std::vector<double> bb,bb2;
921 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
922 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
923 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
926 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
929 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
930 if (!SWIG_IsOK(res1))
933 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
934 if(size!=self->getNumberOfTuples())
936 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
938 return self->renumber(tmp);
942 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
944 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
945 da2->checkAllocated();
946 int size=self->getNumberOfTuples();
947 if(size!=self->getNumberOfTuples())
949 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
951 return self->renumber(da2->getConstPointer());
955 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
958 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
959 if (!SWIG_IsOK(res1))
962 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
963 if(size!=self->getNumberOfTuples())
965 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
967 return self->renumberR(tmp);
971 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
973 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
974 da2->checkAllocated();
975 int size=self->getNumberOfTuples();
976 if(size!=self->getNumberOfTuples())
978 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
980 return self->renumberR(da2->getConstPointer());
984 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
987 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
988 if (!SWIG_IsOK(res1))
991 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
992 if(size!=self->getNumberOfTuples())
994 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
996 return self->renumberAndReduce(tmp,newNbOfTuple);
1000 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1002 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1003 da2->checkAllocated();
1004 int size=self->getNumberOfTuples();
1005 if(size!=self->getNumberOfTuples())
1007 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1009 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1013 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1015 int thisTupleId,otherTupleId;
1016 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1017 PyObject *ret=PyTuple_New(3);
1018 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1019 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1020 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1024 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1027 double r1=self->getMaxValue(tmp);
1028 PyObject *ret=PyTuple_New(2);
1029 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1030 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1034 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1037 double r1=self->getMaxValue2(tmp);
1038 PyObject *ret=PyTuple_New(2);
1039 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1040 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1044 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1047 double r1=self->getMinValue(tmp);
1048 PyObject *ret=PyTuple_New(2);
1049 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1050 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1054 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1057 double r1=self->getMinValue2(tmp);
1058 PyObject *ret=PyTuple_New(2);
1059 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1060 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1064 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1066 int nbOfCompo=self->getNumberOfComponents();
1067 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1068 self->getMinMaxPerComponent(tmp);
1069 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1073 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1075 int sz=self->getNumberOfComponents();
1076 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1077 self->accumulate(tmp);
1078 return convertDblArrToPyList(tmp,sz);
1081 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1084 std::vector<int> val2;
1085 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1086 return self->accumulatePerChunck(bg,bg+sz);
1089 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1091 DataArrayInt *comm, *commIndex;
1092 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1093 PyObject *res = PyList_New(2);
1094 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1095 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1099 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1103 DataArrayDoubleTuple *aa;
1104 std::vector<double> bb;
1106 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1107 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1109 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1110 PyObject *ret=PyTuple_New(2);
1111 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1112 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1116 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1118 std::vector<int> tmp;
1119 convertPyToNewIntArr3(li,tmp);
1120 self->setSelectedComponents(a,tmp);
1123 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1125 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1126 std::size_t sz(retCpp.size());
1127 PyObject *res(PyList_New(sz));
1128 for(std::size_t i=0;i<sz;i++)
1129 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1133 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1135 int sz=self->getNumberOfComponents();
1136 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1137 self->getTuple(tupleId,tmp);
1138 return convertDblArrToPyList(tmp,sz);
1141 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1143 std::vector<const DataArrayDouble *> tmp;
1144 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1145 return DataArrayDouble::Aggregate(tmp);
1148 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1150 std::vector<const DataArrayDouble *> tmp;
1151 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1152 return DataArrayDouble::Meld(tmp);
1155 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1159 DataArrayDoubleTuple *aa;
1160 std::vector<double> bb;
1162 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1163 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1164 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1165 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1166 DataArrayInt *c=0,*cI=0;
1167 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1168 PyObject *ret=PyTuple_New(2);
1169 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1170 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1174 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1176 DataArrayInt *ret1=0;
1177 bool ret0=self->areIncludedInMe(other,prec,ret1);
1178 PyObject *ret=PyTuple_New(2);
1179 PyObject *ret0Py=ret0?Py_True:Py_False;
1181 PyTuple_SetItem(ret,0,ret0Py);
1182 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1186 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1188 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1189 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1190 self->checkAllocated();
1191 int nbOfTuples=self->getNumberOfTuples();
1192 int nbOfComponents=self->getNumberOfComponents();
1194 std::vector<int> vt1,vc1;
1195 std::pair<int, std::pair<int,int> > pt1,pc1;
1196 DataArrayInt *dt1=0,*dc1=0;
1198 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1199 MCAuto<DataArrayDouble> ret;
1203 if(nbOfComponents==1)
1204 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1205 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1207 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1209 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1211 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1213 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1216 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1217 std::vector<int> v2(1,ic1);
1218 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1222 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1223 std::vector<int> v2(1,ic1);
1224 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1228 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1229 std::vector<int> v2(1,ic1);
1230 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1234 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1235 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1239 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1240 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1244 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1245 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1249 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1250 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1254 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1255 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1256 std::vector<int> v2(nbOfComp);
1257 for(int i=0;i<nbOfComp;i++)
1258 v2[i]=pc1.first+i*pc1.second.second;
1259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1263 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1264 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1265 std::vector<int> v2(nbOfComp);
1266 for(int i=0;i<nbOfComp;i++)
1267 v2[i]=pc1.first+i*pc1.second.second;
1268 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1272 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
1273 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1274 std::vector<int> v2(nbOfComp);
1275 for(int i=0;i<nbOfComp;i++)
1276 v2[i]=pc1.first+i*pc1.second.second;
1277 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1281 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1282 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1283 std::vector<int> v2(nbOfComp);
1284 for(int i=0;i<nbOfComp;i++)
1285 v2[i]=pc1.first+i*pc1.second.second;
1286 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1289 throw INTERP_KERNEL::Exception(msg);
1293 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1295 self->checkAllocated();
1296 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1297 int nbOfTuples=self->getNumberOfTuples();
1298 int nbOfComponents=self->getNumberOfComponents();
1301 std::vector<double> v1;
1302 DataArrayDouble *d1=0;
1303 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1305 std::vector<int> vt1,vc1;
1306 std::pair<int, std::pair<int,int> > pt1,pc1;
1307 DataArrayInt *dt1=0,*dc1=0;
1308 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1309 MCAuto<DataArrayDouble> tmp;
1317 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1320 tmp=DataArrayDouble::New();
1321 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1322 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1325 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1328 throw INTERP_KERNEL::Exception(msg);
1337 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1340 tmp=DataArrayDouble::New();
1341 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1342 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1345 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1348 throw INTERP_KERNEL::Exception(msg);
1357 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1360 tmp=DataArrayDouble::New();
1361 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1362 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1365 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1368 throw INTERP_KERNEL::Exception(msg);
1377 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1380 tmp=DataArrayDouble::New();
1381 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1382 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1385 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1388 throw INTERP_KERNEL::Exception(msg);
1397 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1400 tmp=DataArrayDouble::New();
1401 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1402 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1405 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1408 throw INTERP_KERNEL::Exception(msg);
1417 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1420 tmp=DataArrayDouble::New();
1421 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1422 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1425 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1428 throw INTERP_KERNEL::Exception(msg);
1437 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1440 tmp=DataArrayDouble::New();
1441 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1442 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1445 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1448 throw INTERP_KERNEL::Exception(msg);
1457 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1460 tmp=DataArrayDouble::New();
1461 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1462 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1465 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1468 throw INTERP_KERNEL::Exception(msg);
1477 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1480 tmp=DataArrayDouble::New();
1481 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1482 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1485 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1488 throw INTERP_KERNEL::Exception(msg);
1497 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1500 tmp=DataArrayDouble::New();
1501 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1502 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1505 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1508 throw INTERP_KERNEL::Exception(msg);
1517 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1520 tmp=DataArrayDouble::New();
1521 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1522 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1525 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1528 throw INTERP_KERNEL::Exception(msg);
1537 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1540 tmp=DataArrayDouble::New();
1541 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1542 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1545 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1548 throw INTERP_KERNEL::Exception(msg);
1557 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1560 tmp=DataArrayDouble::New();
1561 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1562 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1565 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1568 throw INTERP_KERNEL::Exception(msg);
1577 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1580 tmp=DataArrayDouble::New();
1581 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1582 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1585 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1588 throw INTERP_KERNEL::Exception(msg);
1597 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1600 tmp=DataArrayDouble::New();
1601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1602 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1605 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1608 throw INTERP_KERNEL::Exception(msg);
1617 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1620 tmp=DataArrayDouble::New();
1621 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1622 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1625 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1628 throw INTERP_KERNEL::Exception(msg);
1633 throw INTERP_KERNEL::Exception(msg);
1638 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1640 return self->negate();
1643 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1645 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1648 DataArrayDoubleTuple *aa;
1649 std::vector<double> bb;
1652 #ifndef WITHOUT_AUTOFIELD
1654 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1656 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1659 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1660 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1662 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1665 throw INTERP_KERNEL::Exception(msg);
1669 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1674 MCAuto<DataArrayDouble> ret=self->deepCopy();
1675 ret->applyLin(1.,val);
1676 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1680 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1684 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1685 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1689 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1690 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1693 throw INTERP_KERNEL::Exception(msg);
1697 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1699 const char msg[]="Unexpected situation in __radd__ !";
1702 DataArrayDoubleTuple *aa;
1703 std::vector<double> bb;
1705 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1710 MCAuto<DataArrayDouble> ret=self->deepCopy();
1711 ret->applyLin(1.,val);
1716 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1717 return DataArrayDouble::Add(self,aaa);
1721 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1722 return DataArrayDouble::Add(self,aaa);
1725 throw INTERP_KERNEL::Exception(msg);
1729 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1731 const char msg[]="Unexpected situation in __iadd__ !";
1734 DataArrayDoubleTuple *aa;
1735 std::vector<double> bb;
1737 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1742 self->applyLin(1.,val);
1743 Py_XINCREF(trueSelf);
1749 Py_XINCREF(trueSelf);
1754 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1755 self->addEqual(aaa);
1756 Py_XINCREF(trueSelf);
1761 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1762 self->addEqual(aaa);
1763 Py_XINCREF(trueSelf);
1767 throw INTERP_KERNEL::Exception(msg);
1771 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1773 const char msg[]="Unexpected situation in __sub__ !";
1776 DataArrayDoubleTuple *aa;
1777 std::vector<double> bb;
1780 #ifndef WITHOUT_AUTOFIELD
1782 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1784 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1787 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1788 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1790 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1793 throw INTERP_KERNEL::Exception(msg);
1797 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1802 MCAuto<DataArrayDouble> ret=self->deepCopy();
1803 ret->applyLin(1.,-val);
1804 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1808 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1812 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1813 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1817 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1818 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1821 throw INTERP_KERNEL::Exception(msg);
1825 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1827 const char msg[]="Unexpected situation in __rsub__ !";
1830 DataArrayDoubleTuple *aa;
1831 std::vector<double> bb;
1833 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1838 MCAuto<DataArrayDouble> ret=self->deepCopy();
1839 ret->applyLin(-1.,val);
1844 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1845 return DataArrayDouble::Substract(aaa,self);
1849 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1850 return DataArrayDouble::Substract(aaa,self);
1853 throw INTERP_KERNEL::Exception(msg);
1857 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1859 const char msg[]="Unexpected situation in __isub__ !";
1862 DataArrayDoubleTuple *aa;
1863 std::vector<double> bb;
1865 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1870 self->applyLin(1,-val);
1871 Py_XINCREF(trueSelf);
1876 self->substractEqual(a);
1877 Py_XINCREF(trueSelf);
1882 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1883 self->substractEqual(aaa);
1884 Py_XINCREF(trueSelf);
1889 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1890 self->substractEqual(aaa);
1891 Py_XINCREF(trueSelf);
1895 throw INTERP_KERNEL::Exception(msg);
1899 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1901 const char msg[]="Unexpected situation in __mul__ !";
1904 DataArrayDoubleTuple *aa;
1905 std::vector<double> bb;
1908 #ifndef WITHOUT_AUTOFIELD
1910 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1912 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1915 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1916 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1918 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1921 throw INTERP_KERNEL::Exception(msg);
1925 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1930 MCAuto<DataArrayDouble> ret=self->deepCopy();
1931 ret->applyLin(val,0.);
1932 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1936 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1940 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1941 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1945 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1946 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1949 throw INTERP_KERNEL::Exception(msg);
1953 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1955 const char msg[]="Unexpected situation in __rmul__ !";
1958 DataArrayDoubleTuple *aa;
1959 std::vector<double> bb;
1961 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1966 MCAuto<DataArrayDouble> ret=self->deepCopy();
1967 ret->applyLin(val,0.);
1972 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1973 return DataArrayDouble::Multiply(self,aaa);
1977 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1978 return DataArrayDouble::Multiply(self,aaa);
1981 throw INTERP_KERNEL::Exception(msg);
1985 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1987 const char msg[]="Unexpected situation in __imul__ !";
1990 DataArrayDoubleTuple *aa;
1991 std::vector<double> bb;
1993 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1998 self->applyLin(val,0.);
1999 Py_XINCREF(trueSelf);
2004 self->multiplyEqual(a);
2005 Py_XINCREF(trueSelf);
2010 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2011 self->multiplyEqual(aaa);
2012 Py_XINCREF(trueSelf);
2017 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2018 self->multiplyEqual(aaa);
2019 Py_XINCREF(trueSelf);
2023 throw INTERP_KERNEL::Exception(msg);
2027 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2029 const char msg[]="Unexpected situation in __div__ !";
2032 DataArrayDoubleTuple *aa;
2033 std::vector<double> bb;
2036 #ifndef WITHOUT_AUTOFIELD
2038 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
2040 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
2043 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
2044 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
2046 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
2049 throw INTERP_KERNEL::Exception(msg);
2053 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2059 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2060 MCAuto<DataArrayDouble> ret=self->deepCopy();
2061 ret->applyLin(1/val,0.);
2062 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2066 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2070 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2071 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2075 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2076 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2079 throw INTERP_KERNEL::Exception(msg);
2083 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2085 const char msg[]="Unexpected situation in __rdiv__ !";
2088 DataArrayDoubleTuple *aa;
2089 std::vector<double> bb;
2091 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2096 MCAuto<DataArrayDouble> ret=self->deepCopy();
2102 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2103 return DataArrayDouble::Divide(aaa,self);
2107 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2108 return DataArrayDouble::Divide(aaa,self);
2111 throw INTERP_KERNEL::Exception(msg);
2115 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2117 const char msg[]="Unexpected situation in __idiv__ !";
2120 DataArrayDoubleTuple *aa;
2121 std::vector<double> bb;
2123 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2129 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2130 self->applyLin(1./val,0.);
2131 Py_XINCREF(trueSelf);
2136 self->divideEqual(a);
2137 Py_XINCREF(trueSelf);
2142 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2143 self->divideEqual(aaa);
2144 Py_XINCREF(trueSelf);
2149 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2150 self->divideEqual(aaa);
2151 Py_XINCREF(trueSelf);
2155 throw INTERP_KERNEL::Exception(msg);
2159 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2161 const char msg[]="Unexpected situation in __pow__ !";
2164 DataArrayDoubleTuple *aa;
2165 std::vector<double> bb;
2167 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2172 MCAuto<DataArrayDouble> ret=self->deepCopy();
2178 return DataArrayDouble::Pow(self,a);
2182 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2183 return DataArrayDouble::Pow(self,aaa);
2187 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2188 return DataArrayDouble::Pow(self,aaa);
2191 throw INTERP_KERNEL::Exception(msg);
2195 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2197 const char msg[]="Unexpected situation in __rpow__ !";
2200 DataArrayDoubleTuple *aa;
2201 std::vector<double> bb;
2203 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2208 MCAuto<DataArrayDouble> ret=self->deepCopy();
2209 ret->applyRPow(val);
2214 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2215 return DataArrayDouble::Pow(aaa,self);
2219 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2220 return DataArrayDouble::Pow(aaa,self);
2223 throw INTERP_KERNEL::Exception(msg);
2227 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2229 const char msg[]="Unexpected situation in __ipow__ !";
2232 DataArrayDoubleTuple *aa;
2233 std::vector<double> bb;
2235 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2240 self->applyPow(val);
2241 Py_XINCREF(trueSelf);
2247 Py_XINCREF(trueSelf);
2252 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2253 self->powEqual(aaa);
2254 Py_XINCREF(trueSelf);
2259 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2260 self->powEqual(aaa);
2261 Py_XINCREF(trueSelf);
2265 throw INTERP_KERNEL::Exception(msg);
2269 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2271 DataArrayInt *c=0,*cI=0;
2273 self->computeTupleIdsNearTuples(other,eps,c,cI);
2274 PyObject *ret=PyTuple_New(2);
2275 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2276 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2280 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2282 DataArrayInt *ret1=0;
2283 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2284 PyObject *ret=PyTuple_New(2);
2285 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2286 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2291 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2293 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
2296 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2299 if(!self->isAllocated())
2300 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2301 PyObject *ret(PyTuple_New(1));
2302 PyObject *ret0(PyDict_New());
2303 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
2304 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2305 PyObject *tmp1(PyInt_FromLong(0));
2306 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2307 PyTuple_SetItem(ret,0,ret0);
2311 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2317 class DataArrayDoubleTuple;
2319 class DataArrayDoubleIterator
2322 DataArrayDoubleIterator(DataArrayDouble *da);
2323 ~DataArrayDoubleIterator();
2328 DataArrayDoubleTuple *ret=self->nextt();
2330 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2333 PyErr_SetString(PyExc_StopIteration,"No more data.");
2340 class DataArrayDoubleTuple
2343 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2344 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2347 std::string __str__() const throw(INTERP_KERNEL::Exception)
2349 return self->repr();
2352 double __float__() const throw(INTERP_KERNEL::Exception)
2354 return self->doubleValue();
2357 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2359 return self->buildDADouble(1,self->getNumberOfCompo());
2362 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2364 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2365 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2366 Py_XINCREF(trueSelf);
2370 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2372 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2373 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2374 Py_XINCREF(trueSelf);
2378 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2380 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2381 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2382 Py_XINCREF(trueSelf);
2386 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2388 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2389 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2390 Py_XINCREF(trueSelf);
2394 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2396 return PyInt_FromLong(self->getNumberOfCompo());
2399 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2401 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2404 std::vector<int> multiVal;
2405 std::pair<int, std::pair<int,int> > slic;
2406 MEDCoupling::DataArrayInt *daIntTyypp=0;
2407 const double *pt=self->getConstPointer();
2408 int nbc=self->getNumberOfCompo();
2409 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2416 std::ostringstream oss;
2417 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2418 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2422 return PyFloat_FromDouble(pt[singleVal]);
2426 return PyFloat_FromDouble(pt[nbc+singleVal]);
2429 std::ostringstream oss;
2430 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2431 throw INTERP_KERNEL::Exception(oss.str().c_str());
2437 PyObject *t=PyTuple_New(multiVal.size());
2438 for(int j=0;j<(int)multiVal.size();j++)
2440 int cid=multiVal[j];
2443 std::ostringstream oss;
2444 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2445 throw INTERP_KERNEL::Exception(oss.str().c_str());
2447 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2453 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2454 PyObject *t=PyTuple_New(sz);
2455 for(int j=0;j<sz;j++)
2456 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2460 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2464 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2466 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2467 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2470 std::vector<double> multiValV;
2471 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2472 int nbc=self->getNumberOfCompo();
2473 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2475 std::vector<int> multiVal;
2476 std::pair<int, std::pair<int,int> > slic;
2477 MEDCoupling::DataArrayInt *daIntTyypp=0;
2478 double *pt=self->getPointer();
2479 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2486 std::ostringstream oss;
2487 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2488 throw INTERP_KERNEL::Exception(oss.str().c_str());
2494 pt[singleVal]=singleValV;
2499 if(multiValV.size()!=1)
2501 std::ostringstream oss;
2502 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2503 throw INTERP_KERNEL::Exception(oss.str().c_str());
2505 pt[singleVal]=multiValV[0];
2510 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2514 throw INTERP_KERNEL::Exception(msg);
2523 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2527 std::ostringstream oss;
2528 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2529 throw INTERP_KERNEL::Exception(oss.str().c_str());
2537 if(multiVal.size()!=multiValV.size())
2539 std::ostringstream oss;
2540 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2541 throw INTERP_KERNEL::Exception(oss.str().c_str());
2543 for(int i=0;i<(int)multiVal.size();i++)
2545 int pos=multiVal[i];
2548 std::ostringstream oss;
2549 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2550 throw INTERP_KERNEL::Exception(oss.str().c_str());
2552 pt[multiVal[i]]=multiValV[i];
2558 const double *ptV=daIntTyyppV->getConstPointer();
2559 if(nbc>daIntTyyppV->getNumberOfCompo())
2561 std::ostringstream oss;
2562 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2563 throw INTERP_KERNEL::Exception(oss.str().c_str());
2565 std::copy(ptV,ptV+nbc,pt);
2569 throw INTERP_KERNEL::Exception(msg);
2574 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2579 for(int j=0;j<sz;j++)
2580 pt[slic.first+j*slic.second.second]=singleValV;
2585 if(sz!=(int)multiValV.size())
2587 std::ostringstream oss;
2588 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2589 throw INTERP_KERNEL::Exception(oss.str().c_str());
2591 for(int j=0;j<sz;j++)
2592 pt[slic.first+j*slic.second.second]=multiValV[j];
2597 const double *ptV=daIntTyyppV->getConstPointer();
2598 if(sz>daIntTyyppV->getNumberOfCompo())
2600 std::ostringstream oss;
2601 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2602 throw INTERP_KERNEL::Exception(oss.str().c_str());
2604 for(int j=0;j<sz;j++)
2605 pt[slic.first+j*slic.second.second]=ptV[j];
2609 throw INTERP_KERNEL::Exception(msg);
2613 throw INTERP_KERNEL::Exception(msg);
2619 class DataArrayIntIterator;
2621 class DataArrayInt : public DataArray
2624 static DataArrayInt *New();
2625 int intValue() const throw(INTERP_KERNEL::Exception);
2626 int getHashCode() const throw(INTERP_KERNEL::Exception);
2627 bool empty() const throw(INTERP_KERNEL::Exception);
2628 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2629 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2630 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2631 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2632 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2633 int popBackSilent() throw(INTERP_KERNEL::Exception);
2634 void pack() const throw(INTERP_KERNEL::Exception);
2635 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2636 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2637 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2638 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2639 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2640 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2641 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2642 void reverse() throw(INTERP_KERNEL::Exception);
2643 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2644 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2645 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2646 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2647 void fillWithZero() throw(INTERP_KERNEL::Exception);
2648 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2649 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2650 std::string repr() const throw(INTERP_KERNEL::Exception);
2651 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2652 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2653 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2654 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2655 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2656 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2657 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2658 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2659 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2660 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2661 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2662 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2663 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2664 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2665 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2666 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2667 void transpose() throw(INTERP_KERNEL::Exception);
2668 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2669 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2670 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2671 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2672 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2673 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2674 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2675 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2676 int front() const throw(INTERP_KERNEL::Exception);
2677 int back() const throw(INTERP_KERNEL::Exception);
2678 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2679 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2680 int *getPointer() throw(INTERP_KERNEL::Exception);
2681 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2682 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2683 const int *begin() const throw(INTERP_KERNEL::Exception);
2684 const int *end() const throw(INTERP_KERNEL::Exception);
2685 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2686 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2687 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2688 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2689 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2690 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2691 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2692 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2693 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2694 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2695 int count(int value) const throw(INTERP_KERNEL::Exception);
2696 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2697 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2698 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2699 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2700 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2701 void abs() throw(INTERP_KERNEL::Exception);
2702 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2703 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2704 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2705 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2706 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2707 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2708 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2709 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2710 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2711 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2712 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2713 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2714 DataArrayInt *findIdsStricltyNegative() const throw(INTERP_KERNEL::Exception);
2715 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2716 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2717 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2718 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2719 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2720 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2721 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2722 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2723 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2724 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2725 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2726 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2727 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2728 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2729 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2730 void computeOffsets() throw(INTERP_KERNEL::Exception);
2731 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2732 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2733 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2734 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2735 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2736 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2737 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2738 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2739 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2740 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2741 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2742 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2743 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2744 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2745 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2746 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2747 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2748 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2749 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2751 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2754 DataArrayInt() throw(INTERP_KERNEL::Exception)
2756 return DataArrayInt::New();
2759 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2761 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)";
2762 std::string msg(msgBase);
2764 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2767 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2771 if(PyInt_Check(nbOfTuples))
2773 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2775 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2778 if(PyInt_Check(nbOfComp))
2779 {//DataArrayInt.New([1,3,4,5],2,2)
2780 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2782 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2783 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2784 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2785 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2789 throw INTERP_KERNEL::Exception(msg.c_str());
2792 {//DataArrayInt.New([1,3,4],3)
2793 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2795 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2796 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2801 throw INTERP_KERNEL::Exception(msg.c_str());
2804 {// DataArrayInt.New([1,3,4])
2805 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2806 int tmpp1=-1,tmpp2=-1;
2807 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2808 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2812 else if(PyInt_Check(elt0))
2814 int nbOfTuples1=PyInt_AS_LONG(elt0);
2816 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2821 if(PyInt_Check(nbOfTuples))
2822 {//DataArrayInt.New(5,2)
2823 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2825 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2826 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2827 ret->alloc(nbOfTuples1,nbOfCompo);
2831 throw INTERP_KERNEL::Exception(msg.c_str());
2834 throw INTERP_KERNEL::Exception(msg.c_str());
2837 {//DataArrayInt.New(5)
2838 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2839 ret->alloc(nbOfTuples1,1);
2844 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2845 {//DataArrayInt.New(numpyArray)
2846 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2850 throw INTERP_KERNEL::Exception(msg.c_str());
2851 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2854 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2856 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2859 std::string __str__() const throw(INTERP_KERNEL::Exception)
2861 return self->reprNotTooLong();
2864 int __len__() const throw(INTERP_KERNEL::Exception)
2866 if(self->isAllocated())
2868 return self->getNumberOfTuples();
2872 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2876 int __int__() const throw(INTERP_KERNEL::Exception)
2878 return self->intValue();
2881 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2883 return self->iterator();
2886 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2888 int sz=self->getNumberOfComponents();
2889 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2890 self->accumulate(tmp);
2891 return convertIntArrToPyList(tmp,sz);
2894 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2897 std::vector<int> val2;
2898 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2899 return self->accumulatePerChunck(bg,bg+sz);
2902 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2905 std::vector<int> val2;
2906 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2907 return self->findIdsEqualTuple(bg,bg+sz);
2910 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2912 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2913 PyObject *ret=PyList_New(slcs.size());
2914 for(std::size_t i=0;i<slcs.size();i++)
2915 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2919 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2921 if(!PySlice_Check(slic))
2922 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2923 Py_ssize_t strt=2,stp=2,step=2;
2924 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2925 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2926 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2927 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 !");
2928 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2931 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2934 self->getMinMaxValues(a,b);
2935 PyObject *ret=PyTuple_New(2);
2936 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2937 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2941 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2943 int newNbOfTuples=-1;
2944 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2945 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2946 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2947 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2948 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2949 PyObject *ret=PyTuple_New(2);
2950 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2951 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2955 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2957 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2958 int szArr,sw,iTypppArr;
2959 std::vector<int> stdvecTyyppArr;
2960 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2961 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2962 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2966 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2968 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 !";
2969 if(PyList_Check(li) || PyTuple_Check(li))
2971 if(nbOfTuples && nbOfTuples != Py_None)
2973 if(PyInt_Check(nbOfTuples))
2975 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2977 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2978 if(nbOfComp && nbOfComp != Py_None)
2980 if(PyInt_Check(nbOfComp))
2981 {//DataArrayInt.setValues([1,3,4,5],2,2)
2982 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2984 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2985 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2986 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2989 throw INTERP_KERNEL::Exception(msg);
2992 {//DataArrayInt.setValues([1,3,4],3)
2994 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2995 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2999 throw INTERP_KERNEL::Exception(msg);
3002 {// DataArrayInt.setValues([1,3,4])
3003 int tmpp1=-1,tmpp2=-1;
3004 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
3005 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
3009 throw INTERP_KERNEL::Exception(msg);
3012 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
3014 const int *vals=self->getConstPointer();
3015 return convertIntArrToPyList(vals,self->getNbOfElems());
3019 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
3021 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
3025 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
3028 bool ret0=self->isEqualIfNotWhy(other,ret1);
3029 PyObject *ret=PyTuple_New(2);
3030 PyObject *ret0Py=ret0?Py_True:Py_False;
3032 PyTuple_SetItem(ret,0,ret0Py);
3033 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
3037 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3039 const int *vals=self->getConstPointer();
3040 int nbOfComp=self->getNumberOfComponents();
3041 int nbOfTuples=self->getNumberOfTuples();
3042 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3045 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3047 std::vector<const DataArrayInt *> groups;
3048 std::vector< std::vector<int> > fidsOfGroups;
3049 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
3050 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3051 PyObject *ret = PyList_New(2);
3052 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3053 int sz=fidsOfGroups.size();
3054 PyObject *ret1 = PyList_New(sz);
3055 for(int i=0;i<sz;i++)
3056 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3057 PyList_SetItem(ret,1,ret1);
3061 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3064 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3065 if (!SWIG_IsOK(res1))
3068 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3069 self->transformWithIndArr(tmp,tmp+size);
3073 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3074 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3078 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3082 std::vector<int> multiVal;
3083 std::pair<int, std::pair<int,int> > slic;
3084 MEDCoupling::DataArrayInt *daIntTyypp=0;
3085 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3089 return self->findIdsEqualList(&singleVal,&singleVal+1);
3091 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3093 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3095 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3099 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3103 std::vector<int> multiVal;
3104 std::pair<int, std::pair<int,int> > slic;
3105 MEDCoupling::DataArrayInt *daIntTyypp=0;
3106 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3110 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
3112 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3114 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3116 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3120 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3122 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3124 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3125 if (!SWIG_IsOK(res1))
3128 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3129 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3133 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3135 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3136 da2->checkAllocated();
3137 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
3139 PyObject *ret = PyList_New(3);
3140 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3141 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3142 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3146 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3149 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3150 if (!SWIG_IsOK(res1))
3153 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3154 return self->transformWithIndArrR(tmp,tmp+size);
3158 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3159 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3163 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3166 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3167 if (!SWIG_IsOK(res1))
3170 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3171 if(size!=self->getNumberOfTuples())
3173 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3175 return self->renumberAndReduce(tmp,newNbOfTuple);
3179 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3181 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3182 da2->checkAllocated();
3183 int size=self->getNumberOfTuples();
3184 if(size!=self->getNumberOfTuples())
3186 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3188 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3192 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3195 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3196 if (!SWIG_IsOK(res1))
3199 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3200 if(size!=self->getNumberOfTuples())
3202 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3204 return self->renumber(tmp);
3208 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3210 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3211 da2->checkAllocated();
3212 int size=self->getNumberOfTuples();
3213 if(size!=self->getNumberOfTuples())
3215 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3217 return self->renumber(da2->getConstPointer());
3221 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3224 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
3225 if (!SWIG_IsOK(res1))
3228 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3229 if(size!=self->getNumberOfTuples())
3231 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3233 return self->renumberR(tmp);
3237 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3239 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3240 da2->checkAllocated();
3241 int size=self->getNumberOfTuples();
3242 if(size!=self->getNumberOfTuples())
3244 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3246 return self->renumberR(da2->getConstPointer());
3250 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3252 std::vector<int> tmp;
3253 convertPyToNewIntArr3(li,tmp);
3254 self->setSelectedComponents(a,tmp);
3257 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
3259 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
3260 std::size_t sz(retCpp.size());
3261 PyObject *res(PyList_New(sz));
3262 for(std::size_t i=0;i<sz;i++)
3263 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3267 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3269 int sz=self->getNumberOfComponents();
3270 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3271 self->getTuple(tupleId,tmp);
3272 return convertIntArrToPyList(tmp,sz);
3275 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3277 DataArrayInt *arr=0;
3278 DataArrayInt *arrI=0;
3279 self->changeSurjectiveFormat(targetNb,arr,arrI);
3280 PyObject *res = PyList_New(2);
3281 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3282 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
3286 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3288 std::vector<const DataArrayInt *> tmp;
3289 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3290 return DataArrayInt::Meld(tmp);
3293 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3295 std::vector<const DataArrayInt *> tmp;
3296 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3297 return DataArrayInt::Aggregate(tmp);
3300 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3302 std::vector<const DataArrayInt *> tmp;
3303 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3304 return DataArrayInt::AggregateIndexes(tmp);
3307 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3309 std::vector<const DataArrayInt *> tmp;
3310 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3311 return DataArrayInt::BuildUnion(tmp);
3314 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3316 std::vector<const DataArrayInt *> tmp;
3317 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
3318 return DataArrayInt::BuildIntersection(tmp);
3321 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3324 int r1=self->getMaxValue(tmp);
3325 PyObject *ret=PyTuple_New(2);
3326 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3327 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3331 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3334 int r1=self->getMinValue(tmp);
3335 PyObject *ret=PyTuple_New(2);
3336 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3337 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3341 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3343 int nbOfCompo=self->getNumberOfComponents();
3348 if(PyInt_Check(obj))
3350 int val=(int)PyInt_AS_LONG(obj);
3351 return self->findIdFirstEqual(val);
3354 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3358 std::vector<int> arr;
3359 convertPyToNewIntArr3(obj,arr);
3360 return self->findIdFirstEqualTuple(arr);
3365 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3367 int nbOfCompo=self->getNumberOfComponents();
3374 if(PyInt_Check(obj))
3376 int val=(int)PyInt_AS_LONG(obj);
3377 return self->presenceOfValue(val);
3380 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3384 std::vector<int> arr;
3385 convertPyToNewIntArr3(obj,arr);
3386 return self->presenceOfTuple(arr);
3391 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3393 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3394 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3395 self->checkAllocated();
3396 int nbOfTuples=self->getNumberOfTuples();
3397 int nbOfComponents=self->getNumberOfComponents();
3399 std::vector<int> vt1,vc1;
3400 std::pair<int, std::pair<int,int> > pt1,pc1;
3401 DataArrayInt *dt1=0,*dc1=0;
3403 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3404 MCAuto<DataArrayInt> ret;
3409 if(nbOfComponents==1)
3410 return PyInt_FromLong(self->getIJSafe(it1,0));
3411 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3414 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3416 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3418 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3420 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3423 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3424 std::vector<int> v2(1,ic1);
3425 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3429 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3430 std::vector<int> v2(1,ic1);
3431 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3435 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3436 std::vector<int> v2(1,ic1);
3437 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3441 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3442 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3446 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3447 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3451 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3452 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3456 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3457 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3461 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3462 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3463 std::vector<int> v2(nbOfComp);
3464 for(int i=0;i<nbOfComp;i++)
3465 v2[i]=pc1.first+i*pc1.second.second;
3466 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3470 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3471 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3472 std::vector<int> v2(nbOfComp);
3473 for(int i=0;i<nbOfComp;i++)
3474 v2[i]=pc1.first+i*pc1.second.second;
3475 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3479 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3480 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3481 std::vector<int> v2(nbOfComp);
3482 for(int i=0;i<nbOfComp;i++)
3483 v2[i]=pc1.first+i*pc1.second.second;
3484 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3488 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3489 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3490 std::vector<int> v2(nbOfComp);
3491 for(int i=0;i<nbOfComp;i++)
3492 v2[i]=pc1.first+i*pc1.second.second;
3493 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3496 throw INTERP_KERNEL::Exception(msg);
3500 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3502 self->checkAllocated();
3503 const char msg[]="Unexpected situation in __setitem__ !";
3504 int nbOfTuples=self->getNumberOfTuples();
3505 int nbOfComponents=self->getNumberOfComponents();
3508 std::vector<int> v1;
3510 DataArrayIntTuple *dd1=0;
3511 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3513 std::vector<int> vt1,vc1;
3514 std::pair<int, std::pair<int,int> > pt1,pc1;
3515 DataArrayInt *dt1=0,*dc1=0;
3516 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3517 MCAuto<DataArrayInt> tmp;
3525 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3528 tmp=DataArrayInt::New();
3529 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3530 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3533 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3536 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3537 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3552 tmp=DataArrayInt::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3557 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3560 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3561 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3564 throw INTERP_KERNEL::Exception(msg);
3573 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3576 tmp=DataArrayInt::New();
3577 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3578 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3581 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3584 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3585 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3588 throw INTERP_KERNEL::Exception(msg);
3597 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3600 tmp=DataArrayInt::New();
3601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3602 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3605 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3608 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3609 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3612 throw INTERP_KERNEL::Exception(msg);
3621 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3624 tmp=DataArrayInt::New();
3625 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3626 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3629 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3632 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3633 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3636 throw INTERP_KERNEL::Exception(msg);
3645 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3648 tmp=DataArrayInt::New();
3649 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3650 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3653 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3656 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3657 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3660 throw INTERP_KERNEL::Exception(msg);
3669 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3672 tmp=DataArrayInt::New();
3673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3674 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3677 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3680 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3681 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3684 throw INTERP_KERNEL::Exception(msg);
3693 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3696 tmp=DataArrayInt::New();
3697 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3698 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3701 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3704 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3705 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3708 throw INTERP_KERNEL::Exception(msg);
3717 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3720 tmp=DataArrayInt::New();
3721 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3722 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3725 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3728 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3729 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3732 throw INTERP_KERNEL::Exception(msg);
3741 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3744 tmp=DataArrayInt::New();
3745 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3746 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3749 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3752 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3753 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3756 throw INTERP_KERNEL::Exception(msg);
3765 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3768 tmp=DataArrayInt::New();
3769 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3770 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3773 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3776 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3777 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3780 throw INTERP_KERNEL::Exception(msg);
3789 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3792 tmp=DataArrayInt::New();
3793 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3794 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3797 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3800 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3801 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3804 throw INTERP_KERNEL::Exception(msg);
3813 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3816 tmp=DataArrayInt::New();
3817 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3818 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3821 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3824 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3825 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3828 throw INTERP_KERNEL::Exception(msg);
3837 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3840 tmp=DataArrayInt::New();
3841 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3842 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3845 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3848 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3849 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3852 throw INTERP_KERNEL::Exception(msg);
3861 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3864 tmp=DataArrayInt::New();
3865 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3866 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3869 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3872 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3873 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3876 throw INTERP_KERNEL::Exception(msg);
3885 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3888 tmp=DataArrayInt::New();
3889 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3890 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3893 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3896 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3897 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3900 throw INTERP_KERNEL::Exception(msg);
3905 throw INTERP_KERNEL::Exception(msg);
3910 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3912 return self->negate();
3915 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3917 const char msg[]="Unexpected situation in __add__ !";
3920 std::vector<int> aa;
3921 DataArrayIntTuple *aaa;
3923 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3928 MCAuto<DataArrayInt> ret=self->deepCopy();
3929 ret->applyLin(1,val);
3934 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3935 return DataArrayInt::Add(self,aaaa);
3939 return DataArrayInt::Add(self,a);
3943 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3944 return DataArrayInt::Add(self,aaaa);
3947 throw INTERP_KERNEL::Exception(msg);
3951 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3953 const char msg[]="Unexpected situation in __radd__ !";
3956 std::vector<int> aa;
3957 DataArrayIntTuple *aaa;
3959 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3964 MCAuto<DataArrayInt> ret=self->deepCopy();
3965 ret->applyLin(1,val);
3970 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3971 return DataArrayInt::Add(self,aaaa);
3975 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3976 return DataArrayInt::Add(self,aaaa);
3979 throw INTERP_KERNEL::Exception(msg);
3983 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3985 const char msg[]="Unexpected situation in __iadd__ !";
3988 std::vector<int> aa;
3989 DataArrayIntTuple *aaa;
3991 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3996 self->applyLin(1,val);
3997 Py_XINCREF(trueSelf);
4002 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4004 Py_XINCREF(trueSelf);
4010 Py_XINCREF(trueSelf);
4015 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4016 self->addEqual(aaaa);
4017 Py_XINCREF(trueSelf);
4021 throw INTERP_KERNEL::Exception(msg);
4025 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4027 const char msg[]="Unexpected situation in __sub__ !";
4030 std::vector<int> aa;
4031 DataArrayIntTuple *aaa;
4033 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4038 MCAuto<DataArrayInt> ret=self->deepCopy();
4039 ret->applyLin(1,-val);
4044 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4045 return DataArrayInt::Substract(self,aaaa);
4049 return DataArrayInt::Substract(self,a);
4053 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4054 return DataArrayInt::Substract(self,aaaa);
4057 throw INTERP_KERNEL::Exception(msg);
4061 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4063 const char msg[]="Unexpected situation in __rsub__ !";
4066 std::vector<int> aa;
4067 DataArrayIntTuple *aaa;
4069 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4074 MCAuto<DataArrayInt> ret=self->deepCopy();
4075 ret->applyLin(-1,val);
4080 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4081 return DataArrayInt::Substract(aaaa,self);
4085 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4086 return DataArrayInt::Substract(aaaa,self);
4089 throw INTERP_KERNEL::Exception(msg);
4093 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4095 const char msg[]="Unexpected situation in __isub__ !";
4098 std::vector<int> aa;
4099 DataArrayIntTuple *aaa;
4101 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4106 self->applyLin(1,-val);
4107 Py_XINCREF(trueSelf);
4112 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4113 self->substractEqual(bb);
4114 Py_XINCREF(trueSelf);
4119 self->substractEqual(a);
4120 Py_XINCREF(trueSelf);
4125 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4126 self->substractEqual(aaaa);
4127 Py_XINCREF(trueSelf);
4131 throw INTERP_KERNEL::Exception(msg);
4135 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4137 const char msg[]="Unexpected situation in __mul__ !";
4140 std::vector<int> aa;
4141 DataArrayIntTuple *aaa;
4143 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4148 MCAuto<DataArrayInt> ret=self->deepCopy();
4149 ret->applyLin(val,0);
4154 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4155 return DataArrayInt::Multiply(self,aaaa);
4159 return DataArrayInt::Multiply(self,a);
4163 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4164 return DataArrayInt::Multiply(self,aaaa);
4167 throw INTERP_KERNEL::Exception(msg);
4171 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4173 const char msg[]="Unexpected situation in __rmul__ !";
4176 std::vector<int> aa;
4177 DataArrayIntTuple *aaa;
4179 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4184 MCAuto<DataArrayInt> ret=self->deepCopy();
4185 ret->applyLin(val,0);
4190 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4191 return DataArrayInt::Multiply(self,aaaa);
4195 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4196 return DataArrayInt::Multiply(self,aaaa);
4199 throw INTERP_KERNEL::Exception(msg);
4203 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4205 const char msg[]="Unexpected situation in __imul__ !";
4208 std::vector<int> aa;
4209 DataArrayIntTuple *aaa;
4211 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4216 self->applyLin(val,0);
4217 Py_XINCREF(trueSelf);
4222 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4223 self->multiplyEqual(bb);
4224 Py_XINCREF(trueSelf);
4229 self->multiplyEqual(a);
4230 Py_XINCREF(trueSelf);
4235 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4236 self->multiplyEqual(aaaa);
4237 Py_XINCREF(trueSelf);
4241 throw INTERP_KERNEL::Exception(msg);
4245 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4247 const char msg[]="Unexpected situation in __div__ !";
4250 std::vector<int> aa;
4251 DataArrayIntTuple *aaa;
4253 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4258 MCAuto<DataArrayInt> ret=self->deepCopy();
4259 ret->applyDivideBy(val);
4264 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4265 return DataArrayInt::Divide(self,aaaa);
4269 return DataArrayInt::Divide(self,a);
4273 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4274 return DataArrayInt::Divide(self,aaaa);
4277 throw INTERP_KERNEL::Exception(msg);
4281 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4283 const char msg[]="Unexpected situation in __rdiv__ !";
4286 std::vector<int> aa;
4287 DataArrayIntTuple *aaa;
4289 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4294 MCAuto<DataArrayInt> ret=self->deepCopy();
4300 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4301 return DataArrayInt::Divide(aaaa,self);
4305 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4306 return DataArrayInt::Divide(aaaa,self);
4309 throw INTERP_KERNEL::Exception(msg);
4313 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4315 const char msg[]="Unexpected situation in __idiv__ !";
4318 std::vector<int> aa;
4319 DataArrayIntTuple *aaa;
4321 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4326 self->applyDivideBy(val);
4327 Py_XINCREF(trueSelf);
4332 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4333 self->divideEqual(bb);
4334 Py_XINCREF(trueSelf);
4339 self->divideEqual(a);
4340 Py_XINCREF(trueSelf);
4345 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4346 self->divideEqual(aaaa);
4347 Py_XINCREF(trueSelf);
4351 throw INTERP_KERNEL::Exception(msg);
4355 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4357 const char msg[]="Unexpected situation in __mod__ !";
4360 std::vector<int> aa;
4361 DataArrayIntTuple *aaa;
4363 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4368 MCAuto<DataArrayInt> ret=self->deepCopy();
4369 ret->applyModulus(val);
4374 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4375 return DataArrayInt::Modulus(self,aaaa);
4379 return DataArrayInt::Modulus(self,a);
4383 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4384 return DataArrayInt::Modulus(self,aaaa);
4387 throw INTERP_KERNEL::Exception(msg);
4391 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4393 const char msg[]="Unexpected situation in __rmod__ !";
4396 std::vector<int> aa;
4397 DataArrayIntTuple *aaa;
4399 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4404 MCAuto<DataArrayInt> ret=self->deepCopy();
4405 ret->applyRModulus(val);
4410 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4411 return DataArrayInt::Modulus(aaaa,self);
4415 return DataArrayInt::Modulus(a,self);
4419 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4420 return DataArrayInt::Modulus(aaaa,self);
4423 throw INTERP_KERNEL::Exception(msg);
4427 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4429 const char msg[]="Unexpected situation in __imod__ !";
4432 std::vector<int> aa;
4433 DataArrayIntTuple *aaa;
4435 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4440 self->applyModulus(val);
4441 Py_XINCREF(trueSelf);
4446 self->modulusEqual(a);
4447 Py_XINCREF(trueSelf);
4452 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4453 self->modulusEqual(aaaa);
4454 Py_XINCREF(trueSelf);
4458 throw INTERP_KERNEL::Exception(msg);
4462 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4464 const char msg[]="Unexpected situation in __pow__ !";
4467 std::vector<int> aa;
4468 DataArrayIntTuple *aaa;
4470 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4475 MCAuto<DataArrayInt> ret=self->deepCopy();
4481 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4482 return DataArrayInt::Pow(self,aaaa);
4486 return DataArrayInt::Pow(self,a);
4490 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4491 return DataArrayInt::Pow(self,aaaa);
4494 throw INTERP_KERNEL::Exception(msg);
4498 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4500 const char msg[]="Unexpected situation in __rpow__ !";
4503 std::vector<int> aa;
4504 DataArrayIntTuple *aaa;
4506 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4511 MCAuto<DataArrayInt> ret=self->deepCopy();
4512 ret->applyRPow(val);
4517 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4518 return DataArrayInt::Pow(aaaa,self);
4522 return DataArrayInt::Pow(a,self);
4526 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4527 return DataArrayInt::Pow(aaaa,self);
4530 throw INTERP_KERNEL::Exception(msg);
4534 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4536 const char msg[]="Unexpected situation in __ipow__ !";
4539 std::vector<int> aa;
4540 DataArrayIntTuple *aaa;
4542 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4547 self->applyPow(val);
4548 Py_XINCREF(trueSelf);
4554 Py_XINCREF(trueSelf);
4559 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4560 self->powEqual(aaaa);
4561 Py_XINCREF(trueSelf);
4565 throw INTERP_KERNEL::Exception(msg);
4569 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4571 std::ostringstream oss;
4572 self->reprQuickOverview(oss);
4576 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4578 int szArr,sw,iTypppArr;
4579 std::vector<int> stdvecTyyppArr;
4580 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4581 self->pushBackValsSilent(tmp,tmp+szArr);
4584 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4586 std::vector<int> ret1;
4587 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4588 std::size_t sz=ret0.size();
4589 PyObject *pyRet=PyTuple_New(2);
4590 PyObject *pyRet0=PyList_New((int)sz);
4591 PyObject *pyRet1=PyList_New((int)sz);
4592 for(std::size_t i=0;i<sz;i++)
4594 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4595 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4597 PyTuple_SetItem(pyRet,0,pyRet0);
4598 PyTuple_SetItem(pyRet,1,pyRet1);
4602 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4604 DataArrayInt *ret0=0,*ret1=0;
4605 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4606 PyObject *pyRet=PyTuple_New(2);
4607 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4608 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4612 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4615 bool ret(self->isRange(a,b,c));
4616 PyObject *pyRet=PyTuple_New(2);
4617 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4619 PyTuple_SetItem(pyRet,0,ret0Py);
4621 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4627 PyTuple_SetItem(pyRet,1,ret1Py);
4632 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4634 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4637 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4640 if(!self->isAllocated())
4641 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4642 PyObject *ret(PyTuple_New(1));
4643 PyObject *ret0(PyDict_New());
4644 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4645 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4646 PyObject *tmp1(PyInt_FromLong(0));
4647 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4648 PyTuple_SetItem(ret,0,ret0);
4652 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4658 class DataArrayIntTuple;
4660 class DataArrayIntIterator
4663 DataArrayIntIterator(DataArrayInt *da);
4664 ~DataArrayIntIterator();
4669 DataArrayIntTuple *ret=self->nextt();
4671 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4674 PyErr_SetString(PyExc_StopIteration,"No more data.");
4681 class DataArrayIntTuple
4684 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4685 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4688 std::string __str__() const throw(INTERP_KERNEL::Exception)
4690 return self->repr();
4693 int __int__() const throw(INTERP_KERNEL::Exception)
4695 return self->intValue();
4698 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4700 return self->buildDAInt(1,self->getNumberOfCompo());
4703 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4705 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4706 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4707 Py_XINCREF(trueSelf);
4711 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4713 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4714 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4715 Py_XINCREF(trueSelf);
4719 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4721 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4722 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4723 Py_XINCREF(trueSelf);
4727 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4729 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4730 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4731 Py_XINCREF(trueSelf);
4735 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4737 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4738 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4739 Py_XINCREF(trueSelf);
4743 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4745 return PyInt_FromLong(self->getNumberOfCompo());
4748 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4750 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4753 std::vector<int> multiVal;
4754 std::pair<int, std::pair<int,int> > slic;
4755 MEDCoupling::DataArrayInt *daIntTyypp=0;
4756 const int *pt=self->getConstPointer();
4757 int nbc=self->getNumberOfCompo();
4758 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4765 std::ostringstream oss;
4766 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4767 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4771 return PyInt_FromLong(pt[singleVal]);
4775 return PyInt_FromLong(pt[nbc+singleVal]);
4778 std::ostringstream oss;
4779 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4780 throw INTERP_KERNEL::Exception(oss.str().c_str());
4786 PyObject *t=PyTuple_New(multiVal.size());
4787 for(int j=0;j<(int)multiVal.size();j++)
4789 int cid=multiVal[j];
4792 std::ostringstream oss;
4793 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4794 throw INTERP_KERNEL::Exception(oss.str().c_str());
4796 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4802 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4803 PyObject *t=PyTuple_New(sz);
4804 for(int j=0;j<sz;j++)
4805 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4809 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4813 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4815 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4816 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4819 std::vector<int> multiValV;
4820 std::pair<int, std::pair<int,int> > slicV;
4821 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4822 int nbc=self->getNumberOfCompo();
4823 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4825 std::vector<int> multiVal;
4826 std::pair<int, std::pair<int,int> > slic;
4827 MEDCoupling::DataArrayInt *daIntTyypp=0;
4828 int *pt=self->getPointer();
4829 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4836 std::ostringstream oss;
4837 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4838 throw INTERP_KERNEL::Exception(oss.str().c_str());
4844 pt[singleVal]=singleValV;
4849 if(multiValV.size()!=1)
4851 std::ostringstream oss;
4852 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4853 throw INTERP_KERNEL::Exception(oss.str().c_str());
4855 pt[singleVal]=multiValV[0];
4860 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4864 throw INTERP_KERNEL::Exception(msg);
4873 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4877 std::ostringstream oss;
4878 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4879 throw INTERP_KERNEL::Exception(oss.str().c_str());
4887 if(multiVal.size()!=multiValV.size())
4889 std::ostringstream oss;
4890 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4891 throw INTERP_KERNEL::Exception(oss.str().c_str());
4893 for(int i=0;i<(int)multiVal.size();i++)
4895 int pos=multiVal[i];
4898 std::ostringstream oss;
4899 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4900 throw INTERP_KERNEL::Exception(oss.str().c_str());
4902 pt[multiVal[i]]=multiValV[i];
4908 const int *ptV=daIntTyyppV->getConstPointer();
4909 if(nbc>daIntTyyppV->getNumberOfCompo())
4911 std::ostringstream oss;
4912 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4913 throw INTERP_KERNEL::Exception(oss.str().c_str());
4915 std::copy(ptV,ptV+nbc,pt);
4919 throw INTERP_KERNEL::Exception(msg);
4924 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4929 for(int j=0;j<sz;j++)
4930 pt[slic.first+j*slic.second.second]=singleValV;
4935 if(sz!=(int)multiValV.size())
4937 std::ostringstream oss;
4938 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4939 throw INTERP_KERNEL::Exception(oss.str().c_str());
4941 for(int j=0;j<sz;j++)
4942 pt[slic.first+j*slic.second.second]=multiValV[j];
4947 const int *ptV=daIntTyyppV->getConstPointer();
4948 if(sz>daIntTyyppV->getNumberOfCompo())
4950 std::ostringstream oss;
4951 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4952 throw INTERP_KERNEL::Exception(oss.str().c_str());
4954 for(int j=0;j<sz;j++)
4955 pt[slic.first+j*slic.second.second]=ptV[j];
4959 throw INTERP_KERNEL::Exception(msg);
4963 throw INTERP_KERNEL::Exception(msg);
4969 class DataArrayChar : public DataArray
4972 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4973 int getHashCode() const throw(INTERP_KERNEL::Exception);
4974 bool empty() const throw(INTERP_KERNEL::Exception);
4975 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4976 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4977 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4978 char popBackSilent() throw(INTERP_KERNEL::Exception);
4979 void pack() const throw(INTERP_KERNEL::Exception);
4980 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4981 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4982 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4983 void reverse() throw(INTERP_KERNEL::Exception);
4984 void fillWithZero() throw(INTERP_KERNEL::Exception);
4985 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4986 std::string repr() const throw(INTERP_KERNEL::Exception);
4987 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4988 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4989 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4990 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4991 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4992 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4993 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4994 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4995 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4996 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4997 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4998 char front() const throw(INTERP_KERNEL::Exception);
4999 char back() const throw(INTERP_KERNEL::Exception);
5000 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5001 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
5002 char *getPointer() throw(INTERP_KERNEL::Exception);
5003 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
5004 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
5005 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5006 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
5007 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5008 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
5009 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
5010 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
5011 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
5012 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5013 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
5016 int __len__() const throw(INTERP_KERNEL::Exception)
5018 if(self->isAllocated())
5020 return self->getNumberOfTuples();
5024 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5028 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5031 bool ret0=self->isEqualIfNotWhy(other,ret1);
5032 PyObject *ret=PyTuple_New(2);
5033 PyObject *ret0Py=ret0?Py_True:Py_False;
5035 PyTuple_SetItem(ret,0,ret0Py);
5036 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5040 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5043 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5044 if (!SWIG_IsOK(res1))
5047 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5048 if(size!=self->getNumberOfTuples())
5050 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5052 return self->renumber(tmp);
5056 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5058 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5059 da2->checkAllocated();
5060 int size=self->getNumberOfTuples();
5061 if(size!=self->getNumberOfTuples())
5063 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5065 return self->renumber(da2->getConstPointer());
5069 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5072 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5073 if (!SWIG_IsOK(res1))
5076 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5077 if(size!=self->getNumberOfTuples())
5079 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5081 return self->renumberR(tmp);
5085 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5087 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5088 da2->checkAllocated();
5089 int size=self->getNumberOfTuples();
5090 if(size!=self->getNumberOfTuples())
5092 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5094 return self->renumberR(da2->getConstPointer());
5098 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5101 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
5102 if (!SWIG_IsOK(res1))
5105 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5106 if(size!=self->getNumberOfTuples())
5108 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5110 return self->renumberAndReduce(tmp,newNbOfTuple);
5114 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5116 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5117 da2->checkAllocated();
5118 int size=self->getNumberOfTuples();
5119 if(size!=self->getNumberOfTuples())
5121 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5123 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5127 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5129 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5130 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5131 return DataArrayChar::Aggregate(tmp);
5134 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5136 std::vector<const MEDCoupling::DataArrayChar *> tmp;
5137 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
5138 return DataArrayChar::Meld(tmp);
5143 class DataArrayByteIterator;
5145 class DataArrayByte : public DataArrayChar
5148 static DataArrayByte *New();
5149 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5150 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5151 char byteValue() const throw(INTERP_KERNEL::Exception);
5154 DataArrayByte() throw(INTERP_KERNEL::Exception)
5156 return DataArrayByte::New();
5159 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5161 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) !";
5162 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5166 if(PyInt_Check(nbOfTuples))
5168 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5170 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5173 if(PyInt_Check(nbOfComp))
5174 {//DataArrayByte.New([1,3,4,5],2,2)
5175 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5177 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5178 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5179 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5180 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5184 throw INTERP_KERNEL::Exception(msg);
5187 {//DataArrayByte.New([1,3,4],3)
5188 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5190 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5191 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5196 throw INTERP_KERNEL::Exception(msg);
5199 {// DataArrayByte.New([1,3,4])
5200 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5201 int tmpp1=-1,tmpp2=-1;
5202 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5203 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5207 else if(PyInt_Check(elt0))
5209 int nbOfTuples1=PyInt_AS_LONG(elt0);
5211 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5216 if(PyInt_Check(nbOfTuples))
5217 {//DataArrayByte.New(5,2)
5218 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5220 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5221 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5222 ret->alloc(nbOfTuples1,nbOfCompo);
5226 throw INTERP_KERNEL::Exception(msg);
5229 throw INTERP_KERNEL::Exception(msg);
5232 {//DataArrayByte.New(5)
5233 MCAuto<DataArrayByte> ret=DataArrayByte::New();
5234 ret->alloc(nbOfTuples1,1);
5239 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
5240 {//DataArrayDouble.New(numpyArray)
5241 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
5245 throw INTERP_KERNEL::Exception(msg);
5248 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5250 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5253 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5255 std::ostringstream oss;
5256 self->reprQuickOverview(oss);
5260 int __int__() const throw(INTERP_KERNEL::Exception)
5262 return (int) self->byteValue();
5265 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5267 return self->iterator();
5270 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5272 return (int)self->getIJ(tupleId,compoId);
5275 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5277 return (int)self->getIJSafe(tupleId,compoId);
5280 std::string __str__() const throw(INTERP_KERNEL::Exception)
5282 return self->repr();
5285 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5287 const char *vals=self->getConstPointer();
5288 int nbOfComp=self->getNumberOfComponents();
5289 int nbOfTuples=self->getNumberOfTuples();
5290 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5293 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5296 int ival=-1; std::vector<int> ivval;
5297 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5298 std::vector<char> vals(sz);
5299 std::copy(pt,pt+sz,vals.begin());
5300 return self->presenceOfTuple(vals);
5303 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5306 int ival=-1; std::vector<int> ivval;
5307 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5308 std::vector<char> vals2(sz);
5309 std::copy(pt,pt+sz,vals2.begin());
5310 return self->presenceOfValue(vals2);
5313 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5316 int ival=-1; std::vector<int> ivval;
5317 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5318 std::vector<char> vals2(sz);
5319 std::copy(pt,pt+sz,vals2.begin());
5320 return self->findIdFirstEqual(vals2);
5323 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5326 int ival=-1; std::vector<int> ivval;
5327 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5328 std::vector<char> vals(sz);
5329 std::copy(pt,pt+sz,vals.begin());
5330 return self->findIdFirstEqualTuple(vals);
5333 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5336 int ival=-1; std::vector<int> ivval;
5337 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5338 std::vector<char> vals(sz);
5339 std::copy(pt,pt+sz,vals.begin());
5340 return self->findIdSequence(vals);
5343 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5345 int sz=self->getNumberOfComponents();
5346 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5347 self->getTuple(tupleId,tmp);
5348 PyObject *ret=PyTuple_New(sz);
5349 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5353 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5356 int r1=(int)self->getMaxValue(tmp);
5357 PyObject *ret=PyTuple_New(2);
5358 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5359 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5363 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5366 int r1=(int)self->getMinValue(tmp);
5367 PyObject *ret=PyTuple_New(2);
5368 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5369 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5373 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5375 int nbOfCompo=self->getNumberOfComponents();
5380 if(PyInt_Check(obj))
5382 int val=(int)PyInt_AS_LONG(obj);
5383 return self->findIdFirstEqual(val);
5386 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5389 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5393 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5395 int nbOfCompo=self->getNumberOfComponents();
5402 if(PyInt_Check(obj))
5404 int val=(int)PyInt_AS_LONG(obj);
5405 return self->presenceOfValue(val);
5408 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5411 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5416 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5418 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5423 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5425 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5428 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5431 if(!self->isAllocated())
5432 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5433 PyObject *ret(PyTuple_New(1));
5434 PyObject *ret0(PyDict_New());
5435 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5436 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5437 PyObject *tmp1(PyInt_FromLong(0));
5438 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5439 PyTuple_SetItem(ret,0,ret0);
5443 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5447 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5449 self->checkAllocated();
5450 const char msg[]="Unexpected situation in __setitem__ !";
5451 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5454 std::vector<int> v1;
5456 DataArrayIntTuple *dd1=0;
5457 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5459 std::vector<int> vt1,vc1;
5460 std::pair<int, std::pair<int,int> > pt1,pc1;
5461 DataArrayInt *dt1=0,*dc1=0;
5462 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5463 MCAuto<DataArrayInt> tmp;
5471 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5474 throw INTERP_KERNEL::Exception(msg);
5483 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5486 throw INTERP_KERNEL::Exception(msg);
5495 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5498 throw INTERP_KERNEL::Exception(msg);
5507 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5510 throw INTERP_KERNEL::Exception(msg);
5519 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5522 throw INTERP_KERNEL::Exception(msg);
5531 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5534 throw INTERP_KERNEL::Exception(msg);
5543 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5546 throw INTERP_KERNEL::Exception(msg);
5555 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5558 throw INTERP_KERNEL::Exception(msg);
5567 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5570 throw INTERP_KERNEL::Exception(msg);
5579 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5582 throw INTERP_KERNEL::Exception(msg);
5591 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5594 throw INTERP_KERNEL::Exception(msg);
5603 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5606 throw INTERP_KERNEL::Exception(msg);
5615 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5618 throw INTERP_KERNEL::Exception(msg);
5627 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5630 throw INTERP_KERNEL::Exception(msg);
5639 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5642 throw INTERP_KERNEL::Exception(msg);
5651 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5654 throw INTERP_KERNEL::Exception(msg);
5659 throw INTERP_KERNEL::Exception(msg);
5666 class DataArrayByteTuple;
5668 class DataArrayByteIterator
5671 DataArrayByteIterator(DataArrayByte *da);
5672 ~DataArrayByteIterator();
5675 class DataArrayByteTuple
5678 std::string repr() const throw(INTERP_KERNEL::Exception);
5679 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5682 std::string __str__() const throw(INTERP_KERNEL::Exception)
5684 return self->repr();
5687 char __int__() const throw(INTERP_KERNEL::Exception)
5689 return self->byteValue();
5692 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5694 return self->buildDAByte(1,self->getNumberOfCompo());
5699 class DataArrayAsciiCharIterator;
5701 class DataArrayAsciiChar : public DataArrayChar
5704 static DataArrayAsciiChar *New();
5705 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5706 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5707 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5710 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5712 return DataArrayAsciiChar::New();
5715 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5717 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) !";
5718 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5722 if(PyInt_Check(nbOfTuples))
5724 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5726 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5729 if(PyInt_Check(nbOfComp))
5730 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5731 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5733 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5734 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5735 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5736 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5740 throw INTERP_KERNEL::Exception(msg);
5743 {//DataArrayAsciiChar.New([1,3,4],3)
5744 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5746 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5747 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5751 else if(PyString_Check(nbOfTuples))
5753 if(PyString_Size(nbOfTuples)!=1)
5754 throw INTERP_KERNEL::Exception(msg);
5755 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5756 std::vector<std::string> tmp;
5757 if(fillStringVector(elt0,tmp))
5758 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5760 throw INTERP_KERNEL::Exception(msg);
5763 throw INTERP_KERNEL::Exception(msg);
5767 std::vector<std::string> tmmp;
5768 if(fillStringVector(elt0,tmmp))
5769 //DataArrayAsciiChar.New(["abc","de","fghi"])
5770 return DataArrayAsciiChar::New(tmmp,' ');
5773 // DataArrayAsciiChar.New([1,3,4])
5774 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5775 int tmpp1=-1,tmpp2=-1;
5776 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5777 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5782 else if(PyInt_Check(elt0))
5784 int nbOfTuples1=PyInt_AS_LONG(elt0);
5786 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5791 if(PyInt_Check(nbOfTuples))
5792 {//DataArrayAsciiChar.New(5,2)
5793 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5795 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5796 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5797 ret->alloc(nbOfTuples1,nbOfCompo);
5801 throw INTERP_KERNEL::Exception(msg);
5804 throw INTERP_KERNEL::Exception(msg);
5807 {//DataArrayAsciiChar.New(5)
5808 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5809 ret->alloc(nbOfTuples1,1);
5814 throw INTERP_KERNEL::Exception(msg);
5817 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5819 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5822 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5824 std::ostringstream oss;
5825 self->reprQuickOverview(oss);
5829 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5831 return self->iterator();
5834 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5836 char tmp[2]; tmp[1]='\0';
5837 tmp[0]=self->getIJ(tupleId,compoId);
5838 return std::string(tmp);
5841 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5843 char tmp[2]; tmp[1]='\0';
5844 tmp[0]=self->getIJSafe(tupleId,compoId);
5845 return std::string(tmp);
5848 std::string __str__() const throw(INTERP_KERNEL::Exception)
5850 return self->repr();
5853 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5855 const char *vals=self->getConstPointer();
5856 int nbOfComp=self->getNumberOfComponents();
5857 int nbOfTuples=self->getNumberOfTuples();
5858 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5861 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5863 if(PyString_Check(tupl))
5865 Py_ssize_t sz=PyString_Size(tupl);
5866 std::vector<char> vals(sz);
5867 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5868 return self->presenceOfTuple(vals);
5871 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5874 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5876 if(PyString_Check(vals))
5878 Py_ssize_t sz=PyString_Size(vals);
5879 std::vector<char> vals2(sz);
5880 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5881 return self->presenceOfValue(vals2);
5884 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5887 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5889 if(PyString_Check(vals))
5891 Py_ssize_t sz=PyString_Size(vals);
5892 std::vector<char> vals2(sz);
5893 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5894 return self->findIdFirstEqual(vals2);
5897 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5900 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5902 if(PyString_Check(tupl))
5904 Py_ssize_t sz=PyString_Size(tupl);
5905 std::vector<char> vals(sz);
5906 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5907 return self->findIdFirstEqualTuple(vals);
5910 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5913 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5915 if(PyString_Check(strOrListOfInt))
5917 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5918 std::vector<char> vals(sz);
5919 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5920 return self->findIdSequence(vals);
5923 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5926 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5928 int sz=self->getNumberOfComponents();
5929 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5930 self->getTuple(tupleId,tmp);
5931 return PyString_FromString(tmp);
5934 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5937 char tmp2[2]; tmp2[1]='\0';
5938 tmp2[0]=self->getMaxValue(tmp);
5939 PyObject *ret=PyTuple_New(2);
5940 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5941 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5945 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5948 char tmp2[2]; tmp2[1]='\0';
5949 tmp2[0]=self->getMinValue(tmp);
5950 PyObject *ret=PyTuple_New(2);
5951 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5952 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5956 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5958 int nbOfCompo=self->getNumberOfComponents();
5963 if(PyString_Check(obj))
5965 Py_ssize_t sz=PyString_Size(obj);
5966 char *pt=PyString_AsString(obj);
5968 return self->findIdFirstEqual(pt[0]);
5970 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5973 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5976 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5980 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5982 int nbOfCompo=self->getNumberOfComponents();
5989 if(PyString_Check(obj))
5991 Py_ssize_t sz=PyString_Size(obj);
5992 char *pt=PyString_AsString(obj);
5994 return self->presenceOfValue(pt[0]);
5996 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5999 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
6002 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
6006 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
6009 std::vector<int> stdvecTyyppArr;
6010 std::pair<int, std::pair<int,int> > sTyyppArr;
6011 MEDCoupling::DataArrayInt *daIntTyypp=0;
6012 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6016 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
6018 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
6020 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
6022 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
6024 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
6028 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
6030 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.";
6032 std::vector<int> stdvecTyyppArr;
6033 std::pair<int, std::pair<int,int> > sTyyppArr;
6034 MEDCoupling::DataArrayInt *daIntTyypp=0;
6035 int nbOfCompo=self->getNumberOfComponents();
6036 int nbOfTuples=self->getNumberOfTuples();
6037 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
6039 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
6040 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
6049 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
6055 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6056 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6059 //value vector<string>
6062 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6063 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6066 //value DataArrayChar
6069 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6073 throw INTERP_KERNEL::Exception(msg);
6077 {//obj list-tuple[int]
6083 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6089 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6090 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6093 //value vector<string>
6096 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6097 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6100 //value DataArrayChar
6103 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6107 throw INTERP_KERNEL::Exception(msg);
6118 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6124 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6125 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6128 //value vector<string>
6131 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6132 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6135 //value DataArrayChar
6138 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6142 throw INTERP_KERNEL::Exception(msg);
6153 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6159 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6160 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6163 //value vector<string>
6166 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6167 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6170 //value DataArrayChar
6173 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6177 throw INTERP_KERNEL::Exception(msg);
6182 throw INTERP_KERNEL::Exception(msg);
6188 class DataArrayAsciiCharTuple;
6190 class DataArrayAsciiCharIterator
6193 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6194 ~DataArrayAsciiCharIterator();
6199 DataArrayAsciiCharTuple *ret=self->nextt();
6201 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6204 PyErr_SetString(PyExc_StopIteration,"No more data.");
6211 class DataArrayAsciiCharTuple
6214 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6215 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6218 std::string __str__() const throw(INTERP_KERNEL::Exception)
6220 return self->repr();
6223 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6225 return self->buildDAAsciiChar(1,self->getNumberOfCompo());