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 front() const throw(INTERP_KERNEL::Exception);
306 double back() const throw(INTERP_KERNEL::Exception);
307 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
308 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
309 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
310 double *getPointer() throw(INTERP_KERNEL::Exception);
311 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
312 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
313 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
314 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
315 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
316 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
317 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
318 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
319 double getAverageValue() const throw(INTERP_KERNEL::Exception);
320 double norm2() const throw(INTERP_KERNEL::Exception);
321 double normMax() const throw(INTERP_KERNEL::Exception);
322 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
323 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
324 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
325 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
326 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
327 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
328 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
329 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
330 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
331 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
332 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
333 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
334 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
335 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
336 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
337 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
338 void abs() throw(INTERP_KERNEL::Exception);
339 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
340 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
341 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
342 void applyPow(double val) throw(INTERP_KERNEL::Exception);
343 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
344 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
345 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
346 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
347 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
348 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
349 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
350 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
351 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
352 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
353 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
354 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
355 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
356 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
357 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
358 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
359 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
360 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
361 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
362 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
363 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
364 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
365 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
366 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
367 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
368 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
371 DataArrayDouble() throw(INTERP_KERNEL::Exception)
373 return DataArrayDouble::New();
376 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
378 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)";
379 std::string msg(msgBase);
381 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
384 if(PyList_Check(elt0) || PyTuple_Check(elt0))
388 if(PyInt_Check(nbOfTuples))
390 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
392 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
395 if(PyInt_Check(elt2))
396 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
397 int nbOfCompo=PyInt_AS_LONG(elt2);
399 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
400 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
401 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
402 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
406 throw INTERP_KERNEL::Exception(msg.c_str());
409 {//DataArrayDouble.New([1.,3.,4.],3)
410 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
412 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
413 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
418 throw INTERP_KERNEL::Exception(msg.c_str());
421 {// DataArrayDouble.New([1.,3.,4.])
422 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
423 int tmpp1=-1,tmpp2=-1;
424 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
425 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
429 else if(PyInt_Check(elt0))
431 int nbOfTuples1=PyInt_AS_LONG(elt0);
433 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
438 if(PyInt_Check(nbOfTuples))
439 {//DataArrayDouble.New(5,2)
440 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
442 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
443 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
444 ret->alloc(nbOfTuples1,nbOfCompo);
448 throw INTERP_KERNEL::Exception(msg.c_str());
451 throw INTERP_KERNEL::Exception(msg.c_str());
454 {//DataArrayDouble.New(5)
455 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
456 ret->alloc(nbOfTuples1,1);
461 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
462 {//DataArrayDouble.New(numpyArray)
463 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
467 throw INTERP_KERNEL::Exception(msg.c_str());
470 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
472 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
475 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
478 std::vector<double> bb;
480 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
481 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
482 self->pushBackValsSilent(tmp,tmp+nbTuples);
485 std::string __repr__() const throw(INTERP_KERNEL::Exception)
487 std::ostringstream oss;
488 self->reprQuickOverview(oss);
492 std::string __str__() const throw(INTERP_KERNEL::Exception)
497 double __float__() const throw(INTERP_KERNEL::Exception)
499 return self->doubleValue();
502 int __len__() const throw(INTERP_KERNEL::Exception)
504 if(self->isAllocated())
506 return self->getNumberOfTuples();
510 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
514 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
516 return self->iterator();
519 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
521 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 !";
522 if(PyList_Check(li) || PyTuple_Check(li))
526 if(PyInt_Check(nbOfTuples))
528 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
530 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
533 if(PyInt_Check(nbOfComp))
534 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
535 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
537 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
538 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
539 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
542 throw INTERP_KERNEL::Exception(msg);
545 {//DataArrayDouble.setValues([1.,3.,4.],3)
547 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
548 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
552 throw INTERP_KERNEL::Exception(msg);
555 {// DataArrayDouble.setValues([1.,3.,4.])
556 int tmpp1=-1,tmpp2=-1;
557 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
558 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
562 throw INTERP_KERNEL::Exception(msg);
565 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
567 const double *vals=self->getConstPointer();
568 return convertDblArrToPyList(vals,self->getNbOfElems());
572 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
574 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
578 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
581 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
582 PyObject *ret=PyTuple_New(2);
583 PyObject *ret0Py=ret0?Py_True:Py_False;
585 PyTuple_SetItem(ret,0,ret0Py);
586 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
590 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
592 const double *vals=self->getConstPointer();
593 int nbOfComp=self->getNumberOfComponents();
594 int nbOfTuples=self->getNumberOfTuples();
595 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
598 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
601 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
602 if (!SWIG_IsOK(res1))
605 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
606 if(size!=self->getNumberOfTuples())
608 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
610 return self->renumber(tmp);
614 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
616 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
617 da2->checkAllocated();
618 int size=self->getNumberOfTuples();
619 if(size!=self->getNumberOfTuples())
621 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
623 return self->renumber(da2->getConstPointer());
627 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
630 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
631 if (!SWIG_IsOK(res1))
634 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
635 if(size!=self->getNumberOfTuples())
637 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
639 return self->renumberR(tmp);
643 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
645 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
646 da2->checkAllocated();
647 int size=self->getNumberOfTuples();
648 if(size!=self->getNumberOfTuples())
650 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
652 return self->renumberR(da2->getConstPointer());
656 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
659 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
660 if (!SWIG_IsOK(res1))
663 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
664 if(size!=self->getNumberOfTuples())
666 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
668 return self->renumberAndReduce(tmp,newNbOfTuple);
672 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
674 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
675 da2->checkAllocated();
676 int size=self->getNumberOfTuples();
677 if(size!=self->getNumberOfTuples())
679 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
681 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
685 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
688 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
689 if (!SWIG_IsOK(res1))
692 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
693 return self->selectByTupleId(tmp,tmp+size);
697 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
699 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
700 da2->checkAllocated();
701 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
705 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
708 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
709 if (!SWIG_IsOK(res1))
712 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
713 return self->selectByTupleIdSafe(tmp,tmp+size);
717 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
719 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
720 da2->checkAllocated();
721 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
725 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
727 int thisTupleId,otherTupleId;
728 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
729 PyObject *ret=PyTuple_New(3);
730 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
731 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
732 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
736 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
739 double r1=self->getMaxValue(tmp);
740 PyObject *ret=PyTuple_New(2);
741 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
742 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
746 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
749 double r1=self->getMaxValue2(tmp);
750 PyObject *ret=PyTuple_New(2);
751 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
752 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
756 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
759 double r1=self->getMinValue(tmp);
760 PyObject *ret=PyTuple_New(2);
761 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
762 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
766 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
769 double r1=self->getMinValue2(tmp);
770 PyObject *ret=PyTuple_New(2);
771 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
772 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
776 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
778 int nbOfCompo=self->getNumberOfComponents();
779 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
780 self->getMinMaxPerComponent(tmp);
781 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
785 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
787 int sz=self->getNumberOfComponents();
788 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
789 self->accumulate(tmp);
790 return convertDblArrToPyList(tmp,sz);
793 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
796 std::vector<int> val2;
797 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
798 return self->accumulatePerChunck(bg,bg+sz);
801 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
803 DataArrayInt *comm, *commIndex;
804 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
805 PyObject *res = PyList_New(2);
806 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
807 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
811 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
815 DataArrayDoubleTuple *aa;
816 std::vector<double> bb;
818 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
819 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
821 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
822 PyObject *ret=PyTuple_New(2);
823 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
824 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
828 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
830 std::vector<int> tmp;
831 convertPyToNewIntArr3(li,tmp);
832 self->setSelectedComponents(a,tmp);
835 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
837 int sz=self->getNumberOfComponents();
838 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
839 self->getTuple(tupleId,tmp);
840 return convertDblArrToPyList(tmp,sz);
843 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
845 std::vector<const DataArrayDouble *> tmp;
846 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
847 return DataArrayDouble::Aggregate(tmp);
850 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
852 std::vector<const DataArrayDouble *> tmp;
853 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
854 return DataArrayDouble::Meld(tmp);
857 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
861 DataArrayDoubleTuple *aa;
862 std::vector<double> bb;
864 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
865 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
866 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
867 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
868 DataArrayInt *c=0,*cI=0;
869 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
870 PyObject *ret=PyTuple_New(2);
871 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
872 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
876 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
878 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
879 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
880 self->checkAllocated();
881 int nbOfTuples=self->getNumberOfTuples();
882 int nbOfComponents=self->getNumberOfComponents();
884 std::vector<int> vt1,vc1;
885 std::pair<int, std::pair<int,int> > pt1,pc1;
886 DataArrayInt *dt1=0,*dc1=0;
888 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
889 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
893 if(nbOfComponents==1)
894 return PyFloat_FromDouble(self->getIJSafe(it1,0));
895 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
897 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
899 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
901 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
903 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
906 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
907 std::vector<int> v2(1,ic1);
908 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
912 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
913 std::vector<int> v2(1,ic1);
914 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
918 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
919 std::vector<int> v2(1,ic1);
920 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
924 ret=self->selectByTupleIdSafe(&it1,&it1+1);
925 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
929 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
930 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
934 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
935 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
939 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
940 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
944 ret=self->selectByTupleIdSafe(&it1,&it1+1);
945 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
946 std::vector<int> v2(nbOfComp);
947 for(int i=0;i<nbOfComp;i++)
948 v2[i]=pc1.first+i*pc1.second.second;
949 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
953 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
954 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
955 std::vector<int> v2(nbOfComp);
956 for(int i=0;i<nbOfComp;i++)
957 v2[i]=pc1.first+i*pc1.second.second;
958 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
962 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
963 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
964 std::vector<int> v2(nbOfComp);
965 for(int i=0;i<nbOfComp;i++)
966 v2[i]=pc1.first+i*pc1.second.second;
967 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
971 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
972 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
973 std::vector<int> v2(nbOfComp);
974 for(int i=0;i<nbOfComp;i++)
975 v2[i]=pc1.first+i*pc1.second.second;
976 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
979 throw INTERP_KERNEL::Exception(msg);
983 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
985 self->checkAllocated();
986 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
987 int nbOfTuples=self->getNumberOfTuples();
988 int nbOfComponents=self->getNumberOfComponents();
991 std::vector<double> v1;
992 DataArrayDouble *d1=0;
993 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
995 std::vector<int> vt1,vc1;
996 std::pair<int, std::pair<int,int> > pt1,pc1;
997 DataArrayInt *dt1=0,*dc1=0;
998 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
999 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1007 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1010 tmp=DataArrayDouble::New();
1011 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1012 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1015 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1018 throw INTERP_KERNEL::Exception(msg);
1027 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1030 tmp=DataArrayDouble::New();
1031 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1032 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1035 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1038 throw INTERP_KERNEL::Exception(msg);
1047 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1050 tmp=DataArrayDouble::New();
1051 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1052 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1055 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1058 throw INTERP_KERNEL::Exception(msg);
1067 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1070 tmp=DataArrayDouble::New();
1071 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1072 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1075 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1078 throw INTERP_KERNEL::Exception(msg);
1087 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1090 tmp=DataArrayDouble::New();
1091 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1092 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1095 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1098 throw INTERP_KERNEL::Exception(msg);
1107 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1110 tmp=DataArrayDouble::New();
1111 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1112 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1115 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1118 throw INTERP_KERNEL::Exception(msg);
1127 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1130 tmp=DataArrayDouble::New();
1131 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1132 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1135 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1138 throw INTERP_KERNEL::Exception(msg);
1147 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1150 tmp=DataArrayDouble::New();
1151 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1152 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1155 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1158 throw INTERP_KERNEL::Exception(msg);
1167 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1170 tmp=DataArrayDouble::New();
1171 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1172 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1175 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1178 throw INTERP_KERNEL::Exception(msg);
1187 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1190 tmp=DataArrayDouble::New();
1191 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1192 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1195 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1198 throw INTERP_KERNEL::Exception(msg);
1207 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1210 tmp=DataArrayDouble::New();
1211 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1212 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1215 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1218 throw INTERP_KERNEL::Exception(msg);
1227 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1230 tmp=DataArrayDouble::New();
1231 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1232 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1235 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1238 throw INTERP_KERNEL::Exception(msg);
1247 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1250 tmp=DataArrayDouble::New();
1251 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1252 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1255 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1258 throw INTERP_KERNEL::Exception(msg);
1267 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1270 tmp=DataArrayDouble::New();
1271 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1272 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1275 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1278 throw INTERP_KERNEL::Exception(msg);
1287 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1290 tmp=DataArrayDouble::New();
1291 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1292 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1295 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1298 throw INTERP_KERNEL::Exception(msg);
1307 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1310 tmp=DataArrayDouble::New();
1311 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1312 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1315 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1318 throw INTERP_KERNEL::Exception(msg);
1323 throw INTERP_KERNEL::Exception(msg);
1328 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1330 return self->negate();
1333 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1335 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1338 DataArrayDoubleTuple *aa;
1339 std::vector<double> bb;
1343 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1345 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1348 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1349 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1351 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1354 throw INTERP_KERNEL::Exception(msg);
1357 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1362 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1363 ret->applyLin(1.,val);
1364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1368 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1372 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1373 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1377 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1378 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1381 throw INTERP_KERNEL::Exception(msg);
1385 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1387 const char msg[]="Unexpected situation in __radd__ !";
1390 DataArrayDoubleTuple *aa;
1391 std::vector<double> bb;
1393 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1398 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1399 ret->applyLin(1.,val);
1404 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1405 return DataArrayDouble::Add(self,aaa);
1409 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1410 return DataArrayDouble::Add(self,aaa);
1413 throw INTERP_KERNEL::Exception(msg);
1417 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1419 const char msg[]="Unexpected situation in __iadd__ !";
1422 DataArrayDoubleTuple *aa;
1423 std::vector<double> bb;
1425 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1430 self->applyLin(1.,val);
1431 Py_XINCREF(trueSelf);
1437 Py_XINCREF(trueSelf);
1442 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1443 self->addEqual(aaa);
1444 Py_XINCREF(trueSelf);
1449 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1450 self->addEqual(aaa);
1451 Py_XINCREF(trueSelf);
1455 throw INTERP_KERNEL::Exception(msg);
1459 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1461 const char msg[]="Unexpected situation in __sub__ !";
1464 DataArrayDoubleTuple *aa;
1465 std::vector<double> bb;
1469 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1471 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1474 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1475 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1477 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1480 throw INTERP_KERNEL::Exception(msg);
1483 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1488 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1489 ret->applyLin(1.,-val);
1490 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1494 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1498 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1499 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1503 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1504 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1507 throw INTERP_KERNEL::Exception(msg);
1511 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1513 const char msg[]="Unexpected situation in __rsub__ !";
1516 DataArrayDoubleTuple *aa;
1517 std::vector<double> bb;
1519 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1524 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1525 ret->applyLin(-1.,val);
1530 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1531 return DataArrayDouble::Substract(aaa,self);
1535 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1536 return DataArrayDouble::Substract(aaa,self);
1539 throw INTERP_KERNEL::Exception(msg);
1543 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1545 const char msg[]="Unexpected situation in __isub__ !";
1548 DataArrayDoubleTuple *aa;
1549 std::vector<double> bb;
1551 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1556 self->applyLin(1,-val);
1557 Py_XINCREF(trueSelf);
1562 self->substractEqual(a);
1563 Py_XINCREF(trueSelf);
1568 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1569 self->substractEqual(aaa);
1570 Py_XINCREF(trueSelf);
1575 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1576 self->substractEqual(aaa);
1577 Py_XINCREF(trueSelf);
1581 throw INTERP_KERNEL::Exception(msg);
1585 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1587 const char msg[]="Unexpected situation in __mul__ !";
1590 DataArrayDoubleTuple *aa;
1591 std::vector<double> bb;
1595 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1597 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1600 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1601 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1603 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1606 throw INTERP_KERNEL::Exception(msg);
1609 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1614 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1615 ret->applyLin(val,0.);
1616 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1620 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1624 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1625 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1629 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1630 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1633 throw INTERP_KERNEL::Exception(msg);
1637 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1639 const char msg[]="Unexpected situation in __rmul__ !";
1642 DataArrayDoubleTuple *aa;
1643 std::vector<double> bb;
1645 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1650 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1651 ret->applyLin(val,0.);
1656 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1657 return DataArrayDouble::Multiply(self,aaa);
1661 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1662 return DataArrayDouble::Multiply(self,aaa);
1665 throw INTERP_KERNEL::Exception(msg);
1669 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1671 const char msg[]="Unexpected situation in __imul__ !";
1674 DataArrayDoubleTuple *aa;
1675 std::vector<double> bb;
1677 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1682 self->applyLin(val,0.);
1683 Py_XINCREF(trueSelf);
1688 self->multiplyEqual(a);
1689 Py_XINCREF(trueSelf);
1694 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1695 self->multiplyEqual(aaa);
1696 Py_XINCREF(trueSelf);
1701 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1702 self->multiplyEqual(aaa);
1703 Py_XINCREF(trueSelf);
1707 throw INTERP_KERNEL::Exception(msg);
1711 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1713 const char msg[]="Unexpected situation in __div__ !";
1716 DataArrayDoubleTuple *aa;
1717 std::vector<double> bb;
1721 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1723 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1726 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1727 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1729 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1732 throw INTERP_KERNEL::Exception(msg);
1735 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1741 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1742 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1743 ret->applyLin(1/val,0.);
1744 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1748 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1752 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1757 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1758 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1761 throw INTERP_KERNEL::Exception(msg);
1765 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1767 const char msg[]="Unexpected situation in __rdiv__ !";
1770 DataArrayDoubleTuple *aa;
1771 std::vector<double> bb;
1773 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1778 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1784 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1785 return DataArrayDouble::Divide(aaa,self);
1789 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1790 return DataArrayDouble::Divide(aaa,self);
1793 throw INTERP_KERNEL::Exception(msg);
1797 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1799 const char msg[]="Unexpected situation in __idiv__ !";
1802 DataArrayDoubleTuple *aa;
1803 std::vector<double> bb;
1805 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1811 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1812 self->applyLin(1./val,0.);
1813 Py_XINCREF(trueSelf);
1818 self->divideEqual(a);
1819 Py_XINCREF(trueSelf);
1824 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1825 self->divideEqual(aaa);
1826 Py_XINCREF(trueSelf);
1831 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1832 self->divideEqual(aaa);
1833 Py_XINCREF(trueSelf);
1837 throw INTERP_KERNEL::Exception(msg);
1841 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1843 const char msg[]="Unexpected situation in __pow__ !";
1846 DataArrayDoubleTuple *aa;
1847 std::vector<double> bb;
1849 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1860 return DataArrayDouble::Pow(self,a);
1864 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1865 return DataArrayDouble::Pow(self,aaa);
1869 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1870 return DataArrayDouble::Pow(self,aaa);
1873 throw INTERP_KERNEL::Exception(msg);
1877 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1879 const char msg[]="Unexpected situation in __rpow__ !";
1882 DataArrayDoubleTuple *aa;
1883 std::vector<double> bb;
1885 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1890 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1891 ret->applyRPow(val);
1896 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1897 return DataArrayDouble::Pow(aaa,self);
1901 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1902 return DataArrayDouble::Pow(aaa,self);
1905 throw INTERP_KERNEL::Exception(msg);
1909 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1911 const char msg[]="Unexpected situation in __ipow__ !";
1914 DataArrayDoubleTuple *aa;
1915 std::vector<double> bb;
1917 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1922 self->applyPow(val);
1923 Py_XINCREF(trueSelf);
1929 Py_XINCREF(trueSelf);
1934 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1935 self->powEqual(aaa);
1936 Py_XINCREF(trueSelf);
1941 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1942 self->powEqual(aaa);
1943 Py_XINCREF(trueSelf);
1947 throw INTERP_KERNEL::Exception(msg);
1951 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1953 DataArrayInt *c=0,*cI=0;
1955 self->computeTupleIdsNearTuples(other,eps,c,cI);
1956 PyObject *ret=PyTuple_New(2);
1957 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1958 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1962 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1964 DataArrayInt *ret1=0;
1965 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1966 PyObject *ret=PyTuple_New(2);
1967 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1968 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1974 class DataArrayDoubleTuple;
1976 class DataArrayDoubleIterator
1979 DataArrayDoubleIterator(DataArrayDouble *da);
1980 ~DataArrayDoubleIterator();
1985 DataArrayDoubleTuple *ret=self->nextt();
1987 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1990 PyErr_SetString(PyExc_StopIteration,"No more data.");
1997 class DataArrayDoubleTuple
2000 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2001 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2004 std::string __str__() const throw(INTERP_KERNEL::Exception)
2006 return self->repr();
2009 double __float__() const throw(INTERP_KERNEL::Exception)
2011 return self->doubleValue();
2014 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2016 return self->buildDADouble(1,self->getNumberOfCompo());
2019 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2021 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2022 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2023 Py_XINCREF(trueSelf);
2027 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2029 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2030 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2031 Py_XINCREF(trueSelf);
2035 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2037 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2038 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2039 Py_XINCREF(trueSelf);
2043 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2045 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2046 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2047 Py_XINCREF(trueSelf);
2051 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2053 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2056 std::vector<int> multiVal;
2057 std::pair<int, std::pair<int,int> > slic;
2058 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2059 const double *pt=self->getConstPointer();
2060 int nbc=self->getNumberOfCompo();
2061 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2068 std::ostringstream oss;
2069 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2070 throw INTERP_KERNEL::Exception(oss.str().c_str());
2073 return PyFloat_FromDouble(pt[singleVal]);
2077 return PyFloat_FromDouble(pt[nbc+singleVal]);
2080 std::ostringstream oss;
2081 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2082 throw INTERP_KERNEL::Exception(oss.str().c_str());
2088 PyObject *t=PyTuple_New(multiVal.size());
2089 for(int j=0;j<(int)multiVal.size();j++)
2091 int cid=multiVal[j];
2094 std::ostringstream oss;
2095 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2096 throw INTERP_KERNEL::Exception(oss.str().c_str());
2098 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2104 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2105 PyObject *t=PyTuple_New(sz);
2106 for(int j=0;j<sz;j++)
2107 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2111 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2115 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2117 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2118 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2121 std::vector<double> multiValV;
2122 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2123 int nbc=self->getNumberOfCompo();
2124 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2126 std::vector<int> multiVal;
2127 std::pair<int, std::pair<int,int> > slic;
2128 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2129 double *pt=self->getPointer();
2130 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2137 std::ostringstream oss;
2138 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2139 throw INTERP_KERNEL::Exception(oss.str().c_str());
2145 pt[singleVal]=singleValV;
2150 if(multiValV.size()!=1)
2152 std::ostringstream oss;
2153 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2154 throw INTERP_KERNEL::Exception(oss.str().c_str());
2156 pt[singleVal]=multiValV[0];
2161 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2165 throw INTERP_KERNEL::Exception(msg);
2174 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2178 std::ostringstream oss;
2179 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2180 throw INTERP_KERNEL::Exception(oss.str().c_str());
2188 if(multiVal.size()!=multiValV.size())
2190 std::ostringstream oss;
2191 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2192 throw INTERP_KERNEL::Exception(oss.str().c_str());
2194 for(int i=0;i<(int)multiVal.size();i++)
2196 int pos=multiVal[i];
2199 std::ostringstream oss;
2200 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2201 throw INTERP_KERNEL::Exception(oss.str().c_str());
2203 pt[multiVal[i]]=multiValV[i];
2209 const double *ptV=daIntTyyppV->getConstPointer();
2210 if(nbc>daIntTyyppV->getNumberOfCompo())
2212 std::ostringstream oss;
2213 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2214 throw INTERP_KERNEL::Exception(oss.str().c_str());
2216 std::copy(ptV,ptV+nbc,pt);
2220 throw INTERP_KERNEL::Exception(msg);
2225 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2230 for(int j=0;j<sz;j++)
2231 pt[slic.first+j*slic.second.second]=singleValV;
2236 if(sz!=(int)multiValV.size())
2238 std::ostringstream oss;
2239 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2240 throw INTERP_KERNEL::Exception(oss.str().c_str());
2242 for(int j=0;j<sz;j++)
2243 pt[slic.first+j*slic.second.second]=multiValV[j];
2248 const double *ptV=daIntTyyppV->getConstPointer();
2249 if(sz>daIntTyyppV->getNumberOfCompo())
2251 std::ostringstream oss;
2252 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2253 throw INTERP_KERNEL::Exception(oss.str().c_str());
2255 for(int j=0;j<sz;j++)
2256 pt[slic.first+j*slic.second.second]=ptV[j];
2260 throw INTERP_KERNEL::Exception(msg);
2264 throw INTERP_KERNEL::Exception(msg);
2270 class DataArrayIntIterator;
2272 class DataArrayInt : public DataArray
2275 static DataArrayInt *New();
2276 int intValue() const throw(INTERP_KERNEL::Exception);
2277 int getHashCode() const throw(INTERP_KERNEL::Exception);
2278 bool empty() const throw(INTERP_KERNEL::Exception);
2279 DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
2280 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2281 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2282 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2283 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2284 int popBackSilent() throw(INTERP_KERNEL::Exception);
2285 void pack() const throw(INTERP_KERNEL::Exception);
2286 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2287 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2288 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2289 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2290 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2291 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2292 void reverse() throw(INTERP_KERNEL::Exception);
2293 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2294 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2295 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2296 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2297 void fillWithZero() throw(INTERP_KERNEL::Exception);
2298 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2299 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2300 std::string repr() const throw(INTERP_KERNEL::Exception);
2301 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2302 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2303 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2304 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2305 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
2306 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2307 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2308 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2311 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2312 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2313 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2315 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
2316 void transpose() throw(INTERP_KERNEL::Exception);
2317 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2318 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2319 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2320 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2321 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2322 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2323 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2324 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2325 int front() const throw(INTERP_KERNEL::Exception);
2326 int back() const throw(INTERP_KERNEL::Exception);
2327 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2328 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2329 int *getPointer() throw(INTERP_KERNEL::Exception);
2330 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2331 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2332 const int *begin() const throw(INTERP_KERNEL::Exception);
2333 const int *end() const throw(INTERP_KERNEL::Exception);
2334 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2335 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2336 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2337 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2338 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2339 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2340 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2341 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2342 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2343 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2344 int count(int value) const throw(INTERP_KERNEL::Exception);
2345 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2346 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2347 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2348 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2349 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2350 void abs() throw(INTERP_KERNEL::Exception);
2351 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2352 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2353 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2355 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2356 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2357 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2358 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2359 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2361 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2362 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2363 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2364 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2365 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2366 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2367 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2373 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2374 void computeOffsets() throw(INTERP_KERNEL::Exception);
2375 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2377 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2381 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2382 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2383 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2384 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2385 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2386 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2388 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2390 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2391 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2392 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2394 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2397 DataArrayInt() throw(INTERP_KERNEL::Exception)
2399 return DataArrayInt::New();
2402 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2404 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)";
2405 std::string msg(msgBase);
2407 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2410 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2414 if(PyInt_Check(nbOfTuples))
2416 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2418 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2421 if(PyInt_Check(nbOfComp))
2422 {//DataArrayInt.New([1,3,4,5],2,2)
2423 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2425 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2426 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2427 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2428 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2432 throw INTERP_KERNEL::Exception(msg.c_str());
2435 {//DataArrayInt.New([1,3,4],3)
2436 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2438 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2439 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2444 throw INTERP_KERNEL::Exception(msg.c_str());
2447 {// DataArrayInt.New([1,3,4])
2448 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2449 int tmpp1=-1,tmpp2=-1;
2450 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2451 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2455 else if(PyInt_Check(elt0))
2457 int nbOfTuples1=PyInt_AS_LONG(elt0);
2459 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2464 if(PyInt_Check(nbOfTuples))
2465 {//DataArrayInt.New(5,2)
2466 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2468 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2469 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2470 ret->alloc(nbOfTuples1,nbOfCompo);
2474 throw INTERP_KERNEL::Exception(msg.c_str());
2477 throw INTERP_KERNEL::Exception(msg.c_str());
2480 {//DataArrayInt.New(5)
2481 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2482 ret->alloc(nbOfTuples1,1);
2487 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2488 {//DataArrayInt.New(numpyArray)
2489 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
2493 throw INTERP_KERNEL::Exception(msg.c_str());
2496 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2498 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2501 std::string __str__() const throw(INTERP_KERNEL::Exception)
2503 return self->repr();
2506 int __len__() const throw(INTERP_KERNEL::Exception)
2508 if(self->isAllocated())
2510 return self->getNumberOfTuples();
2514 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2518 int __int__() const throw(INTERP_KERNEL::Exception)
2520 return self->intValue();
2523 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2525 return self->iterator();
2528 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2530 int sz=self->getNumberOfComponents();
2531 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2532 self->accumulate(tmp);
2533 return convertIntArrToPyList(tmp,sz);
2536 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2539 std::vector<int> val2;
2540 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2541 return self->accumulatePerChunck(bg,bg+sz);
2544 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2546 int newNbOfTuples=-1;
2547 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2548 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2549 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2550 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2551 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2552 PyObject *ret=PyTuple_New(2);
2553 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2554 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2558 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2560 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 !";
2561 if(PyList_Check(li) || PyTuple_Check(li))
2565 if(PyInt_Check(nbOfTuples))
2567 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2569 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2572 if(PyInt_Check(nbOfComp))
2573 {//DataArrayInt.setValues([1,3,4,5],2,2)
2574 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2576 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2577 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2578 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2581 throw INTERP_KERNEL::Exception(msg);
2584 {//DataArrayInt.setValues([1,3,4],3)
2586 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2587 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2591 throw INTERP_KERNEL::Exception(msg);
2594 {// DataArrayInt.setValues([1,3,4])
2595 int tmpp1=-1,tmpp2=-1;
2596 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2597 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2601 throw INTERP_KERNEL::Exception(msg);
2604 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2606 const int *vals=self->getConstPointer();
2607 return convertIntArrToPyList(vals,self->getNbOfElems());
2611 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2613 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT,"DataArrayInt");
2617 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2620 bool ret0=self->isEqualIfNotWhy(other,ret1);
2621 PyObject *ret=PyTuple_New(2);
2622 PyObject *ret0Py=ret0?Py_True:Py_False;
2624 PyTuple_SetItem(ret,0,ret0Py);
2625 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2629 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2631 const int *vals=self->getConstPointer();
2632 int nbOfComp=self->getNumberOfComponents();
2633 int nbOfTuples=self->getNumberOfTuples();
2634 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2637 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2639 std::vector<const DataArrayInt *> groups;
2640 std::vector< std::vector<int> > fidsOfGroups;
2641 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2642 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2643 PyObject *ret = PyList_New(2);
2644 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2645 int sz=fidsOfGroups.size();
2646 PyObject *ret1 = PyList_New(sz);
2647 for(int i=0;i<sz;i++)
2648 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2649 PyList_SetItem(ret,1,ret1);
2653 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2656 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2657 if (!SWIG_IsOK(res1))
2660 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2661 self->transformWithIndArr(tmp,tmp+size);
2665 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2666 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2670 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2674 std::vector<int> multiVal;
2675 std::pair<int, std::pair<int,int> > slic;
2676 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2677 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2681 return self->getIdsEqualList(&singleVal,&singleVal+1);
2683 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2685 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2687 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2691 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2695 std::vector<int> multiVal;
2696 std::pair<int, std::pair<int,int> > slic;
2697 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2698 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2702 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2704 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2706 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2708 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2712 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2714 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2716 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2717 if (!SWIG_IsOK(res1))
2720 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2721 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2725 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2727 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2728 da2->checkAllocated();
2729 int size=self->getNumberOfTuples();
2730 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2732 PyObject *ret = PyList_New(3);
2733 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2734 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2735 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2739 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2742 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2743 if (!SWIG_IsOK(res1))
2746 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2747 return self->transformWithIndArrR(tmp,tmp+size);
2751 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2752 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2756 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2759 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2760 if (!SWIG_IsOK(res1))
2763 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2764 if(size!=self->getNumberOfTuples())
2766 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2768 return self->renumberAndReduce(tmp,newNbOfTuple);
2772 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2774 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2775 da2->checkAllocated();
2776 int size=self->getNumberOfTuples();
2777 if(size!=self->getNumberOfTuples())
2779 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2781 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2785 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2788 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2789 if (!SWIG_IsOK(res1))
2792 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2793 if(size!=self->getNumberOfTuples())
2795 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2797 return self->renumber(tmp);
2801 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2803 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2804 da2->checkAllocated();
2805 int size=self->getNumberOfTuples();
2806 if(size!=self->getNumberOfTuples())
2808 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2810 return self->renumber(da2->getConstPointer());
2814 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2817 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2818 if (!SWIG_IsOK(res1))
2821 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2822 if(size!=self->getNumberOfTuples())
2824 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2826 return self->renumberR(tmp);
2830 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2832 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2833 da2->checkAllocated();
2834 int size=self->getNumberOfTuples();
2835 if(size!=self->getNumberOfTuples())
2837 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2839 return self->renumberR(da2->getConstPointer());
2843 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2846 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2847 if (!SWIG_IsOK(res1))
2850 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2851 return self->selectByTupleId(tmp,tmp+size);
2855 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2857 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2858 da2->checkAllocated();
2859 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2863 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2866 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2867 if (!SWIG_IsOK(res1))
2870 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2871 return self->selectByTupleIdSafe(tmp,tmp+size);
2875 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2877 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2878 da2->checkAllocated();
2879 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2883 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2885 std::vector<int> tmp;
2886 convertPyToNewIntArr3(li,tmp);
2887 self->setSelectedComponents(a,tmp);
2890 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2892 int sz=self->getNumberOfComponents();
2893 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2894 self->getTuple(tupleId,tmp);
2895 return convertIntArrToPyList(tmp,sz);
2898 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2900 DataArrayInt *arr=0;
2901 DataArrayInt *arrI=0;
2902 self->changeSurjectiveFormat(targetNb,arr,arrI);
2903 PyObject *res = PyList_New(2);
2904 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2905 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2909 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2911 std::vector<const DataArrayInt *> tmp;
2912 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2913 return DataArrayInt::Meld(tmp);
2916 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2918 std::vector<const DataArrayInt *> tmp;
2919 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2920 return DataArrayInt::Aggregate(tmp);
2923 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2925 std::vector<const DataArrayInt *> tmp;
2926 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2927 return DataArrayInt::AggregateIndexes(tmp);
2930 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2932 std::vector<const DataArrayInt *> tmp;
2933 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2934 return DataArrayInt::BuildUnion(tmp);
2937 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2939 std::vector<const DataArrayInt *> tmp;
2940 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2941 return DataArrayInt::BuildIntersection(tmp);
2944 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2947 int r1=self->getMaxValue(tmp);
2948 PyObject *ret=PyTuple_New(2);
2949 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2950 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2954 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2957 int r1=self->getMinValue(tmp);
2958 PyObject *ret=PyTuple_New(2);
2959 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2960 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2964 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2966 int nbOfCompo=self->getNumberOfComponents();
2971 if(PyInt_Check(obj))
2973 int val=(int)PyInt_AS_LONG(obj);
2974 return self->locateValue(val);
2977 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2981 std::vector<int> arr;
2982 convertPyToNewIntArr3(obj,arr);
2983 return self->locateTuple(arr);
2988 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2990 int nbOfCompo=self->getNumberOfComponents();
2997 if(PyInt_Check(obj))
2999 int val=(int)PyInt_AS_LONG(obj);
3000 return self->presenceOfValue(val);
3003 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3007 std::vector<int> arr;
3008 convertPyToNewIntArr3(obj,arr);
3009 return self->presenceOfTuple(arr);
3014 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3016 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3017 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3018 self->checkAllocated();
3019 int nbOfTuples=self->getNumberOfTuples();
3020 int nbOfComponents=self->getNumberOfComponents();
3022 std::vector<int> vt1,vc1;
3023 std::pair<int, std::pair<int,int> > pt1,pc1;
3024 DataArrayInt *dt1=0,*dc1=0;
3026 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3027 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3032 if(nbOfComponents==1)
3033 return PyInt_FromLong(self->getIJSafe(it1,0));
3034 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3037 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3039 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3041 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3043 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3046 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3047 std::vector<int> v2(1,ic1);
3048 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3052 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3053 std::vector<int> v2(1,ic1);
3054 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3058 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3059 std::vector<int> v2(1,ic1);
3060 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3064 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3065 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3069 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3070 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3074 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3075 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3079 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3080 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3084 ret=self->selectByTupleIdSafe(&it1,&it1+1);
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->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
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->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
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 );
3111 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3112 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3113 std::vector<int> v2(nbOfComp);
3114 for(int i=0;i<nbOfComp;i++)
3115 v2[i]=pc1.first+i*pc1.second.second;
3116 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3119 throw INTERP_KERNEL::Exception(msg);
3123 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3125 self->checkAllocated();
3126 const char msg[]="Unexpected situation in __setitem__ !";
3127 int nbOfTuples=self->getNumberOfTuples();
3128 int nbOfComponents=self->getNumberOfComponents();
3131 std::vector<int> v1;
3133 DataArrayIntTuple *dd1=0;
3134 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3136 std::vector<int> vt1,vc1;
3137 std::pair<int, std::pair<int,int> > pt1,pc1;
3138 DataArrayInt *dt1=0,*dc1=0;
3139 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3140 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3148 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3151 tmp=DataArrayInt::New();
3152 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3153 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3156 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3159 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3160 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3163 throw INTERP_KERNEL::Exception(msg);
3172 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3175 tmp=DataArrayInt::New();
3176 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3177 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3180 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3183 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3184 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3187 throw INTERP_KERNEL::Exception(msg);
3196 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3199 tmp=DataArrayInt::New();
3200 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3201 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3204 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3207 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3208 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3211 throw INTERP_KERNEL::Exception(msg);
3220 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3223 tmp=DataArrayInt::New();
3224 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3225 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3228 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3231 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3232 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3235 throw INTERP_KERNEL::Exception(msg);
3244 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3247 tmp=DataArrayInt::New();
3248 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3249 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3252 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3255 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3256 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3259 throw INTERP_KERNEL::Exception(msg);
3268 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3271 tmp=DataArrayInt::New();
3272 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3273 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3276 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3279 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3280 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3283 throw INTERP_KERNEL::Exception(msg);
3292 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3295 tmp=DataArrayInt::New();
3296 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3297 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3300 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3303 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3304 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3307 throw INTERP_KERNEL::Exception(msg);
3316 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3319 tmp=DataArrayInt::New();
3320 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3321 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3324 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3327 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3328 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3331 throw INTERP_KERNEL::Exception(msg);
3340 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3343 tmp=DataArrayInt::New();
3344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3345 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3348 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3351 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3352 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3355 throw INTERP_KERNEL::Exception(msg);
3364 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3367 tmp=DataArrayInt::New();
3368 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3369 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3372 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3375 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3376 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3379 throw INTERP_KERNEL::Exception(msg);
3388 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3391 tmp=DataArrayInt::New();
3392 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3393 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3396 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3399 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3400 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3403 throw INTERP_KERNEL::Exception(msg);
3412 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3415 tmp=DataArrayInt::New();
3416 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3417 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3420 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3423 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3424 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3427 throw INTERP_KERNEL::Exception(msg);
3436 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3439 tmp=DataArrayInt::New();
3440 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3441 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3444 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3447 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3448 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3451 throw INTERP_KERNEL::Exception(msg);
3460 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3463 tmp=DataArrayInt::New();
3464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3465 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3468 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3471 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3472 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3475 throw INTERP_KERNEL::Exception(msg);
3484 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3487 tmp=DataArrayInt::New();
3488 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3489 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3492 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3495 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3496 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3499 throw INTERP_KERNEL::Exception(msg);
3508 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3511 tmp=DataArrayInt::New();
3512 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3513 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3516 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3519 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3520 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3523 throw INTERP_KERNEL::Exception(msg);
3528 throw INTERP_KERNEL::Exception(msg);
3533 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3535 return self->negate();
3538 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3540 const char msg[]="Unexpected situation in __add__ !";
3543 std::vector<int> aa;
3544 DataArrayIntTuple *aaa;
3546 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3551 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3552 ret->applyLin(1,val);
3557 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3558 return DataArrayInt::Add(self,aaaa);
3562 return DataArrayInt::Add(self,a);
3566 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3567 return DataArrayInt::Add(self,aaaa);
3570 throw INTERP_KERNEL::Exception(msg);
3574 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3576 const char msg[]="Unexpected situation in __radd__ !";
3579 std::vector<int> aa;
3580 DataArrayIntTuple *aaa;
3582 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3587 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3588 ret->applyLin(1,val);
3593 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3594 return DataArrayInt::Add(self,aaaa);
3598 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3599 return DataArrayInt::Add(self,aaaa);
3602 throw INTERP_KERNEL::Exception(msg);
3606 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3608 const char msg[]="Unexpected situation in __iadd__ !";
3611 std::vector<int> aa;
3612 DataArrayIntTuple *aaa;
3614 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3619 self->applyLin(1,val);
3620 Py_XINCREF(trueSelf);
3625 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3627 Py_XINCREF(trueSelf);
3633 Py_XINCREF(trueSelf);
3638 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3639 self->addEqual(aaaa);
3640 Py_XINCREF(trueSelf);
3644 throw INTERP_KERNEL::Exception(msg);
3648 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3650 const char msg[]="Unexpected situation in __sub__ !";
3653 std::vector<int> aa;
3654 DataArrayIntTuple *aaa;
3656 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3661 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3662 ret->applyLin(1,-val);
3667 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3668 return DataArrayInt::Substract(self,aaaa);
3672 return DataArrayInt::Substract(self,a);
3676 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3677 return DataArrayInt::Substract(self,aaaa);
3680 throw INTERP_KERNEL::Exception(msg);
3684 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3686 const char msg[]="Unexpected situation in __rsub__ !";
3689 std::vector<int> aa;
3690 DataArrayIntTuple *aaa;
3692 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3697 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3698 ret->applyLin(-1,val);
3703 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3704 return DataArrayInt::Substract(aaaa,self);
3708 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3709 return DataArrayInt::Substract(aaaa,self);
3712 throw INTERP_KERNEL::Exception(msg);
3716 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3718 const char msg[]="Unexpected situation in __isub__ !";
3721 std::vector<int> aa;
3722 DataArrayIntTuple *aaa;
3724 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3729 self->applyLin(1,-val);
3730 Py_XINCREF(trueSelf);
3735 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3736 self->substractEqual(bb);
3737 Py_XINCREF(trueSelf);
3742 self->substractEqual(a);
3743 Py_XINCREF(trueSelf);
3748 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3749 self->substractEqual(aaaa);
3750 Py_XINCREF(trueSelf);
3754 throw INTERP_KERNEL::Exception(msg);
3758 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3760 const char msg[]="Unexpected situation in __mul__ !";
3763 std::vector<int> aa;
3764 DataArrayIntTuple *aaa;
3766 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3771 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3772 ret->applyLin(val,0);
3777 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3778 return DataArrayInt::Multiply(self,aaaa);
3782 return DataArrayInt::Multiply(self,a);
3786 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3787 return DataArrayInt::Multiply(self,aaaa);
3790 throw INTERP_KERNEL::Exception(msg);
3794 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3796 const char msg[]="Unexpected situation in __rmul__ !";
3799 std::vector<int> aa;
3800 DataArrayIntTuple *aaa;
3802 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3807 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3808 ret->applyLin(val,0);
3813 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3814 return DataArrayInt::Multiply(self,aaaa);
3818 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3819 return DataArrayInt::Multiply(self,aaaa);
3822 throw INTERP_KERNEL::Exception(msg);
3826 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3828 const char msg[]="Unexpected situation in __imul__ !";
3831 std::vector<int> aa;
3832 DataArrayIntTuple *aaa;
3834 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3839 self->applyLin(val,0);
3840 Py_XINCREF(trueSelf);
3845 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3846 self->multiplyEqual(bb);
3847 Py_XINCREF(trueSelf);
3852 self->multiplyEqual(a);
3853 Py_XINCREF(trueSelf);
3858 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3859 self->multiplyEqual(aaaa);
3860 Py_XINCREF(trueSelf);
3864 throw INTERP_KERNEL::Exception(msg);
3868 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3870 const char msg[]="Unexpected situation in __div__ !";
3873 std::vector<int> aa;
3874 DataArrayIntTuple *aaa;
3876 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3881 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3882 ret->applyDivideBy(val);
3887 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3888 return DataArrayInt::Divide(self,aaaa);
3892 return DataArrayInt::Divide(self,a);
3896 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3897 return DataArrayInt::Divide(self,aaaa);
3900 throw INTERP_KERNEL::Exception(msg);
3904 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3906 const char msg[]="Unexpected situation in __rdiv__ !";
3909 std::vector<int> aa;
3910 DataArrayIntTuple *aaa;
3912 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3917 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3923 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3924 return DataArrayInt::Divide(aaaa,self);
3928 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3929 return DataArrayInt::Divide(aaaa,self);
3932 throw INTERP_KERNEL::Exception(msg);
3936 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3938 const char msg[]="Unexpected situation in __idiv__ !";
3941 std::vector<int> aa;
3942 DataArrayIntTuple *aaa;
3944 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3949 self->applyDivideBy(val);
3950 Py_XINCREF(trueSelf);
3955 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3956 self->divideEqual(bb);
3957 Py_XINCREF(trueSelf);
3962 self->divideEqual(a);
3963 Py_XINCREF(trueSelf);
3968 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3969 self->divideEqual(aaaa);
3970 Py_XINCREF(trueSelf);
3974 throw INTERP_KERNEL::Exception(msg);
3978 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3980 const char msg[]="Unexpected situation in __mod__ !";
3983 std::vector<int> aa;
3984 DataArrayIntTuple *aaa;
3986 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3991 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3992 ret->applyModulus(val);
3997 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3998 return DataArrayInt::Modulus(self,aaaa);
4002 return DataArrayInt::Modulus(self,a);
4006 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4007 return DataArrayInt::Modulus(self,aaaa);
4010 throw INTERP_KERNEL::Exception(msg);
4014 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4016 const char msg[]="Unexpected situation in __rmod__ !";
4019 std::vector<int> aa;
4020 DataArrayIntTuple *aaa;
4022 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4028 ret->applyRModulus(val);
4033 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4034 return DataArrayInt::Modulus(aaaa,self);
4038 return DataArrayInt::Modulus(a,self);
4042 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4043 return DataArrayInt::Modulus(aaaa,self);
4046 throw INTERP_KERNEL::Exception(msg);
4050 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4052 const char msg[]="Unexpected situation in __imod__ !";
4055 std::vector<int> aa;
4056 DataArrayIntTuple *aaa;
4058 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4063 self->applyModulus(val);
4064 Py_XINCREF(trueSelf);
4069 self->modulusEqual(a);
4070 Py_XINCREF(trueSelf);
4075 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4076 self->modulusEqual(aaaa);
4077 Py_XINCREF(trueSelf);
4081 throw INTERP_KERNEL::Exception(msg);
4085 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4087 const char msg[]="Unexpected situation in __pow__ !";
4090 std::vector<int> aa;
4091 DataArrayIntTuple *aaa;
4093 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4098 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4104 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4105 return DataArrayInt::Pow(self,aaaa);
4109 return DataArrayInt::Pow(self,a);
4113 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4114 return DataArrayInt::Pow(self,aaaa);
4117 throw INTERP_KERNEL::Exception(msg);
4121 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4123 const char msg[]="Unexpected situation in __rpow__ !";
4126 std::vector<int> aa;
4127 DataArrayIntTuple *aaa;
4129 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4134 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4135 ret->applyRPow(val);
4140 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4141 return DataArrayInt::Pow(aaaa,self);
4145 return DataArrayInt::Pow(a,self);
4149 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4150 return DataArrayInt::Pow(aaaa,self);
4153 throw INTERP_KERNEL::Exception(msg);
4157 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4159 const char msg[]="Unexpected situation in __ipow__ !";
4162 std::vector<int> aa;
4163 DataArrayIntTuple *aaa;
4165 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4170 self->applyPow(val);
4171 Py_XINCREF(trueSelf);
4177 Py_XINCREF(trueSelf);
4182 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4183 self->powEqual(aaaa);
4184 Py_XINCREF(trueSelf);
4188 throw INTERP_KERNEL::Exception(msg);
4192 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4194 std::ostringstream oss;
4195 self->reprQuickOverview(oss);
4199 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4201 int szArr,sw,iTypppArr;
4202 std::vector<int> stdvecTyyppArr;
4203 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4204 self->pushBackValsSilent(tmp,tmp+szArr);
4207 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4209 std::vector<int> ret1;
4210 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4211 std::size_t sz=ret0.size();
4212 PyObject *pyRet=PyTuple_New(2);
4213 PyObject *pyRet0=PyList_New((int)sz);
4214 PyObject *pyRet1=PyList_New((int)sz);
4215 for(std::size_t i=0;i<sz;i++)
4217 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4218 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4220 PyTuple_SetItem(pyRet,0,pyRet0);
4221 PyTuple_SetItem(pyRet,1,pyRet1);
4225 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4227 DataArrayInt *ret0=0,*ret1=0;
4228 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4229 PyObject *pyRet=PyTuple_New(2);
4230 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4231 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4237 class DataArrayIntTuple;
4239 class DataArrayIntIterator
4242 DataArrayIntIterator(DataArrayInt *da);
4243 ~DataArrayIntIterator();
4248 DataArrayIntTuple *ret=self->nextt();
4250 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4253 PyErr_SetString(PyExc_StopIteration,"No more data.");
4260 class DataArrayIntTuple
4263 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4264 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4267 std::string __str__() const throw(INTERP_KERNEL::Exception)
4269 return self->repr();
4272 int __int__() const throw(INTERP_KERNEL::Exception)
4274 return self->intValue();
4277 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4279 return self->buildDAInt(1,self->getNumberOfCompo());
4282 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4284 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4285 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4286 Py_XINCREF(trueSelf);
4290 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4292 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4293 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4294 Py_XINCREF(trueSelf);
4298 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4300 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4301 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4302 Py_XINCREF(trueSelf);
4306 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4308 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4309 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4310 Py_XINCREF(trueSelf);
4314 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4316 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4317 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4318 Py_XINCREF(trueSelf);
4322 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4324 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4327 std::vector<int> multiVal;
4328 std::pair<int, std::pair<int,int> > slic;
4329 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4330 const int *pt=self->getConstPointer();
4331 int nbc=self->getNumberOfCompo();
4332 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4339 std::ostringstream oss;
4340 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4341 throw INTERP_KERNEL::Exception(oss.str().c_str());
4344 return PyInt_FromLong(pt[singleVal]);
4348 return PyInt_FromLong(pt[nbc+singleVal]);
4351 std::ostringstream oss;
4352 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4353 throw INTERP_KERNEL::Exception(oss.str().c_str());
4359 PyObject *t=PyTuple_New(multiVal.size());
4360 for(int j=0;j<(int)multiVal.size();j++)
4362 int cid=multiVal[j];
4365 std::ostringstream oss;
4366 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4367 throw INTERP_KERNEL::Exception(oss.str().c_str());
4369 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4375 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4376 PyObject *t=PyTuple_New(sz);
4377 for(int j=0;j<sz;j++)
4378 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4382 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4386 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4388 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4389 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4392 std::vector<int> multiValV;
4393 std::pair<int, std::pair<int,int> > slicV;
4394 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4395 int nbc=self->getNumberOfCompo();
4396 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4398 std::vector<int> multiVal;
4399 std::pair<int, std::pair<int,int> > slic;
4400 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4401 int *pt=self->getPointer();
4402 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4409 std::ostringstream oss;
4410 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4411 throw INTERP_KERNEL::Exception(oss.str().c_str());
4417 pt[singleVal]=singleValV;
4422 if(multiValV.size()!=1)
4424 std::ostringstream oss;
4425 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4426 throw INTERP_KERNEL::Exception(oss.str().c_str());
4428 pt[singleVal]=multiValV[0];
4433 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4437 throw INTERP_KERNEL::Exception(msg);
4446 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4450 std::ostringstream oss;
4451 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4452 throw INTERP_KERNEL::Exception(oss.str().c_str());
4460 if(multiVal.size()!=multiValV.size())
4462 std::ostringstream oss;
4463 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4464 throw INTERP_KERNEL::Exception(oss.str().c_str());
4466 for(int i=0;i<(int)multiVal.size();i++)
4468 int pos=multiVal[i];
4471 std::ostringstream oss;
4472 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4473 throw INTERP_KERNEL::Exception(oss.str().c_str());
4475 pt[multiVal[i]]=multiValV[i];
4481 const int *ptV=daIntTyyppV->getConstPointer();
4482 if(nbc>daIntTyyppV->getNumberOfCompo())
4484 std::ostringstream oss;
4485 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4486 throw INTERP_KERNEL::Exception(oss.str().c_str());
4488 std::copy(ptV,ptV+nbc,pt);
4492 throw INTERP_KERNEL::Exception(msg);
4497 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4502 for(int j=0;j<sz;j++)
4503 pt[slic.first+j*slic.second.second]=singleValV;
4508 if(sz!=(int)multiValV.size())
4510 std::ostringstream oss;
4511 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4512 throw INTERP_KERNEL::Exception(oss.str().c_str());
4514 for(int j=0;j<sz;j++)
4515 pt[slic.first+j*slic.second.second]=multiValV[j];
4520 const int *ptV=daIntTyyppV->getConstPointer();
4521 if(sz>daIntTyyppV->getNumberOfCompo())
4523 std::ostringstream oss;
4524 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4525 throw INTERP_KERNEL::Exception(oss.str().c_str());
4527 for(int j=0;j<sz;j++)
4528 pt[slic.first+j*slic.second.second]=ptV[j];
4532 throw INTERP_KERNEL::Exception(msg);
4536 throw INTERP_KERNEL::Exception(msg);
4542 class DataArrayChar : public DataArray
4545 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4546 virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
4547 int getHashCode() const throw(INTERP_KERNEL::Exception);
4548 bool empty() const throw(INTERP_KERNEL::Exception);
4549 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4550 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4551 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4552 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4553 char popBackSilent() throw(INTERP_KERNEL::Exception);
4554 void pack() const throw(INTERP_KERNEL::Exception);
4555 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4556 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4557 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4558 void reverse() throw(INTERP_KERNEL::Exception);
4559 void fillWithZero() throw(INTERP_KERNEL::Exception);
4560 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4561 std::string repr() const throw(INTERP_KERNEL::Exception);
4562 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4563 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
4564 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4565 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4566 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4567 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4568 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4569 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4570 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4571 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4572 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4573 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4574 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4575 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4576 char front() const throw(INTERP_KERNEL::Exception);
4577 char back() const throw(INTERP_KERNEL::Exception);
4578 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4579 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4580 char *getPointer() throw(INTERP_KERNEL::Exception);
4581 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4582 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4583 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4584 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4585 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4586 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4587 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4588 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4589 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4590 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4591 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4594 int __len__() const throw(INTERP_KERNEL::Exception)
4596 if(self->isAllocated())
4598 return self->getNumberOfTuples();
4602 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4606 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4609 bool ret0=self->isEqualIfNotWhy(other,ret1);
4610 PyObject *ret=PyTuple_New(2);
4611 PyObject *ret0Py=ret0?Py_True:Py_False;
4613 PyTuple_SetItem(ret,0,ret0Py);
4614 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4618 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4621 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4622 if (!SWIG_IsOK(res1))
4625 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4626 if(size!=self->getNumberOfTuples())
4628 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4630 return self->renumber(tmp);
4634 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4636 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4637 da2->checkAllocated();
4638 int size=self->getNumberOfTuples();
4639 if(size!=self->getNumberOfTuples())
4641 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4643 return self->renumber(da2->getConstPointer());
4647 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4650 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4651 if (!SWIG_IsOK(res1))
4654 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4655 if(size!=self->getNumberOfTuples())
4657 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4659 return self->renumberR(tmp);
4663 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4665 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4666 da2->checkAllocated();
4667 int size=self->getNumberOfTuples();
4668 if(size!=self->getNumberOfTuples())
4670 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4672 return self->renumberR(da2->getConstPointer());
4676 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4679 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4680 if (!SWIG_IsOK(res1))
4683 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4684 if(size!=self->getNumberOfTuples())
4686 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4688 return self->renumberAndReduce(tmp,newNbOfTuple);
4692 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4694 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4695 da2->checkAllocated();
4696 int size=self->getNumberOfTuples();
4697 if(size!=self->getNumberOfTuples())
4699 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4701 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4705 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4708 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4709 if (!SWIG_IsOK(res1))
4712 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4713 return self->selectByTupleIdSafe(tmp,tmp+size);
4717 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4719 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4720 da2->checkAllocated();
4721 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4725 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4727 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4728 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4729 return DataArrayChar::Aggregate(tmp);
4732 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4734 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4735 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4736 return DataArrayChar::Meld(tmp);
4741 class DataArrayByteIterator;
4743 class DataArrayByte : public DataArrayChar
4746 static DataArrayByte *New();
4747 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4748 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4749 char byteValue() const throw(INTERP_KERNEL::Exception);
4752 DataArrayByte() throw(INTERP_KERNEL::Exception)
4754 return DataArrayByte::New();
4757 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4759 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) !";
4760 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4764 if(PyInt_Check(nbOfTuples))
4766 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4768 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4771 if(PyInt_Check(nbOfComp))
4772 {//DataArrayByte.New([1,3,4,5],2,2)
4773 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4775 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4776 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4777 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4778 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4782 throw INTERP_KERNEL::Exception(msg);
4785 {//DataArrayByte.New([1,3,4],3)
4786 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4788 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4789 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4794 throw INTERP_KERNEL::Exception(msg);
4797 {// DataArrayByte.New([1,3,4])
4798 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4799 int tmpp1=-1,tmpp2=-1;
4800 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4801 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4805 else if(PyInt_Check(elt0))
4807 int nbOfTuples1=PyInt_AS_LONG(elt0);
4809 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4814 if(PyInt_Check(nbOfTuples))
4815 {//DataArrayByte.New(5,2)
4816 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4818 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4819 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4820 ret->alloc(nbOfTuples1,nbOfCompo);
4824 throw INTERP_KERNEL::Exception(msg);
4827 throw INTERP_KERNEL::Exception(msg);
4830 {//DataArrayByte.New(5)
4831 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4832 ret->alloc(nbOfTuples1,1);
4837 throw INTERP_KERNEL::Exception(msg);
4840 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4842 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4845 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4847 std::ostringstream oss;
4848 self->reprQuickOverview(oss);
4852 int __int__() const throw(INTERP_KERNEL::Exception)
4854 return (int) self->byteValue();
4857 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4859 return self->iterator();
4862 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4864 return (int)self->getIJ(tupleId,compoId);
4867 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4869 return (int)self->getIJSafe(tupleId,compoId);
4872 std::string __str__() const throw(INTERP_KERNEL::Exception)
4874 return self->repr();
4877 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4879 const char *vals=self->getConstPointer();
4880 int nbOfComp=self->getNumberOfComponents();
4881 int nbOfTuples=self->getNumberOfTuples();
4882 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4885 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4888 int ival=-1; std::vector<int> ivval;
4889 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4890 std::vector<char> vals(sz);
4891 std::copy(pt,pt+sz,vals.begin());
4892 return self->presenceOfTuple(vals);
4895 bool presenceOfValue(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->presenceOfValue(vals2);
4905 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4908 int ival=-1; std::vector<int> ivval;
4909 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4910 std::vector<char> vals2(sz);
4911 std::copy(pt,pt+sz,vals2.begin());
4912 return self->locateValue(vals2);
4915 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4918 int ival=-1; std::vector<int> ivval;
4919 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4920 std::vector<char> vals(sz);
4921 std::copy(pt,pt+sz,vals.begin());
4922 return self->locateTuple(vals);
4925 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4928 int ival=-1; std::vector<int> ivval;
4929 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4930 std::vector<char> vals(sz);
4931 std::copy(pt,pt+sz,vals.begin());
4932 return self->search(vals);
4935 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4937 int sz=self->getNumberOfComponents();
4938 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4939 self->getTuple(tupleId,tmp);
4940 PyObject *ret=PyTuple_New(sz);
4941 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4945 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4948 int r1=(int)self->getMaxValue(tmp);
4949 PyObject *ret=PyTuple_New(2);
4950 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4951 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4955 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4958 int r1=(int)self->getMinValue(tmp);
4959 PyObject *ret=PyTuple_New(2);
4960 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4961 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4965 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4967 int nbOfCompo=self->getNumberOfComponents();
4972 if(PyInt_Check(obj))
4974 int val=(int)PyInt_AS_LONG(obj);
4975 return self->locateValue(val);
4978 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4981 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4985 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4987 int nbOfCompo=self->getNumberOfComponents();
4994 if(PyInt_Check(obj))
4996 int val=(int)PyInt_AS_LONG(obj);
4997 return self->presenceOfValue(val);
5000 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5003 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5009 class DataArrayByteTuple;
5011 class DataArrayByteIterator
5014 DataArrayByteIterator(DataArrayByte *da);
5015 ~DataArrayByteIterator();
5018 class DataArrayByteTuple
5021 std::string repr() const throw(INTERP_KERNEL::Exception);
5022 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5025 std::string __str__() const throw(INTERP_KERNEL::Exception)
5027 return self->repr();
5030 char __int__() const throw(INTERP_KERNEL::Exception)
5032 return self->byteValue();
5035 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5037 return self->buildDAByte(1,self->getNumberOfCompo());
5042 class DataArrayAsciiCharIterator;
5044 class DataArrayAsciiChar : public DataArrayChar
5047 static DataArrayAsciiChar *New();
5048 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5049 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5050 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5053 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5055 return DataArrayAsciiChar::New();
5058 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5060 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) !";
5061 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5065 if(PyInt_Check(nbOfTuples))
5067 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5069 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5072 if(PyInt_Check(nbOfComp))
5073 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5074 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5076 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5077 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5078 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5079 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5083 throw INTERP_KERNEL::Exception(msg);
5086 {//DataArrayAsciiChar.New([1,3,4],3)
5087 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5089 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5090 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5094 else if(PyString_Check(nbOfTuples))
5096 if(PyString_Size(nbOfTuples)!=1)
5097 throw INTERP_KERNEL::Exception(msg);
5098 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5099 std::vector<std::string> tmp;
5100 if(fillStringVector(elt0,tmp))
5101 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5103 throw INTERP_KERNEL::Exception(msg);
5106 throw INTERP_KERNEL::Exception(msg);
5110 std::vector<std::string> tmmp;
5111 if(fillStringVector(elt0,tmmp))
5112 //DataArrayAsciiChar.New(["abc","de","fghi"])
5113 return DataArrayAsciiChar::New(tmmp,' ');
5116 // DataArrayAsciiChar.New([1,3,4])
5117 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5118 int tmpp1=-1,tmpp2=-1;
5119 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5120 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5125 else if(PyInt_Check(elt0))
5127 int nbOfTuples1=PyInt_AS_LONG(elt0);
5129 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5134 if(PyInt_Check(nbOfTuples))
5135 {//DataArrayAsciiChar.New(5,2)
5136 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5138 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5139 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5140 ret->alloc(nbOfTuples1,nbOfCompo);
5144 throw INTERP_KERNEL::Exception(msg);
5147 throw INTERP_KERNEL::Exception(msg);
5150 {//DataArrayAsciiChar.New(5)
5151 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5152 ret->alloc(nbOfTuples1,1);
5157 throw INTERP_KERNEL::Exception(msg);
5160 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5162 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5165 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5167 std::ostringstream oss;
5168 self->reprQuickOverview(oss);
5172 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5174 return self->iterator();
5177 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5179 char tmp[2]; tmp[1]='\0';
5180 tmp[0]=self->getIJ(tupleId,compoId);
5181 return std::string(tmp);
5184 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5186 char tmp[2]; tmp[1]='\0';
5187 tmp[0]=self->getIJSafe(tupleId,compoId);
5188 return std::string(tmp);
5191 std::string __str__() const throw(INTERP_KERNEL::Exception)
5193 return self->repr();
5196 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5198 const char *vals=self->getConstPointer();
5199 int nbOfComp=self->getNumberOfComponents();
5200 int nbOfTuples=self->getNumberOfTuples();
5201 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5204 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5206 if(PyString_Check(tupl))
5208 Py_ssize_t sz=PyString_Size(tupl);
5209 std::vector<char> vals(sz);
5210 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5211 return self->presenceOfTuple(vals);
5214 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5217 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5219 if(PyString_Check(vals))
5221 Py_ssize_t sz=PyString_Size(vals);
5222 std::vector<char> vals2(sz);
5223 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5224 return self->presenceOfValue(vals2);
5227 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5230 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5232 if(PyString_Check(vals))
5234 Py_ssize_t sz=PyString_Size(vals);
5235 std::vector<char> vals2(sz);
5236 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5237 return self->locateValue(vals2);
5240 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5243 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5245 if(PyString_Check(tupl))
5247 Py_ssize_t sz=PyString_Size(tupl);
5248 std::vector<char> vals(sz);
5249 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5250 return self->locateTuple(vals);
5253 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5256 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5258 if(PyString_Check(strOrListOfInt))
5260 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5261 std::vector<char> vals(sz);
5262 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5263 return self->search(vals);
5266 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5269 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5271 int sz=self->getNumberOfComponents();
5272 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5273 self->getTuple(tupleId,tmp);
5274 return PyString_FromString(tmp);
5277 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5280 char tmp2[2]; tmp2[1]='\0';
5281 tmp2[0]=self->getMaxValue(tmp);
5282 PyObject *ret=PyTuple_New(2);
5283 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5284 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5288 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5291 char tmp2[2]; tmp2[1]='\0';
5292 tmp2[0]=self->getMinValue(tmp);
5293 PyObject *ret=PyTuple_New(2);
5294 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5295 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5299 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5301 int nbOfCompo=self->getNumberOfComponents();
5306 if(PyString_Check(obj))
5308 Py_ssize_t sz=PyString_Size(obj);
5309 char *pt=PyString_AsString(obj);
5311 return self->locateValue(pt[0]);
5313 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5316 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5319 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5323 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5325 int nbOfCompo=self->getNumberOfComponents();
5332 if(PyString_Check(obj))
5334 Py_ssize_t sz=PyString_Size(obj);
5335 char *pt=PyString_AsString(obj);
5337 return self->presenceOfValue(pt[0]);
5339 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5342 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5345 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5349 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5352 std::vector<int> stdvecTyyppArr;
5353 std::pair<int, std::pair<int,int> > sTyyppArr;
5354 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5355 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5359 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5361 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5363 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5365 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5367 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5371 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5373 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.";
5375 std::vector<int> stdvecTyyppArr;
5376 std::pair<int, std::pair<int,int> > sTyyppArr;
5377 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5378 int nbOfCompo=self->getNumberOfComponents();
5379 int nbOfTuples=self->getNumberOfTuples();
5380 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5382 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5383 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5392 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5398 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5399 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5402 //value vector<string>
5405 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5406 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5409 //value DataArrayChar
5412 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5416 throw INTERP_KERNEL::Exception(msg);
5420 {//obj list-tuple[int]
5426 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5432 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5433 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5436 //value vector<string>
5439 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5440 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5443 //value DataArrayChar
5446 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5450 throw INTERP_KERNEL::Exception(msg);
5461 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5467 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5468 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5471 //value vector<string>
5474 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5475 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5478 //value DataArrayChar
5481 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5485 throw INTERP_KERNEL::Exception(msg);
5496 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5502 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5503 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5506 //value vector<string>
5509 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5510 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5513 //value DataArrayChar
5516 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5520 throw INTERP_KERNEL::Exception(msg);
5525 throw INTERP_KERNEL::Exception(msg);
5531 class DataArrayAsciiCharTuple;
5533 class DataArrayAsciiCharIterator
5536 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5537 ~DataArrayAsciiCharIterator();
5542 DataArrayAsciiCharTuple *ret=self->nextt();
5544 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5547 PyErr_SetString(PyExc_StopIteration,"No more data.");
5554 class DataArrayAsciiCharTuple
5557 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5558 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5561 std::string __str__() const throw(INTERP_KERNEL::Exception)
5563 return self->repr();
5566 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5568 return self->buildDAAsciiChar(1,self->getNumberOfCompo());