1 // Copyright (C) 2007-2013 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.
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)
23 class DataArray : public RefCountObject, public TimeLabel
26 void setName(const char *name);
27 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
28 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
29 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
30 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
31 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
32 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
33 std::string getName() const;
34 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
35 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
36 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
37 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
38 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
39 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
40 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
41 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
42 int getNumberOfComponents() const;
43 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
44 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
45 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
46 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
47 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
48 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
49 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
50 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
51 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
52 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
53 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
54 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
55 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
56 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
57 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
58 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
59 void updateTime() const;
62 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
64 const std::vector<std::string>& comps=self->getInfoOnComponents();
65 PyObject *ret=PyList_New((int)comps.size());
66 for(int i=0;i<(int)comps.size();i++)
67 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
71 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
74 convertPyToNewIntArr3(li,tmp);
75 self->copyPartOfStringInfoFrom(other,tmp);
78 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
81 convertPyToNewIntArr3(li,tmp);
82 self->copyPartOfStringInfoFrom2(tmp,other);
85 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
88 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
92 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
93 if(size!=self->getNumberOfTuples())
95 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
97 self->renumberInPlace(tmp);
101 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
103 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
104 da2->checkAllocated();
105 int size=self->getNumberOfTuples();
106 if(size!=self->getNumberOfTuples())
108 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
110 self->renumberInPlace(da2->getConstPointer());
114 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
117 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
118 if (!SWIG_IsOK(res1))
121 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
122 if(size!=self->getNumberOfTuples())
124 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
126 self->renumberInPlaceR(tmp);
130 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
132 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
133 da2->checkAllocated();
134 int size=self->getNumberOfTuples();
135 if(size!=self->getNumberOfTuples())
137 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
139 self->renumberInPlaceR(da2->getConstPointer());
143 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
144 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
146 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
147 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
148 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
149 DataArrayInt *tuplesSelecPtr2=0;
152 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
154 throw INTERP_KERNEL::Exception(msg);
156 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
159 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
161 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
162 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
165 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
167 std::vector<std::pair<int,int> > ranges;
168 convertPyToVectorPairInt(li,ranges);
169 return self->selectByTupleRanges(ranges);
172 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
174 std::vector<int> tmp;
175 convertPyToNewIntArr3(li,tmp);
176 DataArray *ret=self->keepSelectedComponents(tmp);
177 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
180 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
182 if(!PySlice_Check(slic))
183 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
184 Py_ssize_t strt=2,stp=2,step=2;
185 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
186 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
187 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
188 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
189 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
191 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
192 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
195 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
197 if(!PySlice_Check(slic))
198 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
199 Py_ssize_t strt=2,stp=2,step=2;
200 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
201 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
202 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
204 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
205 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
208 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
210 if(!PySlice_Check(slic))
211 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
212 Py_ssize_t strt=2,stp=2,step=2;
213 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
214 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
215 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
216 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
217 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
218 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
221 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
223 if(!PySlice_Check(slic))
224 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
225 Py_ssize_t strt=2,stp=2,step=2;
226 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
227 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
228 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
229 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
230 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
231 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
234 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
236 if(!PySlice_Check(slic))
237 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
238 Py_ssize_t strt=2,stp=2,step=2;
239 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
240 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
241 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
242 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
245 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
247 if(!PySlice_Check(slic))
248 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
249 Py_ssize_t strt=2,stp=2,step=2;
250 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
251 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
252 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
253 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
259 class DataArrayDoubleIterator;
261 class DataArrayDouble : public DataArray
264 static DataArrayDouble *New();
265 double doubleValue() const throw(INTERP_KERNEL::Exception);
266 bool empty() const throw(INTERP_KERNEL::Exception);
267 DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
268 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
269 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
270 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
271 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
272 void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
273 double popBackSilent() throw(INTERP_KERNEL::Exception);
274 void pack() const throw(INTERP_KERNEL::Exception);
275 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
276 void fillWithZero() throw(INTERP_KERNEL::Exception);
277 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
278 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
279 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
280 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
281 void reverse() throw(INTERP_KERNEL::Exception);
282 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
283 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
284 std::string repr() const throw(INTERP_KERNEL::Exception);
285 std::string reprZip() const throw(INTERP_KERNEL::Exception);
286 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
287 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
288 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
289 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
290 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
291 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
292 DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
293 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
294 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
295 void transpose() throw(INTERP_KERNEL::Exception);
296 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
297 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
298 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
299 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
300 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
301 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
302 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
303 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
304 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
305 double back() const throw(INTERP_KERNEL::Exception);
306 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
307 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
308 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
309 double *getPointer() throw(INTERP_KERNEL::Exception);
310 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
311 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
312 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
313 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
314 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
315 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
316 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
317 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
318 double getAverageValue() const throw(INTERP_KERNEL::Exception);
319 double norm2() const throw(INTERP_KERNEL::Exception);
320 double normMax() const throw(INTERP_KERNEL::Exception);
321 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
322 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
323 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
324 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
325 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
326 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
327 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
328 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
329 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
330 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
331 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
332 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
333 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
334 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
335 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
336 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
337 void abs() throw(INTERP_KERNEL::Exception);
338 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
339 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
340 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
341 void applyPow(double val) throw(INTERP_KERNEL::Exception);
342 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
343 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
344 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
345 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
346 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
347 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
348 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
349 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
350 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
351 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
352 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
353 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
354 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
355 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
356 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
357 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
358 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
359 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
360 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
361 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
362 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
363 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
364 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
365 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
366 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
367 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
370 DataArrayDouble() throw(INTERP_KERNEL::Exception)
372 return DataArrayDouble::New();
375 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
377 const char *msgBase="ParaMEDMEM::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)";
378 std::string msg(msgBase);
380 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
383 if(PyList_Check(elt0) || PyTuple_Check(elt0))
387 if(PyInt_Check(nbOfTuples))
389 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
391 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
394 if(PyInt_Check(elt2))
395 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
396 int nbOfCompo=PyInt_AS_LONG(elt2);
398 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
399 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
400 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
401 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
405 throw INTERP_KERNEL::Exception(msg.c_str());
408 {//DataArrayDouble.New([1.,3.,4.],3)
409 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
411 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
412 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
417 throw INTERP_KERNEL::Exception(msg.c_str());
420 {// DataArrayDouble.New([1.,3.,4.])
421 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
422 int tmpp1=-1,tmpp2=-1;
423 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
424 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
428 else if(PyInt_Check(elt0))
430 int nbOfTuples1=PyInt_AS_LONG(elt0);
432 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
437 if(PyInt_Check(nbOfTuples))
438 {//DataArrayDouble.New(5,2)
439 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
441 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
442 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
443 ret->alloc(nbOfTuples1,nbOfCompo);
447 throw INTERP_KERNEL::Exception(msg.c_str());
450 throw INTERP_KERNEL::Exception(msg.c_str());
453 {//DataArrayDouble.New(5)
454 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
455 ret->alloc(nbOfTuples1,1);
460 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
461 {//DataArrayDouble.New(numpyArray)
462 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
466 throw INTERP_KERNEL::Exception(msg.c_str());
469 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
471 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
474 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
477 std::vector<double> bb;
479 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
480 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
481 self->pushBackValsSilent(tmp,tmp+nbTuples);
484 std::string __repr__() const throw(INTERP_KERNEL::Exception)
486 std::ostringstream oss;
487 self->reprQuickOverview(oss);
491 std::string __str__() const throw(INTERP_KERNEL::Exception)
496 double __float__() const throw(INTERP_KERNEL::Exception)
498 return self->doubleValue();
501 int __len__() const throw(INTERP_KERNEL::Exception)
503 if(self->isAllocated())
505 return self->getNumberOfTuples();
509 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
513 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
515 return self->iterator();
518 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
520 const char *msg="ParaMEDMEM::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 !";
521 if(PyList_Check(li) || PyTuple_Check(li))
525 if(PyInt_Check(nbOfTuples))
527 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
529 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
532 if(PyInt_Check(nbOfComp))
533 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
534 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
536 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
537 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
538 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
541 throw INTERP_KERNEL::Exception(msg);
544 {//DataArrayDouble.setValues([1.,3.,4.],3)
546 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
547 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
551 throw INTERP_KERNEL::Exception(msg);
554 {// DataArrayDouble.setValues([1.,3.,4.])
555 int tmpp1=-1,tmpp2=-1;
556 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
557 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
561 throw INTERP_KERNEL::Exception(msg);
564 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
566 const double *vals=self->getConstPointer();
567 return convertDblArrToPyList(vals,self->getNbOfElems());
571 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
573 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
577 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
580 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
581 PyObject *ret=PyTuple_New(2);
582 PyObject *ret0Py=ret0?Py_True:Py_False;
584 PyTuple_SetItem(ret,0,ret0Py);
585 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
589 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
591 const double *vals=self->getConstPointer();
592 int nbOfComp=self->getNumberOfComponents();
593 int nbOfTuples=self->getNumberOfTuples();
594 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
597 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
600 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
601 if (!SWIG_IsOK(res1))
604 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
605 if(size!=self->getNumberOfTuples())
607 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
609 return self->renumber(tmp);
613 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
615 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
616 da2->checkAllocated();
617 int size=self->getNumberOfTuples();
618 if(size!=self->getNumberOfTuples())
620 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
622 return self->renumber(da2->getConstPointer());
626 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
629 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
630 if (!SWIG_IsOK(res1))
633 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
634 if(size!=self->getNumberOfTuples())
636 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
638 return self->renumberR(tmp);
642 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
644 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
645 da2->checkAllocated();
646 int size=self->getNumberOfTuples();
647 if(size!=self->getNumberOfTuples())
649 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
651 return self->renumberR(da2->getConstPointer());
655 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
658 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
659 if (!SWIG_IsOK(res1))
662 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
663 if(size!=self->getNumberOfTuples())
665 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
667 return self->renumberAndReduce(tmp,newNbOfTuple);
671 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
673 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
674 da2->checkAllocated();
675 int size=self->getNumberOfTuples();
676 if(size!=self->getNumberOfTuples())
678 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
680 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
684 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
687 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
688 if (!SWIG_IsOK(res1))
691 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
692 return self->selectByTupleId(tmp,tmp+size);
696 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
698 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
699 da2->checkAllocated();
700 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
704 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
707 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
708 if (!SWIG_IsOK(res1))
711 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
712 return self->selectByTupleIdSafe(tmp,tmp+size);
716 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
718 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
719 da2->checkAllocated();
720 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
724 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
726 int thisTupleId,otherTupleId;
727 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
728 PyObject *ret=PyTuple_New(3);
729 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
730 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
731 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
735 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
738 double r1=self->getMaxValue(tmp);
739 PyObject *ret=PyTuple_New(2);
740 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
741 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
745 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
748 double r1=self->getMaxValue2(tmp);
749 PyObject *ret=PyTuple_New(2);
750 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
751 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
755 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
758 double r1=self->getMinValue(tmp);
759 PyObject *ret=PyTuple_New(2);
760 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
761 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
765 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
768 double r1=self->getMinValue2(tmp);
769 PyObject *ret=PyTuple_New(2);
770 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
771 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
775 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
777 int nbOfCompo=self->getNumberOfComponents();
778 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
779 self->getMinMaxPerComponent(tmp);
780 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
784 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
786 int sz=self->getNumberOfComponents();
787 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
788 self->accumulate(tmp);
789 return convertDblArrToPyList(tmp,sz);
792 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
795 std::vector<int> val2;
796 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
797 return self->accumulatePerChunck(bg,bg+sz);
800 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
802 DataArrayInt *comm, *commIndex;
803 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
804 PyObject *res = PyList_New(2);
805 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
806 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
810 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
814 DataArrayDoubleTuple *aa;
815 std::vector<double> bb;
817 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
818 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
820 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
821 PyObject *ret=PyTuple_New(2);
822 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
823 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
827 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
829 std::vector<int> tmp;
830 convertPyToNewIntArr3(li,tmp);
831 self->setSelectedComponents(a,tmp);
834 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
836 int sz=self->getNumberOfComponents();
837 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
838 self->getTuple(tupleId,tmp);
839 return convertDblArrToPyList(tmp,sz);
842 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
844 std::vector<const DataArrayDouble *> tmp;
845 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
846 return DataArrayDouble::Aggregate(tmp);
849 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
851 std::vector<const DataArrayDouble *> tmp;
852 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
853 return DataArrayDouble::Meld(tmp);
856 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
860 DataArrayDoubleTuple *aa;
861 std::vector<double> bb;
863 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
864 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
865 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
866 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
867 DataArrayInt *c=0,*cI=0;
868 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
869 PyObject *ret=PyTuple_New(2);
870 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
871 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
875 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
877 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
878 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
879 self->checkAllocated();
880 int nbOfTuples=self->getNumberOfTuples();
881 int nbOfComponents=self->getNumberOfComponents();
883 std::vector<int> vt1,vc1;
884 std::pair<int, std::pair<int,int> > pt1,pc1;
885 DataArrayInt *dt1=0,*dc1=0;
887 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
888 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
892 if(nbOfComponents==1)
893 return PyFloat_FromDouble(self->getIJSafe(it1,0));
894 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
896 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
898 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
900 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
902 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
905 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
906 std::vector<int> v2(1,ic1);
907 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
911 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
912 std::vector<int> v2(1,ic1);
913 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
917 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
918 std::vector<int> v2(1,ic1);
919 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
923 ret=self->selectByTupleIdSafe(&it1,&it1+1);
924 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
928 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
929 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
933 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
934 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
938 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
939 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
943 ret=self->selectByTupleIdSafe(&it1,&it1+1);
944 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
945 std::vector<int> v2(nbOfComp);
946 for(int i=0;i<nbOfComp;i++)
947 v2[i]=pc1.first+i*pc1.second.second;
948 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
952 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
953 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
954 std::vector<int> v2(nbOfComp);
955 for(int i=0;i<nbOfComp;i++)
956 v2[i]=pc1.first+i*pc1.second.second;
957 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
961 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
962 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
963 std::vector<int> v2(nbOfComp);
964 for(int i=0;i<nbOfComp;i++)
965 v2[i]=pc1.first+i*pc1.second.second;
966 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
970 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
971 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
972 std::vector<int> v2(nbOfComp);
973 for(int i=0;i<nbOfComp;i++)
974 v2[i]=pc1.first+i*pc1.second.second;
975 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
978 throw INTERP_KERNEL::Exception(msg);
982 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
984 self->checkAllocated();
985 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
986 int nbOfTuples=self->getNumberOfTuples();
987 int nbOfComponents=self->getNumberOfComponents();
990 std::vector<double> v1;
991 DataArrayDouble *d1=0;
992 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
994 std::vector<int> vt1,vc1;
995 std::pair<int, std::pair<int,int> > pt1,pc1;
996 DataArrayInt *dt1=0,*dc1=0;
997 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
998 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1006 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1009 tmp=DataArrayDouble::New();
1010 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1011 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1014 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1017 throw INTERP_KERNEL::Exception(msg);
1026 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1029 tmp=DataArrayDouble::New();
1030 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1031 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1034 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1037 throw INTERP_KERNEL::Exception(msg);
1046 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1049 tmp=DataArrayDouble::New();
1050 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1051 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1054 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1057 throw INTERP_KERNEL::Exception(msg);
1066 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1069 tmp=DataArrayDouble::New();
1070 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1071 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1074 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1077 throw INTERP_KERNEL::Exception(msg);
1086 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1089 tmp=DataArrayDouble::New();
1090 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1091 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1094 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1097 throw INTERP_KERNEL::Exception(msg);
1106 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1109 tmp=DataArrayDouble::New();
1110 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1111 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1114 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1117 throw INTERP_KERNEL::Exception(msg);
1126 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1129 tmp=DataArrayDouble::New();
1130 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1131 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1134 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1137 throw INTERP_KERNEL::Exception(msg);
1146 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1149 tmp=DataArrayDouble::New();
1150 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1151 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1154 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1157 throw INTERP_KERNEL::Exception(msg);
1166 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1169 tmp=DataArrayDouble::New();
1170 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1171 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1174 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1177 throw INTERP_KERNEL::Exception(msg);
1186 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1189 tmp=DataArrayDouble::New();
1190 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1191 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1194 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1197 throw INTERP_KERNEL::Exception(msg);
1206 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1209 tmp=DataArrayDouble::New();
1210 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1211 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1214 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1217 throw INTERP_KERNEL::Exception(msg);
1226 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1229 tmp=DataArrayDouble::New();
1230 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1231 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1234 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1237 throw INTERP_KERNEL::Exception(msg);
1246 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1249 tmp=DataArrayDouble::New();
1250 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1251 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1254 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1257 throw INTERP_KERNEL::Exception(msg);
1266 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1269 tmp=DataArrayDouble::New();
1270 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1271 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1274 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1277 throw INTERP_KERNEL::Exception(msg);
1286 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1289 tmp=DataArrayDouble::New();
1290 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1291 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1294 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1297 throw INTERP_KERNEL::Exception(msg);
1306 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1309 tmp=DataArrayDouble::New();
1310 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1311 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1314 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1317 throw INTERP_KERNEL::Exception(msg);
1322 throw INTERP_KERNEL::Exception(msg);
1327 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1329 return self->negate();
1332 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1334 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1337 DataArrayDoubleTuple *aa;
1338 std::vector<double> bb;
1342 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1344 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1347 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1348 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1350 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1353 throw INTERP_KERNEL::Exception(msg);
1356 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1361 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1362 ret->applyLin(1.,val);
1363 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1367 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1371 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1372 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1376 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1377 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1380 throw INTERP_KERNEL::Exception(msg);
1384 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1386 const char msg[]="Unexpected situation in __radd__ !";
1389 DataArrayDoubleTuple *aa;
1390 std::vector<double> bb;
1392 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1397 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1398 ret->applyLin(1.,val);
1403 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1404 return DataArrayDouble::Add(self,aaa);
1408 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1409 return DataArrayDouble::Add(self,aaa);
1412 throw INTERP_KERNEL::Exception(msg);
1416 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1418 const char msg[]="Unexpected situation in __iadd__ !";
1421 DataArrayDoubleTuple *aa;
1422 std::vector<double> bb;
1424 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1429 self->applyLin(1.,val);
1430 Py_XINCREF(trueSelf);
1436 Py_XINCREF(trueSelf);
1441 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1442 self->addEqual(aaa);
1443 Py_XINCREF(trueSelf);
1448 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1449 self->addEqual(aaa);
1450 Py_XINCREF(trueSelf);
1454 throw INTERP_KERNEL::Exception(msg);
1458 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1460 const char msg[]="Unexpected situation in __sub__ !";
1463 DataArrayDoubleTuple *aa;
1464 std::vector<double> bb;
1468 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1470 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1473 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1474 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1476 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1479 throw INTERP_KERNEL::Exception(msg);
1482 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1487 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1488 ret->applyLin(1.,-val);
1489 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1493 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1497 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1498 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1502 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1503 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1506 throw INTERP_KERNEL::Exception(msg);
1510 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1512 const char msg[]="Unexpected situation in __rsub__ !";
1515 DataArrayDoubleTuple *aa;
1516 std::vector<double> bb;
1518 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1523 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1524 ret->applyLin(-1.,val);
1529 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1530 return DataArrayDouble::Substract(aaa,self);
1534 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1535 return DataArrayDouble::Substract(aaa,self);
1538 throw INTERP_KERNEL::Exception(msg);
1542 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1544 const char msg[]="Unexpected situation in __isub__ !";
1547 DataArrayDoubleTuple *aa;
1548 std::vector<double> bb;
1550 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1555 self->applyLin(1,-val);
1556 Py_XINCREF(trueSelf);
1561 self->substractEqual(a);
1562 Py_XINCREF(trueSelf);
1567 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1568 self->substractEqual(aaa);
1569 Py_XINCREF(trueSelf);
1574 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1575 self->substractEqual(aaa);
1576 Py_XINCREF(trueSelf);
1580 throw INTERP_KERNEL::Exception(msg);
1584 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1586 const char msg[]="Unexpected situation in __mul__ !";
1589 DataArrayDoubleTuple *aa;
1590 std::vector<double> bb;
1594 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1596 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1599 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1600 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1602 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1605 throw INTERP_KERNEL::Exception(msg);
1608 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1613 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1614 ret->applyLin(val,0.);
1615 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1619 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1623 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1624 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1628 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1629 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1632 throw INTERP_KERNEL::Exception(msg);
1636 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1638 const char msg[]="Unexpected situation in __rmul__ !";
1641 DataArrayDoubleTuple *aa;
1642 std::vector<double> bb;
1644 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1649 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1650 ret->applyLin(val,0.);
1655 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1656 return DataArrayDouble::Multiply(self,aaa);
1660 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1661 return DataArrayDouble::Multiply(self,aaa);
1664 throw INTERP_KERNEL::Exception(msg);
1668 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1670 const char msg[]="Unexpected situation in __imul__ !";
1673 DataArrayDoubleTuple *aa;
1674 std::vector<double> bb;
1676 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1681 self->applyLin(val,0.);
1682 Py_XINCREF(trueSelf);
1687 self->multiplyEqual(a);
1688 Py_XINCREF(trueSelf);
1693 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1694 self->multiplyEqual(aaa);
1695 Py_XINCREF(trueSelf);
1700 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1701 self->multiplyEqual(aaa);
1702 Py_XINCREF(trueSelf);
1706 throw INTERP_KERNEL::Exception(msg);
1710 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1712 const char msg[]="Unexpected situation in __div__ !";
1715 DataArrayDoubleTuple *aa;
1716 std::vector<double> bb;
1720 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1722 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1725 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1726 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1728 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1731 throw INTERP_KERNEL::Exception(msg);
1734 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1740 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1741 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1742 ret->applyLin(1/val,0.);
1743 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1747 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1751 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1752 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1756 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1757 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1760 throw INTERP_KERNEL::Exception(msg);
1764 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1766 const char msg[]="Unexpected situation in __rdiv__ !";
1769 DataArrayDoubleTuple *aa;
1770 std::vector<double> bb;
1772 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1777 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1783 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1784 return DataArrayDouble::Divide(aaa,self);
1788 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1789 return DataArrayDouble::Divide(aaa,self);
1792 throw INTERP_KERNEL::Exception(msg);
1796 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1798 const char msg[]="Unexpected situation in __idiv__ !";
1801 DataArrayDoubleTuple *aa;
1802 std::vector<double> bb;
1804 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1810 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1811 self->applyLin(1./val,0.);
1812 Py_XINCREF(trueSelf);
1817 self->divideEqual(a);
1818 Py_XINCREF(trueSelf);
1823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1824 self->divideEqual(aaa);
1825 Py_XINCREF(trueSelf);
1830 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1831 self->divideEqual(aaa);
1832 Py_XINCREF(trueSelf);
1836 throw INTERP_KERNEL::Exception(msg);
1840 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1842 const char msg[]="Unexpected situation in __pow__ !";
1845 DataArrayDoubleTuple *aa;
1846 std::vector<double> bb;
1848 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1853 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1859 return DataArrayDouble::Pow(self,a);
1863 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1864 return DataArrayDouble::Pow(self,aaa);
1868 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1869 return DataArrayDouble::Pow(self,aaa);
1872 throw INTERP_KERNEL::Exception(msg);
1876 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1878 const char msg[]="Unexpected situation in __rpow__ !";
1881 DataArrayDoubleTuple *aa;
1882 std::vector<double> bb;
1884 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1890 ret->applyRPow(val);
1895 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1896 return DataArrayDouble::Pow(aaa,self);
1900 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1901 return DataArrayDouble::Pow(aaa,self);
1904 throw INTERP_KERNEL::Exception(msg);
1908 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1910 const char msg[]="Unexpected situation in __ipow__ !";
1913 DataArrayDoubleTuple *aa;
1914 std::vector<double> bb;
1916 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1921 self->applyPow(val);
1922 Py_XINCREF(trueSelf);
1928 Py_XINCREF(trueSelf);
1933 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1934 self->powEqual(aaa);
1935 Py_XINCREF(trueSelf);
1940 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1941 self->powEqual(aaa);
1942 Py_XINCREF(trueSelf);
1946 throw INTERP_KERNEL::Exception(msg);
1950 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1952 DataArrayInt *c=0,*cI=0;
1954 self->computeTupleIdsNearTuples(other,eps,c,cI);
1955 PyObject *ret=PyTuple_New(2);
1956 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1957 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1961 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1963 DataArrayInt *ret1=0;
1964 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1965 PyObject *ret=PyTuple_New(2);
1966 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1967 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1973 class DataArrayDoubleTuple;
1975 class DataArrayDoubleIterator
1978 DataArrayDoubleIterator(DataArrayDouble *da);
1979 ~DataArrayDoubleIterator();
1984 DataArrayDoubleTuple *ret=self->nextt();
1986 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1989 PyErr_SetString(PyExc_StopIteration,"No more data.");
1996 class DataArrayDoubleTuple
1999 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2000 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2003 std::string __str__() const throw(INTERP_KERNEL::Exception)
2005 return self->repr();
2008 double __float__() const throw(INTERP_KERNEL::Exception)
2010 return self->doubleValue();
2013 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2015 return self->buildDADouble(1,self->getNumberOfCompo());
2018 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2020 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2021 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2022 Py_XINCREF(trueSelf);
2026 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2028 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2029 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2030 Py_XINCREF(trueSelf);
2034 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2036 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2037 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2038 Py_XINCREF(trueSelf);
2042 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2044 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2045 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2046 Py_XINCREF(trueSelf);
2050 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2052 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2055 std::vector<int> multiVal;
2056 std::pair<int, std::pair<int,int> > slic;
2057 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2058 const double *pt=self->getConstPointer();
2059 int nbc=self->getNumberOfCompo();
2060 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2067 std::ostringstream oss;
2068 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2069 throw INTERP_KERNEL::Exception(oss.str().c_str());
2072 return PyFloat_FromDouble(pt[singleVal]);
2076 return PyFloat_FromDouble(pt[nbc+singleVal]);
2079 std::ostringstream oss;
2080 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2081 throw INTERP_KERNEL::Exception(oss.str().c_str());
2087 PyObject *t=PyTuple_New(multiVal.size());
2088 for(int j=0;j<(int)multiVal.size();j++)
2090 int cid=multiVal[j];
2093 std::ostringstream oss;
2094 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2095 throw INTERP_KERNEL::Exception(oss.str().c_str());
2097 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2103 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2104 PyObject *t=PyTuple_New(sz);
2105 for(int j=0;j<sz;j++)
2106 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2110 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2114 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2116 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2117 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2120 std::vector<double> multiValV;
2121 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2122 int nbc=self->getNumberOfCompo();
2123 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2125 std::vector<int> multiVal;
2126 std::pair<int, std::pair<int,int> > slic;
2127 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2128 double *pt=self->getPointer();
2129 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2136 std::ostringstream oss;
2137 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2138 throw INTERP_KERNEL::Exception(oss.str().c_str());
2144 pt[singleVal]=singleValV;
2149 if(multiValV.size()!=1)
2151 std::ostringstream oss;
2152 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2153 throw INTERP_KERNEL::Exception(oss.str().c_str());
2155 pt[singleVal]=multiValV[0];
2160 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2164 throw INTERP_KERNEL::Exception(msg);
2173 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2177 std::ostringstream oss;
2178 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2179 throw INTERP_KERNEL::Exception(oss.str().c_str());
2187 if(multiVal.size()!=multiValV.size())
2189 std::ostringstream oss;
2190 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2191 throw INTERP_KERNEL::Exception(oss.str().c_str());
2193 for(int i=0;i<(int)multiVal.size();i++)
2195 int pos=multiVal[i];
2198 std::ostringstream oss;
2199 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2200 throw INTERP_KERNEL::Exception(oss.str().c_str());
2202 pt[multiVal[i]]=multiValV[i];
2208 const double *ptV=daIntTyyppV->getConstPointer();
2209 if(nbc>daIntTyyppV->getNumberOfCompo())
2211 std::ostringstream oss;
2212 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2213 throw INTERP_KERNEL::Exception(oss.str().c_str());
2215 std::copy(ptV,ptV+nbc,pt);
2219 throw INTERP_KERNEL::Exception(msg);
2224 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2229 for(int j=0;j<sz;j++)
2230 pt[slic.first+j*slic.second.second]=singleValV;
2235 if(sz!=(int)multiValV.size())
2237 std::ostringstream oss;
2238 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2239 throw INTERP_KERNEL::Exception(oss.str().c_str());
2241 for(int j=0;j<sz;j++)
2242 pt[slic.first+j*slic.second.second]=multiValV[j];
2247 const double *ptV=daIntTyyppV->getConstPointer();
2248 if(sz>daIntTyyppV->getNumberOfCompo())
2250 std::ostringstream oss;
2251 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2252 throw INTERP_KERNEL::Exception(oss.str().c_str());
2254 for(int j=0;j<sz;j++)
2255 pt[slic.first+j*slic.second.second]=ptV[j];
2259 throw INTERP_KERNEL::Exception(msg);
2263 throw INTERP_KERNEL::Exception(msg);
2269 class DataArrayIntIterator;
2271 class DataArrayInt : public DataArray
2274 static DataArrayInt *New();
2275 int intValue() const throw(INTERP_KERNEL::Exception);
2276 int getHashCode() const throw(INTERP_KERNEL::Exception);
2277 bool empty() const throw(INTERP_KERNEL::Exception);
2278 DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
2279 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2280 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2281 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2282 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2283 int popBackSilent() throw(INTERP_KERNEL::Exception);
2284 void pack() const throw(INTERP_KERNEL::Exception);
2285 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2286 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2287 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2288 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2289 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2290 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2291 void reverse() throw(INTERP_KERNEL::Exception);
2292 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2293 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2294 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2295 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2296 void fillWithZero() throw(INTERP_KERNEL::Exception);
2297 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2298 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2299 std::string repr() const throw(INTERP_KERNEL::Exception);
2300 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2301 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2302 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2303 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2304 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
2305 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2306 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2307 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2308 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2311 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2312 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2313 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2314 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
2315 void transpose() throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2317 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2318 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2319 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2320 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2321 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2322 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2323 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2324 int back() const throw(INTERP_KERNEL::Exception);
2325 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2326 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2327 int *getPointer() throw(INTERP_KERNEL::Exception);
2328 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2329 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2330 const int *begin() const throw(INTERP_KERNEL::Exception);
2331 const int *end() const throw(INTERP_KERNEL::Exception);
2332 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2333 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2334 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2335 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2336 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2337 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2338 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2339 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2340 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2341 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2342 int count(int value) const throw(INTERP_KERNEL::Exception);
2343 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2344 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2345 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2346 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2347 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2348 void abs() throw(INTERP_KERNEL::Exception);
2349 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2350 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2351 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2352 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2353 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2354 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2355 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2356 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2357 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2358 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2359 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2360 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2361 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2362 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2363 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2364 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2365 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2367 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2372 void computeOffsets() throw(INTERP_KERNEL::Exception);
2373 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2374 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2375 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2377 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2379 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2380 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2381 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2382 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2383 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2384 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2385 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2386 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2388 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2390 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2392 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2395 DataArrayInt() throw(INTERP_KERNEL::Exception)
2397 return DataArrayInt::New();
2400 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2402 const char *msgBase="ParaMEDMEM::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)";
2403 std::string msg(msgBase);
2405 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2408 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2412 if(PyInt_Check(nbOfTuples))
2414 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2416 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2419 if(PyInt_Check(nbOfComp))
2420 {//DataArrayInt.New([1,3,4,5],2,2)
2421 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2423 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2424 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2425 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2426 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2430 throw INTERP_KERNEL::Exception(msg.c_str());
2433 {//DataArrayInt.New([1,3,4],3)
2434 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2436 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2437 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2442 throw INTERP_KERNEL::Exception(msg.c_str());
2445 {// DataArrayInt.New([1,3,4])
2446 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2447 int tmpp1=-1,tmpp2=-1;
2448 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2449 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2453 else if(PyInt_Check(elt0))
2455 int nbOfTuples1=PyInt_AS_LONG(elt0);
2457 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2462 if(PyInt_Check(nbOfTuples))
2463 {//DataArrayInt.New(5,2)
2464 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2466 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2467 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2468 ret->alloc(nbOfTuples1,nbOfCompo);
2472 throw INTERP_KERNEL::Exception(msg.c_str());
2475 throw INTERP_KERNEL::Exception(msg.c_str());
2478 {//DataArrayInt.New(5)
2479 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2480 ret->alloc(nbOfTuples1,1);
2485 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2486 {//DataArrayInt.New(numpyArray)
2487 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
2491 throw INTERP_KERNEL::Exception(msg.c_str());
2494 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2496 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2499 std::string __str__() const throw(INTERP_KERNEL::Exception)
2501 return self->repr();
2504 int __len__() const throw(INTERP_KERNEL::Exception)
2506 if(self->isAllocated())
2508 return self->getNumberOfTuples();
2512 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2516 int __int__() const throw(INTERP_KERNEL::Exception)
2518 return self->intValue();
2521 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2523 return self->iterator();
2526 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2528 int sz=self->getNumberOfComponents();
2529 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2530 self->accumulate(tmp);
2531 return convertIntArrToPyList(tmp,sz);
2534 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2537 std::vector<int> val2;
2538 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2539 return self->accumulatePerChunck(bg,bg+sz);
2542 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2544 int newNbOfTuples=-1;
2545 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2546 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2547 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2548 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2549 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2550 PyObject *ret=PyTuple_New(2);
2551 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2552 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2556 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2558 const char *msg="ParaMEDMEM::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 !";
2559 if(PyList_Check(li) || PyTuple_Check(li))
2563 if(PyInt_Check(nbOfTuples))
2565 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2567 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2570 if(PyInt_Check(nbOfComp))
2571 {//DataArrayInt.setValues([1,3,4,5],2,2)
2572 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2574 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2575 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2576 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2579 throw INTERP_KERNEL::Exception(msg);
2582 {//DataArrayInt.setValues([1,3,4],3)
2584 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2585 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2589 throw INTERP_KERNEL::Exception(msg);
2592 {// DataArrayInt.setValues([1,3,4])
2593 int tmpp1=-1,tmpp2=-1;
2594 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2595 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2599 throw INTERP_KERNEL::Exception(msg);
2602 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2604 const int *vals=self->getConstPointer();
2605 return convertIntArrToPyList(vals,self->getNbOfElems());
2609 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2611 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT,"DataArrayInt");
2615 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2618 bool ret0=self->isEqualIfNotWhy(other,ret1);
2619 PyObject *ret=PyTuple_New(2);
2620 PyObject *ret0Py=ret0?Py_True:Py_False;
2622 PyTuple_SetItem(ret,0,ret0Py);
2623 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2627 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2629 const int *vals=self->getConstPointer();
2630 int nbOfComp=self->getNumberOfComponents();
2631 int nbOfTuples=self->getNumberOfTuples();
2632 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2635 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2637 std::vector<const DataArrayInt *> groups;
2638 std::vector< std::vector<int> > fidsOfGroups;
2639 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2640 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2641 PyObject *ret = PyList_New(2);
2642 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2643 int sz=fidsOfGroups.size();
2644 PyObject *ret1 = PyList_New(sz);
2645 for(int i=0;i<sz;i++)
2646 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2647 PyList_SetItem(ret,1,ret1);
2651 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2654 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2655 if (!SWIG_IsOK(res1))
2658 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2659 self->transformWithIndArr(tmp,tmp+size);
2663 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2664 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2668 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2672 std::vector<int> multiVal;
2673 std::pair<int, std::pair<int,int> > slic;
2674 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2675 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2679 return self->getIdsEqualList(&singleVal,&singleVal+1);
2681 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2683 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2685 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2689 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2693 std::vector<int> multiVal;
2694 std::pair<int, std::pair<int,int> > slic;
2695 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2696 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2700 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2702 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2704 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2706 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2710 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2712 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2714 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2715 if (!SWIG_IsOK(res1))
2718 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2719 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2723 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2725 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2726 da2->checkAllocated();
2727 int size=self->getNumberOfTuples();
2728 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2730 PyObject *ret = PyList_New(3);
2731 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2732 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2733 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2737 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2740 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2741 if (!SWIG_IsOK(res1))
2744 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2745 return self->transformWithIndArrR(tmp,tmp+size);
2749 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2750 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2754 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2757 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2758 if (!SWIG_IsOK(res1))
2761 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2762 if(size!=self->getNumberOfTuples())
2764 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2766 return self->renumberAndReduce(tmp,newNbOfTuple);
2770 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2772 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2773 da2->checkAllocated();
2774 int size=self->getNumberOfTuples();
2775 if(size!=self->getNumberOfTuples())
2777 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2779 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2783 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2786 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2787 if (!SWIG_IsOK(res1))
2790 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2791 if(size!=self->getNumberOfTuples())
2793 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2795 return self->renumber(tmp);
2799 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2801 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2802 da2->checkAllocated();
2803 int size=self->getNumberOfTuples();
2804 if(size!=self->getNumberOfTuples())
2806 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2808 return self->renumber(da2->getConstPointer());
2812 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2815 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2816 if (!SWIG_IsOK(res1))
2819 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2820 if(size!=self->getNumberOfTuples())
2822 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2824 return self->renumberR(tmp);
2828 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2830 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2831 da2->checkAllocated();
2832 int size=self->getNumberOfTuples();
2833 if(size!=self->getNumberOfTuples())
2835 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2837 return self->renumberR(da2->getConstPointer());
2841 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2844 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2845 if (!SWIG_IsOK(res1))
2848 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2849 return self->selectByTupleId(tmp,tmp+size);
2853 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2855 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2856 da2->checkAllocated();
2857 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2861 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2864 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2865 if (!SWIG_IsOK(res1))
2868 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2869 return self->selectByTupleIdSafe(tmp,tmp+size);
2873 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2875 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2876 da2->checkAllocated();
2877 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2881 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2883 std::vector<int> tmp;
2884 convertPyToNewIntArr3(li,tmp);
2885 self->setSelectedComponents(a,tmp);
2888 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2890 int sz=self->getNumberOfComponents();
2891 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2892 self->getTuple(tupleId,tmp);
2893 return convertIntArrToPyList(tmp,sz);
2896 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2898 DataArrayInt *arr=0;
2899 DataArrayInt *arrI=0;
2900 self->changeSurjectiveFormat(targetNb,arr,arrI);
2901 PyObject *res = PyList_New(2);
2902 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2903 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2907 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2909 std::vector<const DataArrayInt *> tmp;
2910 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2911 return DataArrayInt::Meld(tmp);
2914 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2916 std::vector<const DataArrayInt *> tmp;
2917 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2918 return DataArrayInt::Aggregate(tmp);
2921 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2923 std::vector<const DataArrayInt *> tmp;
2924 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2925 return DataArrayInt::BuildUnion(tmp);
2928 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2930 std::vector<const DataArrayInt *> tmp;
2931 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2932 return DataArrayInt::BuildIntersection(tmp);
2935 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2938 int r1=self->getMaxValue(tmp);
2939 PyObject *ret=PyTuple_New(2);
2940 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2941 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2945 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2948 int r1=self->getMinValue(tmp);
2949 PyObject *ret=PyTuple_New(2);
2950 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2951 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2955 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2957 int nbOfCompo=self->getNumberOfComponents();
2962 if(PyInt_Check(obj))
2964 int val=(int)PyInt_AS_LONG(obj);
2965 return self->locateValue(val);
2968 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2972 std::vector<int> arr;
2973 convertPyToNewIntArr3(obj,arr);
2974 return self->locateTuple(arr);
2979 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2981 int nbOfCompo=self->getNumberOfComponents();
2988 if(PyInt_Check(obj))
2990 int val=(int)PyInt_AS_LONG(obj);
2991 return self->presenceOfValue(val);
2994 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
2998 std::vector<int> arr;
2999 convertPyToNewIntArr3(obj,arr);
3000 return self->presenceOfTuple(arr);
3005 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3007 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3008 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3009 self->checkAllocated();
3010 int nbOfTuples=self->getNumberOfTuples();
3011 int nbOfComponents=self->getNumberOfComponents();
3013 std::vector<int> vt1,vc1;
3014 std::pair<int, std::pair<int,int> > pt1,pc1;
3015 DataArrayInt *dt1=0,*dc1=0;
3017 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3018 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3023 if(nbOfComponents==1)
3024 return PyInt_FromLong(self->getIJSafe(it1,0));
3025 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3028 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3030 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3032 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3034 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3037 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3038 std::vector<int> v2(1,ic1);
3039 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3043 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3044 std::vector<int> v2(1,ic1);
3045 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3049 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3050 std::vector<int> v2(1,ic1);
3051 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3055 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3056 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3060 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3061 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3065 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3066 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3070 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3071 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3075 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3076 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3077 std::vector<int> v2(nbOfComp);
3078 for(int i=0;i<nbOfComp;i++)
3079 v2[i]=pc1.first+i*pc1.second.second;
3080 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3084 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3085 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3086 std::vector<int> v2(nbOfComp);
3087 for(int i=0;i<nbOfComp;i++)
3088 v2[i]=pc1.first+i*pc1.second.second;
3089 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3093 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3094 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3095 std::vector<int> v2(nbOfComp);
3096 for(int i=0;i<nbOfComp;i++)
3097 v2[i]=pc1.first+i*pc1.second.second;
3098 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3102 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3103 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3104 std::vector<int> v2(nbOfComp);
3105 for(int i=0;i<nbOfComp;i++)
3106 v2[i]=pc1.first+i*pc1.second.second;
3107 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3110 throw INTERP_KERNEL::Exception(msg);
3114 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3116 self->checkAllocated();
3117 const char msg[]="Unexpected situation in __setitem__ !";
3118 int nbOfTuples=self->getNumberOfTuples();
3119 int nbOfComponents=self->getNumberOfComponents();
3122 std::vector<int> v1;
3124 DataArrayIntTuple *dd1=0;
3125 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3127 std::vector<int> vt1,vc1;
3128 std::pair<int, std::pair<int,int> > pt1,pc1;
3129 DataArrayInt *dt1=0,*dc1=0;
3130 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3139 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3142 tmp=DataArrayInt::New();
3143 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3144 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3147 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3150 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3151 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3154 throw INTERP_KERNEL::Exception(msg);
3163 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3166 tmp=DataArrayInt::New();
3167 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3168 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3171 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3174 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3175 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3178 throw INTERP_KERNEL::Exception(msg);
3187 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3190 tmp=DataArrayInt::New();
3191 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3192 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3195 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3198 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3199 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3202 throw INTERP_KERNEL::Exception(msg);
3211 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3214 tmp=DataArrayInt::New();
3215 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3216 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3219 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3222 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3223 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3226 throw INTERP_KERNEL::Exception(msg);
3235 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3238 tmp=DataArrayInt::New();
3239 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3240 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3243 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3246 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3247 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3250 throw INTERP_KERNEL::Exception(msg);
3259 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3262 tmp=DataArrayInt::New();
3263 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3264 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3267 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3270 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3271 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3274 throw INTERP_KERNEL::Exception(msg);
3283 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3286 tmp=DataArrayInt::New();
3287 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3288 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3291 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3294 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3295 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3298 throw INTERP_KERNEL::Exception(msg);
3307 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3310 tmp=DataArrayInt::New();
3311 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3312 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3315 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3318 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3319 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3322 throw INTERP_KERNEL::Exception(msg);
3331 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3334 tmp=DataArrayInt::New();
3335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3336 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3339 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3342 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3343 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3346 throw INTERP_KERNEL::Exception(msg);
3355 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3358 tmp=DataArrayInt::New();
3359 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3360 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3363 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3366 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3367 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3370 throw INTERP_KERNEL::Exception(msg);
3379 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3382 tmp=DataArrayInt::New();
3383 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3384 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3387 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3390 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3391 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3394 throw INTERP_KERNEL::Exception(msg);
3403 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3406 tmp=DataArrayInt::New();
3407 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3408 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3411 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3414 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3415 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3418 throw INTERP_KERNEL::Exception(msg);
3427 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3430 tmp=DataArrayInt::New();
3431 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3432 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3435 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3438 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3439 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3442 throw INTERP_KERNEL::Exception(msg);
3451 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3454 tmp=DataArrayInt::New();
3455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3456 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3459 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3462 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3463 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3466 throw INTERP_KERNEL::Exception(msg);
3475 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3478 tmp=DataArrayInt::New();
3479 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3480 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3483 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3486 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3487 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3490 throw INTERP_KERNEL::Exception(msg);
3499 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3502 tmp=DataArrayInt::New();
3503 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3504 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3507 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3510 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3511 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3514 throw INTERP_KERNEL::Exception(msg);
3519 throw INTERP_KERNEL::Exception(msg);
3524 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3526 return self->negate();
3529 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3531 const char msg[]="Unexpected situation in __add__ !";
3534 std::vector<int> aa;
3535 DataArrayIntTuple *aaa;
3537 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3542 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3543 ret->applyLin(1,val);
3548 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3549 return DataArrayInt::Add(self,aaaa);
3553 return DataArrayInt::Add(self,a);
3557 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3558 return DataArrayInt::Add(self,aaaa);
3561 throw INTERP_KERNEL::Exception(msg);
3565 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3567 const char msg[]="Unexpected situation in __radd__ !";
3570 std::vector<int> aa;
3571 DataArrayIntTuple *aaa;
3573 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3578 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3579 ret->applyLin(1,val);
3584 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3585 return DataArrayInt::Add(self,aaaa);
3589 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3590 return DataArrayInt::Add(self,aaaa);
3593 throw INTERP_KERNEL::Exception(msg);
3597 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3599 const char msg[]="Unexpected situation in __iadd__ !";
3602 std::vector<int> aa;
3603 DataArrayIntTuple *aaa;
3605 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3610 self->applyLin(1,val);
3611 Py_XINCREF(trueSelf);
3616 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3618 Py_XINCREF(trueSelf);
3624 Py_XINCREF(trueSelf);
3629 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3630 self->addEqual(aaaa);
3631 Py_XINCREF(trueSelf);
3635 throw INTERP_KERNEL::Exception(msg);
3639 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3641 const char msg[]="Unexpected situation in __sub__ !";
3644 std::vector<int> aa;
3645 DataArrayIntTuple *aaa;
3647 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3652 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3653 ret->applyLin(1,-val);
3658 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3659 return DataArrayInt::Substract(self,aaaa);
3663 return DataArrayInt::Substract(self,a);
3667 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3668 return DataArrayInt::Substract(self,aaaa);
3671 throw INTERP_KERNEL::Exception(msg);
3675 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3677 const char msg[]="Unexpected situation in __rsub__ !";
3680 std::vector<int> aa;
3681 DataArrayIntTuple *aaa;
3683 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3689 ret->applyLin(-1,val);
3694 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3695 return DataArrayInt::Substract(aaaa,self);
3699 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3700 return DataArrayInt::Substract(aaaa,self);
3703 throw INTERP_KERNEL::Exception(msg);
3707 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3709 const char msg[]="Unexpected situation in __isub__ !";
3712 std::vector<int> aa;
3713 DataArrayIntTuple *aaa;
3715 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3720 self->applyLin(1,-val);
3721 Py_XINCREF(trueSelf);
3726 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3727 self->substractEqual(bb);
3728 Py_XINCREF(trueSelf);
3733 self->substractEqual(a);
3734 Py_XINCREF(trueSelf);
3739 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3740 self->substractEqual(aaaa);
3741 Py_XINCREF(trueSelf);
3745 throw INTERP_KERNEL::Exception(msg);
3749 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3751 const char msg[]="Unexpected situation in __mul__ !";
3754 std::vector<int> aa;
3755 DataArrayIntTuple *aaa;
3757 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3762 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3763 ret->applyLin(val,0);
3768 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3769 return DataArrayInt::Multiply(self,aaaa);
3773 return DataArrayInt::Multiply(self,a);
3777 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3778 return DataArrayInt::Multiply(self,aaaa);
3781 throw INTERP_KERNEL::Exception(msg);
3785 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3787 const char msg[]="Unexpected situation in __rmul__ !";
3790 std::vector<int> aa;
3791 DataArrayIntTuple *aaa;
3793 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3798 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3799 ret->applyLin(val,0);
3804 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3805 return DataArrayInt::Multiply(self,aaaa);
3809 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3810 return DataArrayInt::Multiply(self,aaaa);
3813 throw INTERP_KERNEL::Exception(msg);
3817 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3819 const char msg[]="Unexpected situation in __imul__ !";
3822 std::vector<int> aa;
3823 DataArrayIntTuple *aaa;
3825 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3830 self->applyLin(val,0);
3831 Py_XINCREF(trueSelf);
3836 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3837 self->multiplyEqual(bb);
3838 Py_XINCREF(trueSelf);
3843 self->multiplyEqual(a);
3844 Py_XINCREF(trueSelf);
3849 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3850 self->multiplyEqual(aaaa);
3851 Py_XINCREF(trueSelf);
3855 throw INTERP_KERNEL::Exception(msg);
3859 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3861 const char msg[]="Unexpected situation in __div__ !";
3864 std::vector<int> aa;
3865 DataArrayIntTuple *aaa;
3867 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3872 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3873 ret->applyDivideBy(val);
3878 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3879 return DataArrayInt::Divide(self,aaaa);
3883 return DataArrayInt::Divide(self,a);
3887 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3888 return DataArrayInt::Divide(self,aaaa);
3891 throw INTERP_KERNEL::Exception(msg);
3895 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3897 const char msg[]="Unexpected situation in __rdiv__ !";
3900 std::vector<int> aa;
3901 DataArrayIntTuple *aaa;
3903 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3914 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3915 return DataArrayInt::Divide(aaaa,self);
3919 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3920 return DataArrayInt::Divide(aaaa,self);
3923 throw INTERP_KERNEL::Exception(msg);
3927 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3929 const char msg[]="Unexpected situation in __idiv__ !";
3932 std::vector<int> aa;
3933 DataArrayIntTuple *aaa;
3935 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3940 self->applyDivideBy(val);
3941 Py_XINCREF(trueSelf);
3946 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3947 self->divideEqual(bb);
3948 Py_XINCREF(trueSelf);
3953 self->divideEqual(a);
3954 Py_XINCREF(trueSelf);
3959 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3960 self->divideEqual(aaaa);
3961 Py_XINCREF(trueSelf);
3965 throw INTERP_KERNEL::Exception(msg);
3969 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3971 const char msg[]="Unexpected situation in __mod__ !";
3974 std::vector<int> aa;
3975 DataArrayIntTuple *aaa;
3977 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3982 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3983 ret->applyModulus(val);
3988 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3989 return DataArrayInt::Modulus(self,aaaa);
3993 return DataArrayInt::Modulus(self,a);
3997 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3998 return DataArrayInt::Modulus(self,aaaa);
4001 throw INTERP_KERNEL::Exception(msg);
4005 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4007 const char msg[]="Unexpected situation in __rmod__ !";
4010 std::vector<int> aa;
4011 DataArrayIntTuple *aaa;
4013 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4019 ret->applyRModulus(val);
4024 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4025 return DataArrayInt::Modulus(aaaa,self);
4029 return DataArrayInt::Modulus(a,self);
4033 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4034 return DataArrayInt::Modulus(aaaa,self);
4037 throw INTERP_KERNEL::Exception(msg);
4041 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4043 const char msg[]="Unexpected situation in __imod__ !";
4046 std::vector<int> aa;
4047 DataArrayIntTuple *aaa;
4049 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4054 self->applyModulus(val);
4055 Py_XINCREF(trueSelf);
4060 self->modulusEqual(a);
4061 Py_XINCREF(trueSelf);
4066 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4067 self->modulusEqual(aaaa);
4068 Py_XINCREF(trueSelf);
4072 throw INTERP_KERNEL::Exception(msg);
4076 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4078 const char msg[]="Unexpected situation in __pow__ !";
4081 std::vector<int> aa;
4082 DataArrayIntTuple *aaa;
4084 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4089 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4095 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4096 return DataArrayInt::Pow(self,aaaa);
4100 return DataArrayInt::Pow(self,a);
4104 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4105 return DataArrayInt::Pow(self,aaaa);
4108 throw INTERP_KERNEL::Exception(msg);
4112 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4114 const char msg[]="Unexpected situation in __rpow__ !";
4117 std::vector<int> aa;
4118 DataArrayIntTuple *aaa;
4120 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4125 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4126 ret->applyRPow(val);
4131 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4132 return DataArrayInt::Pow(aaaa,self);
4136 return DataArrayInt::Pow(a,self);
4140 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4141 return DataArrayInt::Pow(aaaa,self);
4144 throw INTERP_KERNEL::Exception(msg);
4148 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4150 const char msg[]="Unexpected situation in __ipow__ !";
4153 std::vector<int> aa;
4154 DataArrayIntTuple *aaa;
4156 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4161 self->applyPow(val);
4162 Py_XINCREF(trueSelf);
4168 Py_XINCREF(trueSelf);
4173 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4174 self->powEqual(aaaa);
4175 Py_XINCREF(trueSelf);
4179 throw INTERP_KERNEL::Exception(msg);
4183 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4185 std::ostringstream oss;
4186 self->reprQuickOverview(oss);
4190 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4192 int szArr,sw,iTypppArr;
4193 std::vector<int> stdvecTyyppArr;
4194 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4195 self->pushBackValsSilent(tmp,tmp+szArr);
4198 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4200 std::vector<int> ret1;
4201 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4202 std::size_t sz=ret0.size();
4203 PyObject *pyRet=PyTuple_New(2);
4204 PyObject *pyRet0=PyList_New((int)sz);
4205 PyObject *pyRet1=PyList_New((int)sz);
4206 for(std::size_t i=0;i<sz;i++)
4208 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4209 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4211 PyTuple_SetItem(pyRet,0,pyRet0);
4212 PyTuple_SetItem(pyRet,1,pyRet1);
4216 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4218 DataArrayInt *ret0=0,*ret1=0;
4219 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4220 PyObject *pyRet=PyTuple_New(2);
4221 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4222 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4228 class DataArrayIntTuple;
4230 class DataArrayIntIterator
4233 DataArrayIntIterator(DataArrayInt *da);
4234 ~DataArrayIntIterator();
4239 DataArrayIntTuple *ret=self->nextt();
4241 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4244 PyErr_SetString(PyExc_StopIteration,"No more data.");
4251 class DataArrayIntTuple
4254 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4255 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4258 std::string __str__() const throw(INTERP_KERNEL::Exception)
4260 return self->repr();
4263 int __int__() const throw(INTERP_KERNEL::Exception)
4265 return self->intValue();
4268 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4270 return self->buildDAInt(1,self->getNumberOfCompo());
4273 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4275 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4276 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4277 Py_XINCREF(trueSelf);
4281 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4283 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4284 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4285 Py_XINCREF(trueSelf);
4289 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4291 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4292 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4293 Py_XINCREF(trueSelf);
4297 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4299 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4300 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4301 Py_XINCREF(trueSelf);
4305 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4307 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4308 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4309 Py_XINCREF(trueSelf);
4313 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4315 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4318 std::vector<int> multiVal;
4319 std::pair<int, std::pair<int,int> > slic;
4320 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4321 const int *pt=self->getConstPointer();
4322 int nbc=self->getNumberOfCompo();
4323 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4330 std::ostringstream oss;
4331 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4332 throw INTERP_KERNEL::Exception(oss.str().c_str());
4335 return PyInt_FromLong(pt[singleVal]);
4339 return PyInt_FromLong(pt[nbc+singleVal]);
4342 std::ostringstream oss;
4343 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4344 throw INTERP_KERNEL::Exception(oss.str().c_str());
4350 PyObject *t=PyTuple_New(multiVal.size());
4351 for(int j=0;j<(int)multiVal.size();j++)
4353 int cid=multiVal[j];
4356 std::ostringstream oss;
4357 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4358 throw INTERP_KERNEL::Exception(oss.str().c_str());
4360 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4366 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4367 PyObject *t=PyTuple_New(sz);
4368 for(int j=0;j<sz;j++)
4369 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4373 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4377 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4379 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4380 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4383 std::vector<int> multiValV;
4384 std::pair<int, std::pair<int,int> > slicV;
4385 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4386 int nbc=self->getNumberOfCompo();
4387 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4389 std::vector<int> multiVal;
4390 std::pair<int, std::pair<int,int> > slic;
4391 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4392 int *pt=self->getPointer();
4393 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4400 std::ostringstream oss;
4401 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4402 throw INTERP_KERNEL::Exception(oss.str().c_str());
4408 pt[singleVal]=singleValV;
4413 if(multiValV.size()!=1)
4415 std::ostringstream oss;
4416 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4417 throw INTERP_KERNEL::Exception(oss.str().c_str());
4419 pt[singleVal]=multiValV[0];
4424 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4428 throw INTERP_KERNEL::Exception(msg);
4437 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4441 std::ostringstream oss;
4442 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4443 throw INTERP_KERNEL::Exception(oss.str().c_str());
4451 if(multiVal.size()!=multiValV.size())
4453 std::ostringstream oss;
4454 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4455 throw INTERP_KERNEL::Exception(oss.str().c_str());
4457 for(int i=0;i<(int)multiVal.size();i++)
4459 int pos=multiVal[i];
4462 std::ostringstream oss;
4463 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4464 throw INTERP_KERNEL::Exception(oss.str().c_str());
4466 pt[multiVal[i]]=multiValV[i];
4472 const int *ptV=daIntTyyppV->getConstPointer();
4473 if(nbc>daIntTyyppV->getNumberOfCompo())
4475 std::ostringstream oss;
4476 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4477 throw INTERP_KERNEL::Exception(oss.str().c_str());
4479 std::copy(ptV,ptV+nbc,pt);
4483 throw INTERP_KERNEL::Exception(msg);
4488 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4493 for(int j=0;j<sz;j++)
4494 pt[slic.first+j*slic.second.second]=singleValV;
4499 if(sz!=(int)multiValV.size())
4501 std::ostringstream oss;
4502 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4503 throw INTERP_KERNEL::Exception(oss.str().c_str());
4505 for(int j=0;j<sz;j++)
4506 pt[slic.first+j*slic.second.second]=multiValV[j];
4511 const int *ptV=daIntTyyppV->getConstPointer();
4512 if(sz>daIntTyyppV->getNumberOfCompo())
4514 std::ostringstream oss;
4515 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4516 throw INTERP_KERNEL::Exception(oss.str().c_str());
4518 for(int j=0;j<sz;j++)
4519 pt[slic.first+j*slic.second.second]=ptV[j];
4523 throw INTERP_KERNEL::Exception(msg);
4527 throw INTERP_KERNEL::Exception(msg);
4533 class DataArrayChar : public DataArray
4536 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4537 virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
4538 int getHashCode() const throw(INTERP_KERNEL::Exception);
4539 bool empty() const throw(INTERP_KERNEL::Exception);
4540 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4541 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4542 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4543 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4544 char popBackSilent() throw(INTERP_KERNEL::Exception);
4545 void pack() const throw(INTERP_KERNEL::Exception);
4546 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4547 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4548 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4549 void reverse() throw(INTERP_KERNEL::Exception);
4550 void fillWithZero() throw(INTERP_KERNEL::Exception);
4551 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4552 std::string repr() const throw(INTERP_KERNEL::Exception);
4553 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4554 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
4555 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4556 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4557 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4558 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4559 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4560 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4561 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4562 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4563 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4564 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4565 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4566 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4567 char back() const throw(INTERP_KERNEL::Exception);
4568 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4569 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4570 char *getPointer() throw(INTERP_KERNEL::Exception);
4571 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4572 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4573 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4574 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4575 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4576 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4577 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4578 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4579 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4580 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4581 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4584 int __len__() const throw(INTERP_KERNEL::Exception)
4586 if(self->isAllocated())
4588 return self->getNumberOfTuples();
4592 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4596 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4599 bool ret0=self->isEqualIfNotWhy(other,ret1);
4600 PyObject *ret=PyTuple_New(2);
4601 PyObject *ret0Py=ret0?Py_True:Py_False;
4603 PyTuple_SetItem(ret,0,ret0Py);
4604 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4608 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4611 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4612 if (!SWIG_IsOK(res1))
4615 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4616 if(size!=self->getNumberOfTuples())
4618 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4620 return self->renumber(tmp);
4624 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4626 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4627 da2->checkAllocated();
4628 int size=self->getNumberOfTuples();
4629 if(size!=self->getNumberOfTuples())
4631 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4633 return self->renumber(da2->getConstPointer());
4637 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4640 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4641 if (!SWIG_IsOK(res1))
4644 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4645 if(size!=self->getNumberOfTuples())
4647 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4649 return self->renumberR(tmp);
4653 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4655 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4656 da2->checkAllocated();
4657 int size=self->getNumberOfTuples();
4658 if(size!=self->getNumberOfTuples())
4660 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4662 return self->renumberR(da2->getConstPointer());
4666 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4669 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4670 if (!SWIG_IsOK(res1))
4673 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4674 if(size!=self->getNumberOfTuples())
4676 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4678 return self->renumberAndReduce(tmp,newNbOfTuple);
4682 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4684 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4685 da2->checkAllocated();
4686 int size=self->getNumberOfTuples();
4687 if(size!=self->getNumberOfTuples())
4689 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4691 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4695 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4698 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4699 if (!SWIG_IsOK(res1))
4702 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4703 return self->selectByTupleIdSafe(tmp,tmp+size);
4707 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4709 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4710 da2->checkAllocated();
4711 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4715 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4717 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4718 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4719 return DataArrayChar::Aggregate(tmp);
4722 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4724 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4725 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4726 return DataArrayChar::Meld(tmp);
4731 class DataArrayByteIterator;
4733 class DataArrayByte : public DataArrayChar
4736 static DataArrayByte *New();
4737 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4738 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4739 char byteValue() const throw(INTERP_KERNEL::Exception);
4742 DataArrayByte() throw(INTERP_KERNEL::Exception)
4744 return DataArrayByte::New();
4747 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4749 const char *msg="ParaMEDMEM::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) !";
4750 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4754 if(PyInt_Check(nbOfTuples))
4756 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4758 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4761 if(PyInt_Check(nbOfComp))
4762 {//DataArrayByte.New([1,3,4,5],2,2)
4763 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4765 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4766 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4767 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4768 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4772 throw INTERP_KERNEL::Exception(msg);
4775 {//DataArrayByte.New([1,3,4],3)
4776 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4778 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4779 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4784 throw INTERP_KERNEL::Exception(msg);
4787 {// DataArrayByte.New([1,3,4])
4788 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4789 int tmpp1=-1,tmpp2=-1;
4790 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4791 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4795 else if(PyInt_Check(elt0))
4797 int nbOfTuples1=PyInt_AS_LONG(elt0);
4799 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4804 if(PyInt_Check(nbOfTuples))
4805 {//DataArrayByte.New(5,2)
4806 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4808 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4809 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4810 ret->alloc(nbOfTuples1,nbOfCompo);
4814 throw INTERP_KERNEL::Exception(msg);
4817 throw INTERP_KERNEL::Exception(msg);
4820 {//DataArrayByte.New(5)
4821 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4822 ret->alloc(nbOfTuples1,1);
4827 throw INTERP_KERNEL::Exception(msg);
4830 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4832 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4835 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4837 std::ostringstream oss;
4838 self->reprQuickOverview(oss);
4842 int __int__() const throw(INTERP_KERNEL::Exception)
4844 return (int) self->byteValue();
4847 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4849 return self->iterator();
4852 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4854 return (int)self->getIJ(tupleId,compoId);
4857 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4859 return (int)self->getIJSafe(tupleId,compoId);
4862 std::string __str__() const throw(INTERP_KERNEL::Exception)
4864 return self->repr();
4867 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4869 const char *vals=self->getConstPointer();
4870 int nbOfComp=self->getNumberOfComponents();
4871 int nbOfTuples=self->getNumberOfTuples();
4872 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4875 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4878 int ival=-1; std::vector<int> ivval;
4879 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4880 std::vector<char> vals(sz);
4881 std::copy(pt,pt+sz,vals.begin());
4882 return self->presenceOfTuple(vals);
4885 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4888 int ival=-1; std::vector<int> ivval;
4889 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4890 std::vector<char> vals2(sz);
4891 std::copy(pt,pt+sz,vals2.begin());
4892 return self->presenceOfValue(vals2);
4895 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4898 int ival=-1; std::vector<int> ivval;
4899 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4900 std::vector<char> vals2(sz);
4901 std::copy(pt,pt+sz,vals2.begin());
4902 return self->locateValue(vals2);
4905 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4908 int ival=-1; std::vector<int> ivval;
4909 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4910 std::vector<char> vals(sz);
4911 std::copy(pt,pt+sz,vals.begin());
4912 return self->locateTuple(vals);
4915 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4918 int ival=-1; std::vector<int> ivval;
4919 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4920 std::vector<char> vals(sz);
4921 std::copy(pt,pt+sz,vals.begin());
4922 return self->search(vals);
4925 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4927 int sz=self->getNumberOfComponents();
4928 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4929 self->getTuple(tupleId,tmp);
4930 PyObject *ret=PyTuple_New(sz);
4931 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4935 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4938 int r1=(int)self->getMaxValue(tmp);
4939 PyObject *ret=PyTuple_New(2);
4940 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4941 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4945 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4948 int r1=(int)self->getMinValue(tmp);
4949 PyObject *ret=PyTuple_New(2);
4950 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4951 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4955 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4957 int nbOfCompo=self->getNumberOfComponents();
4962 if(PyInt_Check(obj))
4964 int val=(int)PyInt_AS_LONG(obj);
4965 return self->locateValue(val);
4968 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4971 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4975 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4977 int nbOfCompo=self->getNumberOfComponents();
4984 if(PyInt_Check(obj))
4986 int val=(int)PyInt_AS_LONG(obj);
4987 return self->presenceOfValue(val);
4990 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
4993 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
4999 class DataArrayByteTuple;
5001 class DataArrayByteIterator
5004 DataArrayByteIterator(DataArrayByte *da);
5005 ~DataArrayByteIterator();
5008 class DataArrayByteTuple
5011 std::string repr() const throw(INTERP_KERNEL::Exception);
5012 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5015 std::string __str__() const throw(INTERP_KERNEL::Exception)
5017 return self->repr();
5020 char __int__() const throw(INTERP_KERNEL::Exception)
5022 return self->byteValue();
5025 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5027 return self->buildDAByte(1,self->getNumberOfCompo());
5032 class DataArrayAsciiCharIterator;
5034 class DataArrayAsciiChar : public DataArrayChar
5037 static DataArrayAsciiChar *New();
5038 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5039 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5040 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5043 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5045 return DataArrayAsciiChar::New();
5048 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5050 const char *msg="ParaMEDMEM::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) !";
5051 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5055 if(PyInt_Check(nbOfTuples))
5057 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5059 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5062 if(PyInt_Check(nbOfComp))
5063 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5064 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5066 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5067 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5068 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5069 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5073 throw INTERP_KERNEL::Exception(msg);
5076 {//DataArrayAsciiChar.New([1,3,4],3)
5077 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5079 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5080 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5084 else if(PyString_Check(nbOfTuples))
5086 if(PyString_Size(nbOfTuples)!=1)
5087 throw INTERP_KERNEL::Exception(msg);
5088 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5089 std::vector<std::string> tmp;
5090 if(fillStringVector(elt0,tmp))
5091 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5093 throw INTERP_KERNEL::Exception(msg);
5096 throw INTERP_KERNEL::Exception(msg);
5100 std::vector<std::string> tmmp;
5101 if(fillStringVector(elt0,tmmp))
5102 //DataArrayAsciiChar.New(["abc","de","fghi"])
5103 return DataArrayAsciiChar::New(tmmp,' ');
5106 // DataArrayAsciiChar.New([1,3,4])
5107 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5108 int tmpp1=-1,tmpp2=-1;
5109 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5110 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5115 else if(PyInt_Check(elt0))
5117 int nbOfTuples1=PyInt_AS_LONG(elt0);
5119 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5124 if(PyInt_Check(nbOfTuples))
5125 {//DataArrayAsciiChar.New(5,2)
5126 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5128 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5129 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5130 ret->alloc(nbOfTuples1,nbOfCompo);
5134 throw INTERP_KERNEL::Exception(msg);
5137 throw INTERP_KERNEL::Exception(msg);
5140 {//DataArrayAsciiChar.New(5)
5141 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5142 ret->alloc(nbOfTuples1,1);
5147 throw INTERP_KERNEL::Exception(msg);
5150 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5152 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5155 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5157 std::ostringstream oss;
5158 self->reprQuickOverview(oss);
5162 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5164 return self->iterator();
5167 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5169 char tmp[2]; tmp[1]='\0';
5170 tmp[0]=self->getIJ(tupleId,compoId);
5171 return std::string(tmp);
5174 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5176 char tmp[2]; tmp[1]='\0';
5177 tmp[0]=self->getIJSafe(tupleId,compoId);
5178 return std::string(tmp);
5181 std::string __str__() const throw(INTERP_KERNEL::Exception)
5183 return self->repr();
5186 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5188 const char *vals=self->getConstPointer();
5189 int nbOfComp=self->getNumberOfComponents();
5190 int nbOfTuples=self->getNumberOfTuples();
5191 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5194 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5196 if(PyString_Check(tupl))
5198 Py_ssize_t sz=PyString_Size(tupl);
5199 std::vector<char> vals(sz);
5200 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5201 return self->presenceOfTuple(vals);
5204 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5207 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5209 if(PyString_Check(vals))
5211 Py_ssize_t sz=PyString_Size(vals);
5212 std::vector<char> vals2(sz);
5213 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5214 return self->presenceOfValue(vals2);
5217 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5220 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5222 if(PyString_Check(vals))
5224 Py_ssize_t sz=PyString_Size(vals);
5225 std::vector<char> vals2(sz);
5226 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5227 return self->locateValue(vals2);
5230 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5233 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5235 if(PyString_Check(tupl))
5237 Py_ssize_t sz=PyString_Size(tupl);
5238 std::vector<char> vals(sz);
5239 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5240 return self->locateTuple(vals);
5243 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5246 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5248 if(PyString_Check(strOrListOfInt))
5250 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5251 std::vector<char> vals(sz);
5252 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5253 return self->search(vals);
5256 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5259 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5261 int sz=self->getNumberOfComponents();
5262 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5263 self->getTuple(tupleId,tmp);
5264 return PyString_FromString(tmp);
5267 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5270 char tmp2[2]; tmp2[1]='\0';
5271 tmp2[0]=self->getMaxValue(tmp);
5272 PyObject *ret=PyTuple_New(2);
5273 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5274 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5278 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5281 char tmp2[2]; tmp2[1]='\0';
5282 tmp2[0]=self->getMinValue(tmp);
5283 PyObject *ret=PyTuple_New(2);
5284 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5285 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5289 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5291 int nbOfCompo=self->getNumberOfComponents();
5296 if(PyString_Check(obj))
5298 Py_ssize_t sz=PyString_Size(obj);
5299 char *pt=PyString_AsString(obj);
5301 return self->locateValue(pt[0]);
5303 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5306 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5309 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5313 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5315 int nbOfCompo=self->getNumberOfComponents();
5322 if(PyString_Check(obj))
5324 Py_ssize_t sz=PyString_Size(obj);
5325 char *pt=PyString_AsString(obj);
5327 return self->presenceOfValue(pt[0]);
5329 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5332 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5335 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5339 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5342 std::vector<int> stdvecTyyppArr;
5343 std::pair<int, std::pair<int,int> > sTyyppArr;
5344 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5345 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5349 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5351 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5353 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5355 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5357 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5361 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5363 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.";
5365 std::vector<int> stdvecTyyppArr;
5366 std::pair<int, std::pair<int,int> > sTyyppArr;
5367 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5368 int nbOfCompo=self->getNumberOfComponents();
5369 int nbOfTuples=self->getNumberOfTuples();
5370 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5372 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5373 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5382 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5388 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5389 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5392 //value vector<string>
5395 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5396 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5399 //value DataArrayChar
5402 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5406 throw INTERP_KERNEL::Exception(msg);
5410 {//obj list-tuple[int]
5416 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5422 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5423 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5426 //value vector<string>
5429 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5430 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5433 //value DataArrayChar
5436 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5440 throw INTERP_KERNEL::Exception(msg);
5451 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5457 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5458 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5461 //value vector<string>
5464 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5465 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5468 //value DataArrayChar
5471 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5475 throw INTERP_KERNEL::Exception(msg);
5486 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5492 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5493 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5496 //value vector<string>
5499 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5500 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5503 //value DataArrayChar
5506 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5510 throw INTERP_KERNEL::Exception(msg);
5515 throw INTERP_KERNEL::Exception(msg);
5521 class DataArrayAsciiCharTuple;
5523 class DataArrayAsciiCharIterator
5526 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5527 ~DataArrayAsciiCharIterator();
5532 DataArrayAsciiCharTuple *ret=self->nextt();
5534 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5537 PyErr_SetString(PyExc_StopIteration,"No more data.");
5544 class DataArrayAsciiCharTuple
5547 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5548 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5551 std::string __str__() const throw(INTERP_KERNEL::Exception)
5553 return self->repr();
5556 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5558 return self->buildDAAsciiChar(1,self->getNumberOfCompo());