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 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
45 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
46 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
47 virtual void desallocate() throw(INTERP_KERNEL::Exception);
48 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
49 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
50 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
51 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
52 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
53 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
54 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
55 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
56 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
57 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
58 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
59 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
60 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
61 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
62 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
63 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
64 void updateTime() const;
67 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
69 const std::vector<std::string>& comps=self->getInfoOnComponents();
70 PyObject *ret=PyList_New((int)comps.size());
71 for(int i=0;i<(int)comps.size();i++)
72 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
76 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
79 convertPyToNewIntArr3(li,tmp);
80 self->copyPartOfStringInfoFrom(other,tmp);
83 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
86 convertPyToNewIntArr3(li,tmp);
87 self->copyPartOfStringInfoFrom2(tmp,other);
90 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
93 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
97 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
98 if(size!=self->getNumberOfTuples())
100 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
102 self->renumberInPlace(tmp);
106 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
108 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
109 da2->checkAllocated();
110 int size=self->getNumberOfTuples();
111 if(size!=self->getNumberOfTuples())
113 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
115 self->renumberInPlace(da2->getConstPointer());
119 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
122 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
123 if (!SWIG_IsOK(res1))
126 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
127 if(size!=self->getNumberOfTuples())
129 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
131 self->renumberInPlaceR(tmp);
135 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
137 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
138 da2->checkAllocated();
139 int size=self->getNumberOfTuples();
140 if(size!=self->getNumberOfTuples())
142 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
144 self->renumberInPlaceR(da2->getConstPointer());
148 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
149 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
151 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
152 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
153 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
154 DataArrayInt *tuplesSelecPtr2=0;
157 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
159 throw INTERP_KERNEL::Exception(msg);
161 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
164 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
166 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
167 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
170 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
172 std::vector<std::pair<int,int> > ranges;
173 convertPyToVectorPairInt(li,ranges);
174 return self->selectByTupleRanges(ranges);
177 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
180 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
181 if (!SWIG_IsOK(res1))
184 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
185 return self->selectByTupleId(tmp,tmp+size);
189 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
191 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
192 da2->checkAllocated();
193 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
197 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
200 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
201 if (!SWIG_IsOK(res1))
204 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
205 return self->selectByTupleIdSafe(tmp,tmp+size);
209 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
211 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
212 da2->checkAllocated();
213 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
217 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
219 std::vector<int> tmp;
220 convertPyToNewIntArr3(li,tmp);
221 DataArray *ret=self->keepSelectedComponents(tmp);
222 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
225 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
227 if(!PySlice_Check(slic))
228 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
229 Py_ssize_t strt=2,stp=2,step=2;
230 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
231 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
232 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
233 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
234 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 !");
236 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
237 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
240 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
242 if(!PySlice_Check(slic))
243 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
244 Py_ssize_t strt=2,stp=2,step=2;
245 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
246 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
247 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
249 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
250 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
253 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
255 if(!PySlice_Check(slic))
256 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
257 Py_ssize_t strt=2,stp=2,step=2;
258 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
259 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
260 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
261 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
262 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
263 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
266 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
268 if(!PySlice_Check(slic))
269 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
270 Py_ssize_t strt=2,stp=2,step=2;
271 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
272 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
273 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
274 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
275 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
276 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
279 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
281 std::vector<const DataArray *> tmp;
282 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
283 return DataArray::Aggregate(tmp);
286 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
288 if(!PySlice_Check(slic))
289 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
290 Py_ssize_t strt=2,stp=2,step=2;
291 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
292 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
293 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
294 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
297 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
299 if(!PySlice_Check(slic))
300 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
301 Py_ssize_t strt=2,stp=2,step=2;
302 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
303 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
304 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
305 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
311 class DataArrayDoubleIterator;
313 class DataArrayDouble : public DataArray
316 static DataArrayDouble *New();
317 double doubleValue() const throw(INTERP_KERNEL::Exception);
318 bool empty() const throw(INTERP_KERNEL::Exception);
319 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
320 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
321 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
322 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
323 void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
324 double popBackSilent() throw(INTERP_KERNEL::Exception);
325 void pack() const throw(INTERP_KERNEL::Exception);
326 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
327 void fillWithZero() throw(INTERP_KERNEL::Exception);
328 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
329 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
330 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
331 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
332 void reverse() throw(INTERP_KERNEL::Exception);
333 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
334 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
335 std::string repr() const throw(INTERP_KERNEL::Exception);
336 std::string reprZip() const throw(INTERP_KERNEL::Exception);
337 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
338 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
339 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
340 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
341 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
342 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
343 void transpose() throw(INTERP_KERNEL::Exception);
344 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
345 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
346 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
347 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
348 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
349 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
350 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
351 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
352 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
353 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
354 double front() const throw(INTERP_KERNEL::Exception);
355 double back() const throw(INTERP_KERNEL::Exception);
356 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
357 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
358 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
359 double *getPointer() throw(INTERP_KERNEL::Exception);
360 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
361 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
362 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
363 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
364 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
365 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
366 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
367 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
368 double getAverageValue() const throw(INTERP_KERNEL::Exception);
369 double norm2() const throw(INTERP_KERNEL::Exception);
370 double normMax() const throw(INTERP_KERNEL::Exception);
371 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
372 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
373 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
374 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
375 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
376 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
377 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
378 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
379 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
380 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
381 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
382 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
383 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
384 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
385 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
386 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
387 void abs() throw(INTERP_KERNEL::Exception);
388 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
389 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
390 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
391 void applyPow(double val) throw(INTERP_KERNEL::Exception);
392 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
393 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
394 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
395 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
396 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
397 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
398 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
399 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
400 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
401 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
402 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
403 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
404 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
405 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
406 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
407 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
408 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
409 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
410 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
411 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
412 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
413 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
414 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
415 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
416 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
417 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
420 DataArrayDouble() throw(INTERP_KERNEL::Exception)
422 return DataArrayDouble::New();
425 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
427 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)";
428 std::string msg(msgBase);
430 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
433 if(PyList_Check(elt0) || PyTuple_Check(elt0))
437 if(PyInt_Check(nbOfTuples))
439 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
441 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
444 if(PyInt_Check(elt2))
445 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
446 int nbOfCompo=PyInt_AS_LONG(elt2);
448 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
449 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
450 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
451 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
455 throw INTERP_KERNEL::Exception(msg.c_str());
458 {//DataArrayDouble.New([1.,3.,4.],3)
459 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
461 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
462 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
467 throw INTERP_KERNEL::Exception(msg.c_str());
470 {// DataArrayDouble.New([1.,3.,4.])
471 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
472 int tmpp1=-1,tmpp2=-1;
473 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
474 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
478 else if(PyInt_Check(elt0))
480 int nbOfTuples1=PyInt_AS_LONG(elt0);
482 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
487 if(PyInt_Check(nbOfTuples))
488 {//DataArrayDouble.New(5,2)
489 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
491 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
492 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
493 ret->alloc(nbOfTuples1,nbOfCompo);
497 throw INTERP_KERNEL::Exception(msg.c_str());
500 throw INTERP_KERNEL::Exception(msg.c_str());
503 {//DataArrayDouble.New(5)
504 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
505 ret->alloc(nbOfTuples1,1);
510 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
511 {//DataArrayDouble.New(numpyArray)
512 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
516 throw INTERP_KERNEL::Exception(msg.c_str());
519 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
521 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
524 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
527 std::vector<double> bb;
529 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
530 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
531 self->pushBackValsSilent(tmp,tmp+nbTuples);
534 std::string __repr__() const throw(INTERP_KERNEL::Exception)
536 std::ostringstream oss;
537 self->reprQuickOverview(oss);
541 std::string __str__() const throw(INTERP_KERNEL::Exception)
546 double __float__() const throw(INTERP_KERNEL::Exception)
548 return self->doubleValue();
551 int __len__() const throw(INTERP_KERNEL::Exception)
553 if(self->isAllocated())
555 return self->getNumberOfTuples();
559 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
563 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
565 return self->iterator();
568 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
570 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 !";
571 if(PyList_Check(li) || PyTuple_Check(li))
575 if(PyInt_Check(nbOfTuples))
577 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
579 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
582 if(PyInt_Check(nbOfComp))
583 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
584 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
586 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
587 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
588 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
591 throw INTERP_KERNEL::Exception(msg);
594 {//DataArrayDouble.setValues([1.,3.,4.],3)
596 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
597 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
601 throw INTERP_KERNEL::Exception(msg);
604 {// DataArrayDouble.setValues([1.,3.,4.])
605 int tmpp1=-1,tmpp2=-1;
606 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
607 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
611 throw INTERP_KERNEL::Exception(msg);
614 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
616 const double *vals=self->getConstPointer();
617 return convertDblArrToPyList(vals,self->getNbOfElems());
621 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
623 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
627 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
630 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
631 PyObject *ret=PyTuple_New(2);
632 PyObject *ret0Py=ret0?Py_True:Py_False;
634 PyTuple_SetItem(ret,0,ret0Py);
635 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
639 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
641 const double *vals=self->getConstPointer();
642 int nbOfComp=self->getNumberOfComponents();
643 int nbOfTuples=self->getNumberOfTuples();
644 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
647 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
650 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
651 if (!SWIG_IsOK(res1))
654 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
655 if(size!=self->getNumberOfTuples())
657 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
659 return self->renumber(tmp);
663 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
665 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
666 da2->checkAllocated();
667 int size=self->getNumberOfTuples();
668 if(size!=self->getNumberOfTuples())
670 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
672 return self->renumber(da2->getConstPointer());
676 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
679 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
680 if (!SWIG_IsOK(res1))
683 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
684 if(size!=self->getNumberOfTuples())
686 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
688 return self->renumberR(tmp);
692 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
694 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
695 da2->checkAllocated();
696 int size=self->getNumberOfTuples();
697 if(size!=self->getNumberOfTuples())
699 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
701 return self->renumberR(da2->getConstPointer());
705 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) 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 if(size!=self->getNumberOfTuples())
715 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
717 return self->renumberAndReduce(tmp,newNbOfTuple);
721 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
723 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
724 da2->checkAllocated();
725 int size=self->getNumberOfTuples();
726 if(size!=self->getNumberOfTuples())
728 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
730 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
734 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
736 int thisTupleId,otherTupleId;
737 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
738 PyObject *ret=PyTuple_New(3);
739 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
740 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
741 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
745 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
748 double r1=self->getMaxValue(tmp);
749 PyObject *ret=PyTuple_New(2);
750 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
751 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
755 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
758 double r1=self->getMaxValue2(tmp);
759 PyObject *ret=PyTuple_New(2);
760 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
761 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
765 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
768 double r1=self->getMinValue(tmp);
769 PyObject *ret=PyTuple_New(2);
770 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
771 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
775 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
778 double r1=self->getMinValue2(tmp);
779 PyObject *ret=PyTuple_New(2);
780 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
781 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
785 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
787 int nbOfCompo=self->getNumberOfComponents();
788 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
789 self->getMinMaxPerComponent(tmp);
790 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
794 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
796 int sz=self->getNumberOfComponents();
797 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
798 self->accumulate(tmp);
799 return convertDblArrToPyList(tmp,sz);
802 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
805 std::vector<int> val2;
806 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
807 return self->accumulatePerChunck(bg,bg+sz);
810 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
812 DataArrayInt *comm, *commIndex;
813 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
814 PyObject *res = PyList_New(2);
815 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
816 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
820 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
824 DataArrayDoubleTuple *aa;
825 std::vector<double> bb;
827 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
828 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
830 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
831 PyObject *ret=PyTuple_New(2);
832 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
833 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
837 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
839 std::vector<int> tmp;
840 convertPyToNewIntArr3(li,tmp);
841 self->setSelectedComponents(a,tmp);
844 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
846 int sz=self->getNumberOfComponents();
847 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
848 self->getTuple(tupleId,tmp);
849 return convertDblArrToPyList(tmp,sz);
852 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
854 std::vector<const DataArrayDouble *> tmp;
855 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
856 return DataArrayDouble::Aggregate(tmp);
859 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
861 std::vector<const DataArrayDouble *> tmp;
862 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
863 return DataArrayDouble::Meld(tmp);
866 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
870 DataArrayDoubleTuple *aa;
871 std::vector<double> bb;
873 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
874 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
875 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
876 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
877 DataArrayInt *c=0,*cI=0;
878 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
879 PyObject *ret=PyTuple_New(2);
880 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
881 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
885 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
887 DataArrayInt *ret1=0;
888 bool ret0=self->areIncludedInMe(other,prec,ret1);
889 PyObject *ret=PyTuple_New(2);
890 PyObject *ret0Py=ret0?Py_True:Py_False;
892 PyTuple_SetItem(ret,0,ret0Py);
893 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
897 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
899 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
900 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
901 self->checkAllocated();
902 int nbOfTuples=self->getNumberOfTuples();
903 int nbOfComponents=self->getNumberOfComponents();
905 std::vector<int> vt1,vc1;
906 std::pair<int, std::pair<int,int> > pt1,pc1;
907 DataArrayInt *dt1=0,*dc1=0;
909 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
910 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
914 if(nbOfComponents==1)
915 return PyFloat_FromDouble(self->getIJSafe(it1,0));
916 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
918 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
920 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
922 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
924 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
927 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
928 std::vector<int> v2(1,ic1);
929 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
933 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
934 std::vector<int> v2(1,ic1);
935 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
939 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
940 std::vector<int> v2(1,ic1);
941 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
945 ret=self->selectByTupleIdSafe(&it1,&it1+1);
946 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
950 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
951 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
955 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
956 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
960 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
961 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
965 ret=self->selectByTupleIdSafe(&it1,&it1+1);
966 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
967 std::vector<int> v2(nbOfComp);
968 for(int i=0;i<nbOfComp;i++)
969 v2[i]=pc1.first+i*pc1.second.second;
970 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
974 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
975 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
976 std::vector<int> v2(nbOfComp);
977 for(int i=0;i<nbOfComp;i++)
978 v2[i]=pc1.first+i*pc1.second.second;
979 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
983 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
984 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
985 std::vector<int> v2(nbOfComp);
986 for(int i=0;i<nbOfComp;i++)
987 v2[i]=pc1.first+i*pc1.second.second;
988 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
992 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
993 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
994 std::vector<int> v2(nbOfComp);
995 for(int i=0;i<nbOfComp;i++)
996 v2[i]=pc1.first+i*pc1.second.second;
997 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1000 throw INTERP_KERNEL::Exception(msg);
1004 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1006 self->checkAllocated();
1007 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1008 int nbOfTuples=self->getNumberOfTuples();
1009 int nbOfComponents=self->getNumberOfComponents();
1012 std::vector<double> v1;
1013 DataArrayDouble *d1=0;
1014 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1016 std::vector<int> vt1,vc1;
1017 std::pair<int, std::pair<int,int> > pt1,pc1;
1018 DataArrayInt *dt1=0,*dc1=0;
1019 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1020 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1028 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1031 tmp=DataArrayDouble::New();
1032 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1033 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1036 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1039 throw INTERP_KERNEL::Exception(msg);
1048 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1051 tmp=DataArrayDouble::New();
1052 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1053 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1056 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1059 throw INTERP_KERNEL::Exception(msg);
1068 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1071 tmp=DataArrayDouble::New();
1072 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1073 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1076 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1079 throw INTERP_KERNEL::Exception(msg);
1088 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1091 tmp=DataArrayDouble::New();
1092 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1093 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1096 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1099 throw INTERP_KERNEL::Exception(msg);
1108 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1111 tmp=DataArrayDouble::New();
1112 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1113 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1116 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1119 throw INTERP_KERNEL::Exception(msg);
1128 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1131 tmp=DataArrayDouble::New();
1132 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1133 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1136 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1139 throw INTERP_KERNEL::Exception(msg);
1148 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1151 tmp=DataArrayDouble::New();
1152 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1153 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1156 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1159 throw INTERP_KERNEL::Exception(msg);
1168 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1171 tmp=DataArrayDouble::New();
1172 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1173 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1176 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1179 throw INTERP_KERNEL::Exception(msg);
1188 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1191 tmp=DataArrayDouble::New();
1192 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1193 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1196 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1199 throw INTERP_KERNEL::Exception(msg);
1208 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1211 tmp=DataArrayDouble::New();
1212 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1213 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1216 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1219 throw INTERP_KERNEL::Exception(msg);
1228 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1231 tmp=DataArrayDouble::New();
1232 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1233 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1236 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1239 throw INTERP_KERNEL::Exception(msg);
1248 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1251 tmp=DataArrayDouble::New();
1252 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1253 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1256 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1259 throw INTERP_KERNEL::Exception(msg);
1268 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1271 tmp=DataArrayDouble::New();
1272 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1273 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1276 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1279 throw INTERP_KERNEL::Exception(msg);
1288 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1291 tmp=DataArrayDouble::New();
1292 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1293 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1296 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1299 throw INTERP_KERNEL::Exception(msg);
1308 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1311 tmp=DataArrayDouble::New();
1312 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1313 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1316 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1319 throw INTERP_KERNEL::Exception(msg);
1328 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1331 tmp=DataArrayDouble::New();
1332 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1333 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1336 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1339 throw INTERP_KERNEL::Exception(msg);
1344 throw INTERP_KERNEL::Exception(msg);
1349 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1351 return self->negate();
1354 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1356 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1359 DataArrayDoubleTuple *aa;
1360 std::vector<double> bb;
1364 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1366 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1369 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1370 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1372 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1375 throw INTERP_KERNEL::Exception(msg);
1378 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1383 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1384 ret->applyLin(1.,val);
1385 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1389 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1393 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1394 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1398 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1399 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1402 throw INTERP_KERNEL::Exception(msg);
1406 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1408 const char msg[]="Unexpected situation in __radd__ !";
1411 DataArrayDoubleTuple *aa;
1412 std::vector<double> bb;
1414 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1419 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1420 ret->applyLin(1.,val);
1425 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1426 return DataArrayDouble::Add(self,aaa);
1430 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1431 return DataArrayDouble::Add(self,aaa);
1434 throw INTERP_KERNEL::Exception(msg);
1438 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1440 const char msg[]="Unexpected situation in __iadd__ !";
1443 DataArrayDoubleTuple *aa;
1444 std::vector<double> bb;
1446 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1451 self->applyLin(1.,val);
1452 Py_XINCREF(trueSelf);
1458 Py_XINCREF(trueSelf);
1463 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1464 self->addEqual(aaa);
1465 Py_XINCREF(trueSelf);
1470 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1471 self->addEqual(aaa);
1472 Py_XINCREF(trueSelf);
1476 throw INTERP_KERNEL::Exception(msg);
1480 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1482 const char msg[]="Unexpected situation in __sub__ !";
1485 DataArrayDoubleTuple *aa;
1486 std::vector<double> bb;
1490 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1492 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1495 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1496 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1498 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1501 throw INTERP_KERNEL::Exception(msg);
1504 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1509 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1510 ret->applyLin(1.,-val);
1511 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1515 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1519 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1520 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1524 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1525 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1528 throw INTERP_KERNEL::Exception(msg);
1532 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1534 const char msg[]="Unexpected situation in __rsub__ !";
1537 DataArrayDoubleTuple *aa;
1538 std::vector<double> bb;
1540 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1545 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1546 ret->applyLin(-1.,val);
1551 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1552 return DataArrayDouble::Substract(aaa,self);
1556 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1557 return DataArrayDouble::Substract(aaa,self);
1560 throw INTERP_KERNEL::Exception(msg);
1564 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1566 const char msg[]="Unexpected situation in __isub__ !";
1569 DataArrayDoubleTuple *aa;
1570 std::vector<double> bb;
1572 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1577 self->applyLin(1,-val);
1578 Py_XINCREF(trueSelf);
1583 self->substractEqual(a);
1584 Py_XINCREF(trueSelf);
1589 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1590 self->substractEqual(aaa);
1591 Py_XINCREF(trueSelf);
1596 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1597 self->substractEqual(aaa);
1598 Py_XINCREF(trueSelf);
1602 throw INTERP_KERNEL::Exception(msg);
1606 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1608 const char msg[]="Unexpected situation in __mul__ !";
1611 DataArrayDoubleTuple *aa;
1612 std::vector<double> bb;
1616 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1618 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1621 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1622 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1624 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1627 throw INTERP_KERNEL::Exception(msg);
1630 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1635 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1636 ret->applyLin(val,0.);
1637 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1641 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1645 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1646 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1650 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1651 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1654 throw INTERP_KERNEL::Exception(msg);
1658 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1660 const char msg[]="Unexpected situation in __rmul__ !";
1663 DataArrayDoubleTuple *aa;
1664 std::vector<double> bb;
1666 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1671 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1672 ret->applyLin(val,0.);
1677 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1678 return DataArrayDouble::Multiply(self,aaa);
1682 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1683 return DataArrayDouble::Multiply(self,aaa);
1686 throw INTERP_KERNEL::Exception(msg);
1690 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1692 const char msg[]="Unexpected situation in __imul__ !";
1695 DataArrayDoubleTuple *aa;
1696 std::vector<double> bb;
1698 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1703 self->applyLin(val,0.);
1704 Py_XINCREF(trueSelf);
1709 self->multiplyEqual(a);
1710 Py_XINCREF(trueSelf);
1715 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1716 self->multiplyEqual(aaa);
1717 Py_XINCREF(trueSelf);
1722 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1723 self->multiplyEqual(aaa);
1724 Py_XINCREF(trueSelf);
1728 throw INTERP_KERNEL::Exception(msg);
1732 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1734 const char msg[]="Unexpected situation in __div__ !";
1737 DataArrayDoubleTuple *aa;
1738 std::vector<double> bb;
1742 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1744 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1747 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1748 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1750 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1753 throw INTERP_KERNEL::Exception(msg);
1756 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1762 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1763 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1764 ret->applyLin(1/val,0.);
1765 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1769 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1773 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1774 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1778 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1779 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1782 throw INTERP_KERNEL::Exception(msg);
1786 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1788 const char msg[]="Unexpected situation in __rdiv__ !";
1791 DataArrayDoubleTuple *aa;
1792 std::vector<double> bb;
1794 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1799 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1805 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1806 return DataArrayDouble::Divide(aaa,self);
1810 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1811 return DataArrayDouble::Divide(aaa,self);
1814 throw INTERP_KERNEL::Exception(msg);
1818 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1820 const char msg[]="Unexpected situation in __idiv__ !";
1823 DataArrayDoubleTuple *aa;
1824 std::vector<double> bb;
1826 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1832 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1833 self->applyLin(1./val,0.);
1834 Py_XINCREF(trueSelf);
1839 self->divideEqual(a);
1840 Py_XINCREF(trueSelf);
1845 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1846 self->divideEqual(aaa);
1847 Py_XINCREF(trueSelf);
1852 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1853 self->divideEqual(aaa);
1854 Py_XINCREF(trueSelf);
1858 throw INTERP_KERNEL::Exception(msg);
1862 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1864 const char msg[]="Unexpected situation in __pow__ !";
1867 DataArrayDoubleTuple *aa;
1868 std::vector<double> bb;
1870 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1875 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1881 return DataArrayDouble::Pow(self,a);
1885 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1886 return DataArrayDouble::Pow(self,aaa);
1890 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1891 return DataArrayDouble::Pow(self,aaa);
1894 throw INTERP_KERNEL::Exception(msg);
1898 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1900 const char msg[]="Unexpected situation in __rpow__ !";
1903 DataArrayDoubleTuple *aa;
1904 std::vector<double> bb;
1906 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1911 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1912 ret->applyRPow(val);
1917 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1918 return DataArrayDouble::Pow(aaa,self);
1922 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1923 return DataArrayDouble::Pow(aaa,self);
1926 throw INTERP_KERNEL::Exception(msg);
1930 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1932 const char msg[]="Unexpected situation in __ipow__ !";
1935 DataArrayDoubleTuple *aa;
1936 std::vector<double> bb;
1938 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1943 self->applyPow(val);
1944 Py_XINCREF(trueSelf);
1950 Py_XINCREF(trueSelf);
1955 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1956 self->powEqual(aaa);
1957 Py_XINCREF(trueSelf);
1962 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1963 self->powEqual(aaa);
1964 Py_XINCREF(trueSelf);
1968 throw INTERP_KERNEL::Exception(msg);
1972 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1974 DataArrayInt *c=0,*cI=0;
1976 self->computeTupleIdsNearTuples(other,eps,c,cI);
1977 PyObject *ret=PyTuple_New(2);
1978 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1979 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1983 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1985 DataArrayInt *ret1=0;
1986 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1987 PyObject *ret=PyTuple_New(2);
1988 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1989 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1995 class DataArrayDoubleTuple;
1997 class DataArrayDoubleIterator
2000 DataArrayDoubleIterator(DataArrayDouble *da);
2001 ~DataArrayDoubleIterator();
2006 DataArrayDoubleTuple *ret=self->nextt();
2008 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2011 PyErr_SetString(PyExc_StopIteration,"No more data.");
2018 class DataArrayDoubleTuple
2021 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2022 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2025 std::string __str__() const throw(INTERP_KERNEL::Exception)
2027 return self->repr();
2030 double __float__() const throw(INTERP_KERNEL::Exception)
2032 return self->doubleValue();
2035 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2037 return self->buildDADouble(1,self->getNumberOfCompo());
2040 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2042 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2043 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2044 Py_XINCREF(trueSelf);
2048 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2050 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2051 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2052 Py_XINCREF(trueSelf);
2056 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2058 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2059 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2060 Py_XINCREF(trueSelf);
2064 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2066 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2067 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2068 Py_XINCREF(trueSelf);
2072 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2074 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2077 std::vector<int> multiVal;
2078 std::pair<int, std::pair<int,int> > slic;
2079 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2080 const double *pt=self->getConstPointer();
2081 int nbc=self->getNumberOfCompo();
2082 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2089 std::ostringstream oss;
2090 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2091 throw INTERP_KERNEL::Exception(oss.str().c_str());
2094 return PyFloat_FromDouble(pt[singleVal]);
2098 return PyFloat_FromDouble(pt[nbc+singleVal]);
2101 std::ostringstream oss;
2102 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2103 throw INTERP_KERNEL::Exception(oss.str().c_str());
2109 PyObject *t=PyTuple_New(multiVal.size());
2110 for(int j=0;j<(int)multiVal.size();j++)
2112 int cid=multiVal[j];
2115 std::ostringstream oss;
2116 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2117 throw INTERP_KERNEL::Exception(oss.str().c_str());
2119 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2125 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2126 PyObject *t=PyTuple_New(sz);
2127 for(int j=0;j<sz;j++)
2128 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2132 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2136 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2138 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2139 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2142 std::vector<double> multiValV;
2143 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2144 int nbc=self->getNumberOfCompo();
2145 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2147 std::vector<int> multiVal;
2148 std::pair<int, std::pair<int,int> > slic;
2149 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2150 double *pt=self->getPointer();
2151 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2158 std::ostringstream oss;
2159 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2160 throw INTERP_KERNEL::Exception(oss.str().c_str());
2166 pt[singleVal]=singleValV;
2171 if(multiValV.size()!=1)
2173 std::ostringstream oss;
2174 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2175 throw INTERP_KERNEL::Exception(oss.str().c_str());
2177 pt[singleVal]=multiValV[0];
2182 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2186 throw INTERP_KERNEL::Exception(msg);
2195 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2199 std::ostringstream oss;
2200 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2201 throw INTERP_KERNEL::Exception(oss.str().c_str());
2209 if(multiVal.size()!=multiValV.size())
2211 std::ostringstream oss;
2212 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2213 throw INTERP_KERNEL::Exception(oss.str().c_str());
2215 for(int i=0;i<(int)multiVal.size();i++)
2217 int pos=multiVal[i];
2220 std::ostringstream oss;
2221 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2222 throw INTERP_KERNEL::Exception(oss.str().c_str());
2224 pt[multiVal[i]]=multiValV[i];
2230 const double *ptV=daIntTyyppV->getConstPointer();
2231 if(nbc>daIntTyyppV->getNumberOfCompo())
2233 std::ostringstream oss;
2234 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2235 throw INTERP_KERNEL::Exception(oss.str().c_str());
2237 std::copy(ptV,ptV+nbc,pt);
2241 throw INTERP_KERNEL::Exception(msg);
2246 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2251 for(int j=0;j<sz;j++)
2252 pt[slic.first+j*slic.second.second]=singleValV;
2257 if(sz!=(int)multiValV.size())
2259 std::ostringstream oss;
2260 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2261 throw INTERP_KERNEL::Exception(oss.str().c_str());
2263 for(int j=0;j<sz;j++)
2264 pt[slic.first+j*slic.second.second]=multiValV[j];
2269 const double *ptV=daIntTyyppV->getConstPointer();
2270 if(sz>daIntTyyppV->getNumberOfCompo())
2272 std::ostringstream oss;
2273 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2274 throw INTERP_KERNEL::Exception(oss.str().c_str());
2276 for(int j=0;j<sz;j++)
2277 pt[slic.first+j*slic.second.second]=ptV[j];
2281 throw INTERP_KERNEL::Exception(msg);
2285 throw INTERP_KERNEL::Exception(msg);
2291 class DataArrayIntIterator;
2293 class DataArrayInt : public DataArray
2296 static DataArrayInt *New();
2297 int intValue() const throw(INTERP_KERNEL::Exception);
2298 int getHashCode() const throw(INTERP_KERNEL::Exception);
2299 bool empty() const throw(INTERP_KERNEL::Exception);
2300 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2301 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2302 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2303 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2304 int popBackSilent() throw(INTERP_KERNEL::Exception);
2305 void pack() const throw(INTERP_KERNEL::Exception);
2306 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2307 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2308 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2309 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2311 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2312 void reverse() throw(INTERP_KERNEL::Exception);
2313 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2314 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2315 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2316 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2317 void fillWithZero() throw(INTERP_KERNEL::Exception);
2318 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2319 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2320 std::string repr() const throw(INTERP_KERNEL::Exception);
2321 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2323 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2324 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2325 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2326 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2327 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2328 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2329 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2330 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2331 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2332 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2333 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2334 void transpose() throw(INTERP_KERNEL::Exception);
2335 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2336 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2337 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2338 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2339 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2340 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2341 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2342 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2343 int front() const throw(INTERP_KERNEL::Exception);
2344 int back() const throw(INTERP_KERNEL::Exception);
2345 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2346 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2347 int *getPointer() throw(INTERP_KERNEL::Exception);
2348 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2349 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2350 const int *begin() const throw(INTERP_KERNEL::Exception);
2351 const int *end() const throw(INTERP_KERNEL::Exception);
2352 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2353 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2354 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2355 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2356 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2357 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2358 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2359 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2360 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2361 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2362 int count(int value) const throw(INTERP_KERNEL::Exception);
2363 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2364 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2365 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2366 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2367 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2368 void abs() throw(INTERP_KERNEL::Exception);
2369 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2370 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2371 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2373 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2374 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2375 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2376 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2377 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2379 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2380 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2381 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2382 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2383 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2384 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2385 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2386 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2387 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2393 void computeOffsets() throw(INTERP_KERNEL::Exception);
2394 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2395 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2396 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2397 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2398 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2399 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2400 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2401 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2402 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2403 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2404 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2405 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2406 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2407 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2408 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2409 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2410 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2411 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2413 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2416 DataArrayInt() throw(INTERP_KERNEL::Exception)
2418 return DataArrayInt::New();
2421 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2423 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)";
2424 std::string msg(msgBase);
2426 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2429 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2433 if(PyInt_Check(nbOfTuples))
2435 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2437 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2440 if(PyInt_Check(nbOfComp))
2441 {//DataArrayInt.New([1,3,4,5],2,2)
2442 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2444 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2445 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2446 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2447 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2451 throw INTERP_KERNEL::Exception(msg.c_str());
2454 {//DataArrayInt.New([1,3,4],3)
2455 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2457 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2458 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2463 throw INTERP_KERNEL::Exception(msg.c_str());
2466 {// DataArrayInt.New([1,3,4])
2467 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2468 int tmpp1=-1,tmpp2=-1;
2469 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2470 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2474 else if(PyInt_Check(elt0))
2476 int nbOfTuples1=PyInt_AS_LONG(elt0);
2478 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2483 if(PyInt_Check(nbOfTuples))
2484 {//DataArrayInt.New(5,2)
2485 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2487 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2488 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2489 ret->alloc(nbOfTuples1,nbOfCompo);
2493 throw INTERP_KERNEL::Exception(msg.c_str());
2496 throw INTERP_KERNEL::Exception(msg.c_str());
2499 {//DataArrayInt.New(5)
2500 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2501 ret->alloc(nbOfTuples1,1);
2506 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2507 {//DataArrayInt.New(numpyArray)
2508 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2512 throw INTERP_KERNEL::Exception(msg.c_str());
2515 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2517 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2520 std::string __str__() const throw(INTERP_KERNEL::Exception)
2522 return self->repr();
2525 int __len__() const throw(INTERP_KERNEL::Exception)
2527 if(self->isAllocated())
2529 return self->getNumberOfTuples();
2533 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2537 int __int__() const throw(INTERP_KERNEL::Exception)
2539 return self->intValue();
2542 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2544 return self->iterator();
2547 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2549 int sz=self->getNumberOfComponents();
2550 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2551 self->accumulate(tmp);
2552 return convertIntArrToPyList(tmp,sz);
2555 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2558 std::vector<int> val2;
2559 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2560 return self->accumulatePerChunck(bg,bg+sz);
2563 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2565 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2566 PyObject *ret=PyList_New(slcs.size());
2567 for(std::size_t i=0;i<slcs.size();i++)
2568 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2572 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2574 if(!PySlice_Check(slic))
2575 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2576 Py_ssize_t strt=2,stp=2,step=2;
2577 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2578 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2579 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2580 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2581 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
2582 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2585 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2587 int newNbOfTuples=-1;
2588 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2589 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2590 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2591 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2592 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2593 PyObject *ret=PyTuple_New(2);
2594 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2595 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2599 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2601 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 !";
2602 if(PyList_Check(li) || PyTuple_Check(li))
2606 if(PyInt_Check(nbOfTuples))
2608 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2610 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2613 if(PyInt_Check(nbOfComp))
2614 {//DataArrayInt.setValues([1,3,4,5],2,2)
2615 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2617 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2618 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2619 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2622 throw INTERP_KERNEL::Exception(msg);
2625 {//DataArrayInt.setValues([1,3,4],3)
2627 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2628 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2632 throw INTERP_KERNEL::Exception(msg);
2635 {// DataArrayInt.setValues([1,3,4])
2636 int tmpp1=-1,tmpp2=-1;
2637 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2638 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2642 throw INTERP_KERNEL::Exception(msg);
2645 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2647 const int *vals=self->getConstPointer();
2648 return convertIntArrToPyList(vals,self->getNbOfElems());
2652 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2654 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2658 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2661 bool ret0=self->isEqualIfNotWhy(other,ret1);
2662 PyObject *ret=PyTuple_New(2);
2663 PyObject *ret0Py=ret0?Py_True:Py_False;
2665 PyTuple_SetItem(ret,0,ret0Py);
2666 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2670 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2672 const int *vals=self->getConstPointer();
2673 int nbOfComp=self->getNumberOfComponents();
2674 int nbOfTuples=self->getNumberOfTuples();
2675 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2678 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2680 std::vector<const DataArrayInt *> groups;
2681 std::vector< std::vector<int> > fidsOfGroups;
2682 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2683 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2684 PyObject *ret = PyList_New(2);
2685 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2686 int sz=fidsOfGroups.size();
2687 PyObject *ret1 = PyList_New(sz);
2688 for(int i=0;i<sz;i++)
2689 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2690 PyList_SetItem(ret,1,ret1);
2694 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2697 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2698 if (!SWIG_IsOK(res1))
2701 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2702 self->transformWithIndArr(tmp,tmp+size);
2706 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2707 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2711 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2715 std::vector<int> multiVal;
2716 std::pair<int, std::pair<int,int> > slic;
2717 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2718 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2722 return self->getIdsEqualList(&singleVal,&singleVal+1);
2724 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2726 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2728 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2732 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2736 std::vector<int> multiVal;
2737 std::pair<int, std::pair<int,int> > slic;
2738 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2739 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2743 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2745 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2747 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2749 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2753 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2755 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2757 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2758 if (!SWIG_IsOK(res1))
2761 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2762 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2766 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2768 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2769 da2->checkAllocated();
2770 int size=self->getNumberOfTuples();
2771 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2773 PyObject *ret = PyList_New(3);
2774 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2775 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2776 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2780 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2783 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2784 if (!SWIG_IsOK(res1))
2787 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2788 return self->transformWithIndArrR(tmp,tmp+size);
2792 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2793 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2797 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2800 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2801 if (!SWIG_IsOK(res1))
2804 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2805 if(size!=self->getNumberOfTuples())
2807 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2809 return self->renumberAndReduce(tmp,newNbOfTuple);
2813 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2815 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2816 da2->checkAllocated();
2817 int size=self->getNumberOfTuples();
2818 if(size!=self->getNumberOfTuples())
2820 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2822 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2826 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2829 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2830 if (!SWIG_IsOK(res1))
2833 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2834 if(size!=self->getNumberOfTuples())
2836 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2838 return self->renumber(tmp);
2842 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2844 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2845 da2->checkAllocated();
2846 int size=self->getNumberOfTuples();
2847 if(size!=self->getNumberOfTuples())
2849 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2851 return self->renumber(da2->getConstPointer());
2855 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2858 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2859 if (!SWIG_IsOK(res1))
2862 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2863 if(size!=self->getNumberOfTuples())
2865 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2867 return self->renumberR(tmp);
2871 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2873 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2874 da2->checkAllocated();
2875 int size=self->getNumberOfTuples();
2876 if(size!=self->getNumberOfTuples())
2878 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2880 return self->renumberR(da2->getConstPointer());
2884 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2886 std::vector<int> tmp;
2887 convertPyToNewIntArr3(li,tmp);
2888 self->setSelectedComponents(a,tmp);
2891 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2893 int sz=self->getNumberOfComponents();
2894 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2895 self->getTuple(tupleId,tmp);
2896 return convertIntArrToPyList(tmp,sz);
2899 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2901 DataArrayInt *arr=0;
2902 DataArrayInt *arrI=0;
2903 self->changeSurjectiveFormat(targetNb,arr,arrI);
2904 PyObject *res = PyList_New(2);
2905 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2906 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2910 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2912 std::vector<const DataArrayInt *> tmp;
2913 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2914 return DataArrayInt::Meld(tmp);
2917 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2919 std::vector<const DataArrayInt *> tmp;
2920 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2921 return DataArrayInt::Aggregate(tmp);
2924 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2926 std::vector<const DataArrayInt *> tmp;
2927 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2928 return DataArrayInt::AggregateIndexes(tmp);
2931 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2933 std::vector<const DataArrayInt *> tmp;
2934 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2935 return DataArrayInt::BuildUnion(tmp);
2938 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2940 std::vector<const DataArrayInt *> tmp;
2941 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2942 return DataArrayInt::BuildIntersection(tmp);
2945 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2948 int r1=self->getMaxValue(tmp);
2949 PyObject *ret=PyTuple_New(2);
2950 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2951 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2955 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2958 int r1=self->getMinValue(tmp);
2959 PyObject *ret=PyTuple_New(2);
2960 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2961 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2965 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2967 int nbOfCompo=self->getNumberOfComponents();
2972 if(PyInt_Check(obj))
2974 int val=(int)PyInt_AS_LONG(obj);
2975 return self->locateValue(val);
2978 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2982 std::vector<int> arr;
2983 convertPyToNewIntArr3(obj,arr);
2984 return self->locateTuple(arr);
2989 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2991 int nbOfCompo=self->getNumberOfComponents();
2998 if(PyInt_Check(obj))
3000 int val=(int)PyInt_AS_LONG(obj);
3001 return self->presenceOfValue(val);
3004 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3008 std::vector<int> arr;
3009 convertPyToNewIntArr3(obj,arr);
3010 return self->presenceOfTuple(arr);
3015 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3017 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3018 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3019 self->checkAllocated();
3020 int nbOfTuples=self->getNumberOfTuples();
3021 int nbOfComponents=self->getNumberOfComponents();
3023 std::vector<int> vt1,vc1;
3024 std::pair<int, std::pair<int,int> > pt1,pc1;
3025 DataArrayInt *dt1=0,*dc1=0;
3027 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3028 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3033 if(nbOfComponents==1)
3034 return PyInt_FromLong(self->getIJSafe(it1,0));
3035 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3038 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3040 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3042 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3044 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3047 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3048 std::vector<int> v2(1,ic1);
3049 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3053 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3054 std::vector<int> v2(1,ic1);
3055 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3059 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3060 std::vector<int> v2(1,ic1);
3061 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3065 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3066 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3070 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3071 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3075 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3076 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3080 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3081 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3085 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3086 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3087 std::vector<int> v2(nbOfComp);
3088 for(int i=0;i<nbOfComp;i++)
3089 v2[i]=pc1.first+i*pc1.second.second;
3090 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3094 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3095 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3096 std::vector<int> v2(nbOfComp);
3097 for(int i=0;i<nbOfComp;i++)
3098 v2[i]=pc1.first+i*pc1.second.second;
3099 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3103 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3104 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3105 std::vector<int> v2(nbOfComp);
3106 for(int i=0;i<nbOfComp;i++)
3107 v2[i]=pc1.first+i*pc1.second.second;
3108 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3112 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3113 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3114 std::vector<int> v2(nbOfComp);
3115 for(int i=0;i<nbOfComp;i++)
3116 v2[i]=pc1.first+i*pc1.second.second;
3117 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3120 throw INTERP_KERNEL::Exception(msg);
3124 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3126 self->checkAllocated();
3127 const char msg[]="Unexpected situation in __setitem__ !";
3128 int nbOfTuples=self->getNumberOfTuples();
3129 int nbOfComponents=self->getNumberOfComponents();
3132 std::vector<int> v1;
3134 DataArrayIntTuple *dd1=0;
3135 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3137 std::vector<int> vt1,vc1;
3138 std::pair<int, std::pair<int,int> > pt1,pc1;
3139 DataArrayInt *dt1=0,*dc1=0;
3140 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3141 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3149 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3152 tmp=DataArrayInt::New();
3153 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3154 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3157 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3160 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3161 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3164 throw INTERP_KERNEL::Exception(msg);
3173 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3176 tmp=DataArrayInt::New();
3177 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3178 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3181 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3184 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3185 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3188 throw INTERP_KERNEL::Exception(msg);
3197 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3200 tmp=DataArrayInt::New();
3201 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3202 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3205 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3208 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3209 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3212 throw INTERP_KERNEL::Exception(msg);
3221 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3224 tmp=DataArrayInt::New();
3225 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3226 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3229 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3232 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3233 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3236 throw INTERP_KERNEL::Exception(msg);
3245 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3248 tmp=DataArrayInt::New();
3249 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3250 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3253 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3256 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3257 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3260 throw INTERP_KERNEL::Exception(msg);
3269 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3272 tmp=DataArrayInt::New();
3273 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3274 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3277 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3280 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3281 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3284 throw INTERP_KERNEL::Exception(msg);
3293 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3296 tmp=DataArrayInt::New();
3297 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3298 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3301 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3304 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3305 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3308 throw INTERP_KERNEL::Exception(msg);
3317 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3320 tmp=DataArrayInt::New();
3321 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3322 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3325 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3328 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3329 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3332 throw INTERP_KERNEL::Exception(msg);
3341 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3344 tmp=DataArrayInt::New();
3345 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3346 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3349 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3352 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3353 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3356 throw INTERP_KERNEL::Exception(msg);
3365 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3368 tmp=DataArrayInt::New();
3369 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3370 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3373 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3376 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3377 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3380 throw INTERP_KERNEL::Exception(msg);
3389 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3392 tmp=DataArrayInt::New();
3393 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3394 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3397 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3400 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3401 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3404 throw INTERP_KERNEL::Exception(msg);
3413 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3416 tmp=DataArrayInt::New();
3417 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3418 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3421 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3424 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3425 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3428 throw INTERP_KERNEL::Exception(msg);
3437 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3440 tmp=DataArrayInt::New();
3441 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3442 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3445 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3448 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3449 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3452 throw INTERP_KERNEL::Exception(msg);
3461 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3464 tmp=DataArrayInt::New();
3465 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3466 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3469 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3472 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3473 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3476 throw INTERP_KERNEL::Exception(msg);
3485 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3488 tmp=DataArrayInt::New();
3489 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3490 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3493 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3496 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3497 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3500 throw INTERP_KERNEL::Exception(msg);
3509 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3512 tmp=DataArrayInt::New();
3513 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3514 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3517 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3520 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3521 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3524 throw INTERP_KERNEL::Exception(msg);
3529 throw INTERP_KERNEL::Exception(msg);
3534 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3536 return self->negate();
3539 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3541 const char msg[]="Unexpected situation in __add__ !";
3544 std::vector<int> aa;
3545 DataArrayIntTuple *aaa;
3547 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3552 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3553 ret->applyLin(1,val);
3558 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3559 return DataArrayInt::Add(self,aaaa);
3563 return DataArrayInt::Add(self,a);
3567 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3568 return DataArrayInt::Add(self,aaaa);
3571 throw INTERP_KERNEL::Exception(msg);
3575 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3577 const char msg[]="Unexpected situation in __radd__ !";
3580 std::vector<int> aa;
3581 DataArrayIntTuple *aaa;
3583 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3588 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3589 ret->applyLin(1,val);
3594 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3595 return DataArrayInt::Add(self,aaaa);
3599 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3600 return DataArrayInt::Add(self,aaaa);
3603 throw INTERP_KERNEL::Exception(msg);
3607 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3609 const char msg[]="Unexpected situation in __iadd__ !";
3612 std::vector<int> aa;
3613 DataArrayIntTuple *aaa;
3615 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3620 self->applyLin(1,val);
3621 Py_XINCREF(trueSelf);
3626 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3628 Py_XINCREF(trueSelf);
3634 Py_XINCREF(trueSelf);
3639 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3640 self->addEqual(aaaa);
3641 Py_XINCREF(trueSelf);
3645 throw INTERP_KERNEL::Exception(msg);
3649 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3651 const char msg[]="Unexpected situation in __sub__ !";
3654 std::vector<int> aa;
3655 DataArrayIntTuple *aaa;
3657 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3662 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3663 ret->applyLin(1,-val);
3668 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3669 return DataArrayInt::Substract(self,aaaa);
3673 return DataArrayInt::Substract(self,a);
3677 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3678 return DataArrayInt::Substract(self,aaaa);
3681 throw INTERP_KERNEL::Exception(msg);
3685 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3687 const char msg[]="Unexpected situation in __rsub__ !";
3690 std::vector<int> aa;
3691 DataArrayIntTuple *aaa;
3693 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3698 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3699 ret->applyLin(-1,val);
3704 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3705 return DataArrayInt::Substract(aaaa,self);
3709 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3710 return DataArrayInt::Substract(aaaa,self);
3713 throw INTERP_KERNEL::Exception(msg);
3717 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3719 const char msg[]="Unexpected situation in __isub__ !";
3722 std::vector<int> aa;
3723 DataArrayIntTuple *aaa;
3725 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3730 self->applyLin(1,-val);
3731 Py_XINCREF(trueSelf);
3736 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3737 self->substractEqual(bb);
3738 Py_XINCREF(trueSelf);
3743 self->substractEqual(a);
3744 Py_XINCREF(trueSelf);
3749 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3750 self->substractEqual(aaaa);
3751 Py_XINCREF(trueSelf);
3755 throw INTERP_KERNEL::Exception(msg);
3759 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3761 const char msg[]="Unexpected situation in __mul__ !";
3764 std::vector<int> aa;
3765 DataArrayIntTuple *aaa;
3767 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3772 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3773 ret->applyLin(val,0);
3778 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3779 return DataArrayInt::Multiply(self,aaaa);
3783 return DataArrayInt::Multiply(self,a);
3787 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3788 return DataArrayInt::Multiply(self,aaaa);
3791 throw INTERP_KERNEL::Exception(msg);
3795 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3797 const char msg[]="Unexpected situation in __rmul__ !";
3800 std::vector<int> aa;
3801 DataArrayIntTuple *aaa;
3803 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3808 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3809 ret->applyLin(val,0);
3814 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3815 return DataArrayInt::Multiply(self,aaaa);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3820 return DataArrayInt::Multiply(self,aaaa);
3823 throw INTERP_KERNEL::Exception(msg);
3827 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3829 const char msg[]="Unexpected situation in __imul__ !";
3832 std::vector<int> aa;
3833 DataArrayIntTuple *aaa;
3835 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3840 self->applyLin(val,0);
3841 Py_XINCREF(trueSelf);
3846 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3847 self->multiplyEqual(bb);
3848 Py_XINCREF(trueSelf);
3853 self->multiplyEqual(a);
3854 Py_XINCREF(trueSelf);
3859 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3860 self->multiplyEqual(aaaa);
3861 Py_XINCREF(trueSelf);
3865 throw INTERP_KERNEL::Exception(msg);
3869 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3871 const char msg[]="Unexpected situation in __div__ !";
3874 std::vector<int> aa;
3875 DataArrayIntTuple *aaa;
3877 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3882 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3883 ret->applyDivideBy(val);
3888 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3889 return DataArrayInt::Divide(self,aaaa);
3893 return DataArrayInt::Divide(self,a);
3897 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3898 return DataArrayInt::Divide(self,aaaa);
3901 throw INTERP_KERNEL::Exception(msg);
3905 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3907 const char msg[]="Unexpected situation in __rdiv__ !";
3910 std::vector<int> aa;
3911 DataArrayIntTuple *aaa;
3913 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3918 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3924 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3925 return DataArrayInt::Divide(aaaa,self);
3929 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3930 return DataArrayInt::Divide(aaaa,self);
3933 throw INTERP_KERNEL::Exception(msg);
3937 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3939 const char msg[]="Unexpected situation in __idiv__ !";
3942 std::vector<int> aa;
3943 DataArrayIntTuple *aaa;
3945 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3950 self->applyDivideBy(val);
3951 Py_XINCREF(trueSelf);
3956 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3957 self->divideEqual(bb);
3958 Py_XINCREF(trueSelf);
3963 self->divideEqual(a);
3964 Py_XINCREF(trueSelf);
3969 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3970 self->divideEqual(aaaa);
3971 Py_XINCREF(trueSelf);
3975 throw INTERP_KERNEL::Exception(msg);
3979 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3981 const char msg[]="Unexpected situation in __mod__ !";
3984 std::vector<int> aa;
3985 DataArrayIntTuple *aaa;
3987 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3992 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3993 ret->applyModulus(val);
3998 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3999 return DataArrayInt::Modulus(self,aaaa);
4003 return DataArrayInt::Modulus(self,a);
4007 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4008 return DataArrayInt::Modulus(self,aaaa);
4011 throw INTERP_KERNEL::Exception(msg);
4015 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4017 const char msg[]="Unexpected situation in __rmod__ !";
4020 std::vector<int> aa;
4021 DataArrayIntTuple *aaa;
4023 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4028 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4029 ret->applyRModulus(val);
4034 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4035 return DataArrayInt::Modulus(aaaa,self);
4039 return DataArrayInt::Modulus(a,self);
4043 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4044 return DataArrayInt::Modulus(aaaa,self);
4047 throw INTERP_KERNEL::Exception(msg);
4051 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4053 const char msg[]="Unexpected situation in __imod__ !";
4056 std::vector<int> aa;
4057 DataArrayIntTuple *aaa;
4059 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4064 self->applyModulus(val);
4065 Py_XINCREF(trueSelf);
4070 self->modulusEqual(a);
4071 Py_XINCREF(trueSelf);
4076 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4077 self->modulusEqual(aaaa);
4078 Py_XINCREF(trueSelf);
4082 throw INTERP_KERNEL::Exception(msg);
4086 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4088 const char msg[]="Unexpected situation in __pow__ !";
4091 std::vector<int> aa;
4092 DataArrayIntTuple *aaa;
4094 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4099 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4105 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4106 return DataArrayInt::Pow(self,aaaa);
4110 return DataArrayInt::Pow(self,a);
4114 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4115 return DataArrayInt::Pow(self,aaaa);
4118 throw INTERP_KERNEL::Exception(msg);
4122 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4124 const char msg[]="Unexpected situation in __rpow__ !";
4127 std::vector<int> aa;
4128 DataArrayIntTuple *aaa;
4130 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4135 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4136 ret->applyRPow(val);
4141 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4142 return DataArrayInt::Pow(aaaa,self);
4146 return DataArrayInt::Pow(a,self);
4150 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4151 return DataArrayInt::Pow(aaaa,self);
4154 throw INTERP_KERNEL::Exception(msg);
4158 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4160 const char msg[]="Unexpected situation in __ipow__ !";
4163 std::vector<int> aa;
4164 DataArrayIntTuple *aaa;
4166 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4171 self->applyPow(val);
4172 Py_XINCREF(trueSelf);
4178 Py_XINCREF(trueSelf);
4183 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4184 self->powEqual(aaaa);
4185 Py_XINCREF(trueSelf);
4189 throw INTERP_KERNEL::Exception(msg);
4193 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4195 std::ostringstream oss;
4196 self->reprQuickOverview(oss);
4200 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4202 int szArr,sw,iTypppArr;
4203 std::vector<int> stdvecTyyppArr;
4204 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4205 self->pushBackValsSilent(tmp,tmp+szArr);
4208 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4210 std::vector<int> ret1;
4211 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4212 std::size_t sz=ret0.size();
4213 PyObject *pyRet=PyTuple_New(2);
4214 PyObject *pyRet0=PyList_New((int)sz);
4215 PyObject *pyRet1=PyList_New((int)sz);
4216 for(std::size_t i=0;i<sz;i++)
4218 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4219 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4221 PyTuple_SetItem(pyRet,0,pyRet0);
4222 PyTuple_SetItem(pyRet,1,pyRet1);
4226 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4228 DataArrayInt *ret0=0,*ret1=0;
4229 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4230 PyObject *pyRet=PyTuple_New(2);
4231 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4232 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4238 class DataArrayIntTuple;
4240 class DataArrayIntIterator
4243 DataArrayIntIterator(DataArrayInt *da);
4244 ~DataArrayIntIterator();
4249 DataArrayIntTuple *ret=self->nextt();
4251 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4254 PyErr_SetString(PyExc_StopIteration,"No more data.");
4261 class DataArrayIntTuple
4264 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4265 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4268 std::string __str__() const throw(INTERP_KERNEL::Exception)
4270 return self->repr();
4273 int __int__() const throw(INTERP_KERNEL::Exception)
4275 return self->intValue();
4278 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4280 return self->buildDAInt(1,self->getNumberOfCompo());
4283 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4285 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4286 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4287 Py_XINCREF(trueSelf);
4291 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4293 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4294 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4295 Py_XINCREF(trueSelf);
4299 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4301 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4302 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4303 Py_XINCREF(trueSelf);
4307 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4309 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4310 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4311 Py_XINCREF(trueSelf);
4315 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4317 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4318 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4319 Py_XINCREF(trueSelf);
4323 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4325 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4328 std::vector<int> multiVal;
4329 std::pair<int, std::pair<int,int> > slic;
4330 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4331 const int *pt=self->getConstPointer();
4332 int nbc=self->getNumberOfCompo();
4333 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4340 std::ostringstream oss;
4341 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4342 throw INTERP_KERNEL::Exception(oss.str().c_str());
4345 return PyInt_FromLong(pt[singleVal]);
4349 return PyInt_FromLong(pt[nbc+singleVal]);
4352 std::ostringstream oss;
4353 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4354 throw INTERP_KERNEL::Exception(oss.str().c_str());
4360 PyObject *t=PyTuple_New(multiVal.size());
4361 for(int j=0;j<(int)multiVal.size();j++)
4363 int cid=multiVal[j];
4366 std::ostringstream oss;
4367 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4368 throw INTERP_KERNEL::Exception(oss.str().c_str());
4370 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4376 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4377 PyObject *t=PyTuple_New(sz);
4378 for(int j=0;j<sz;j++)
4379 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4383 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4387 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4389 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4390 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4393 std::vector<int> multiValV;
4394 std::pair<int, std::pair<int,int> > slicV;
4395 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4396 int nbc=self->getNumberOfCompo();
4397 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4399 std::vector<int> multiVal;
4400 std::pair<int, std::pair<int,int> > slic;
4401 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4402 int *pt=self->getPointer();
4403 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4410 std::ostringstream oss;
4411 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4412 throw INTERP_KERNEL::Exception(oss.str().c_str());
4418 pt[singleVal]=singleValV;
4423 if(multiValV.size()!=1)
4425 std::ostringstream oss;
4426 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4427 throw INTERP_KERNEL::Exception(oss.str().c_str());
4429 pt[singleVal]=multiValV[0];
4434 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4438 throw INTERP_KERNEL::Exception(msg);
4447 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4451 std::ostringstream oss;
4452 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4453 throw INTERP_KERNEL::Exception(oss.str().c_str());
4461 if(multiVal.size()!=multiValV.size())
4463 std::ostringstream oss;
4464 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4465 throw INTERP_KERNEL::Exception(oss.str().c_str());
4467 for(int i=0;i<(int)multiVal.size();i++)
4469 int pos=multiVal[i];
4472 std::ostringstream oss;
4473 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4474 throw INTERP_KERNEL::Exception(oss.str().c_str());
4476 pt[multiVal[i]]=multiValV[i];
4482 const int *ptV=daIntTyyppV->getConstPointer();
4483 if(nbc>daIntTyyppV->getNumberOfCompo())
4485 std::ostringstream oss;
4486 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4487 throw INTERP_KERNEL::Exception(oss.str().c_str());
4489 std::copy(ptV,ptV+nbc,pt);
4493 throw INTERP_KERNEL::Exception(msg);
4498 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4503 for(int j=0;j<sz;j++)
4504 pt[slic.first+j*slic.second.second]=singleValV;
4509 if(sz!=(int)multiValV.size())
4511 std::ostringstream oss;
4512 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4513 throw INTERP_KERNEL::Exception(oss.str().c_str());
4515 for(int j=0;j<sz;j++)
4516 pt[slic.first+j*slic.second.second]=multiValV[j];
4521 const int *ptV=daIntTyyppV->getConstPointer();
4522 if(sz>daIntTyyppV->getNumberOfCompo())
4524 std::ostringstream oss;
4525 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4526 throw INTERP_KERNEL::Exception(oss.str().c_str());
4528 for(int j=0;j<sz;j++)
4529 pt[slic.first+j*slic.second.second]=ptV[j];
4533 throw INTERP_KERNEL::Exception(msg);
4537 throw INTERP_KERNEL::Exception(msg);
4543 class DataArrayChar : public DataArray
4546 virtual DataArrayChar *buildEmptySpecializedDAChar() 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 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4564 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4565 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4566 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4567 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4568 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4569 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4570 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4571 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4572 char front() const throw(INTERP_KERNEL::Exception);
4573 char back() const throw(INTERP_KERNEL::Exception);
4574 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4575 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4576 char *getPointer() throw(INTERP_KERNEL::Exception);
4577 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4578 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4579 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4580 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4581 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4582 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4583 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4584 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4585 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4586 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4587 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4590 int __len__() const throw(INTERP_KERNEL::Exception)
4592 if(self->isAllocated())
4594 return self->getNumberOfTuples();
4598 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4602 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4605 bool ret0=self->isEqualIfNotWhy(other,ret1);
4606 PyObject *ret=PyTuple_New(2);
4607 PyObject *ret0Py=ret0?Py_True:Py_False;
4609 PyTuple_SetItem(ret,0,ret0Py);
4610 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4614 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4617 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4618 if (!SWIG_IsOK(res1))
4621 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4622 if(size!=self->getNumberOfTuples())
4624 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4626 return self->renumber(tmp);
4630 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4632 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4633 da2->checkAllocated();
4634 int size=self->getNumberOfTuples();
4635 if(size!=self->getNumberOfTuples())
4637 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4639 return self->renumber(da2->getConstPointer());
4643 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4646 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4647 if (!SWIG_IsOK(res1))
4650 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4651 if(size!=self->getNumberOfTuples())
4653 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4655 return self->renumberR(tmp);
4659 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4661 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4662 da2->checkAllocated();
4663 int size=self->getNumberOfTuples();
4664 if(size!=self->getNumberOfTuples())
4666 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4668 return self->renumberR(da2->getConstPointer());
4672 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4675 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4676 if (!SWIG_IsOK(res1))
4679 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4680 if(size!=self->getNumberOfTuples())
4682 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4684 return self->renumberAndReduce(tmp,newNbOfTuple);
4688 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4690 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4691 da2->checkAllocated();
4692 int size=self->getNumberOfTuples();
4693 if(size!=self->getNumberOfTuples())
4695 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4697 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4701 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4703 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4704 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4705 return DataArrayChar::Aggregate(tmp);
4708 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4710 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4711 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4712 return DataArrayChar::Meld(tmp);
4717 class DataArrayByteIterator;
4719 class DataArrayByte : public DataArrayChar
4722 static DataArrayByte *New();
4723 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4724 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4725 char byteValue() const throw(INTERP_KERNEL::Exception);
4728 DataArrayByte() throw(INTERP_KERNEL::Exception)
4730 return DataArrayByte::New();
4733 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4735 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) !";
4736 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4740 if(PyInt_Check(nbOfTuples))
4742 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4744 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4747 if(PyInt_Check(nbOfComp))
4748 {//DataArrayByte.New([1,3,4,5],2,2)
4749 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4751 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4752 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4753 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4754 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4758 throw INTERP_KERNEL::Exception(msg);
4761 {//DataArrayByte.New([1,3,4],3)
4762 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4764 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4765 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4770 throw INTERP_KERNEL::Exception(msg);
4773 {// DataArrayByte.New([1,3,4])
4774 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4775 int tmpp1=-1,tmpp2=-1;
4776 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4777 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4781 else if(PyInt_Check(elt0))
4783 int nbOfTuples1=PyInt_AS_LONG(elt0);
4785 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4790 if(PyInt_Check(nbOfTuples))
4791 {//DataArrayByte.New(5,2)
4792 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4794 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4795 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4796 ret->alloc(nbOfTuples1,nbOfCompo);
4800 throw INTERP_KERNEL::Exception(msg);
4803 throw INTERP_KERNEL::Exception(msg);
4806 {//DataArrayByte.New(5)
4807 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4808 ret->alloc(nbOfTuples1,1);
4813 throw INTERP_KERNEL::Exception(msg);
4816 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4818 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4821 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4823 std::ostringstream oss;
4824 self->reprQuickOverview(oss);
4828 int __int__() const throw(INTERP_KERNEL::Exception)
4830 return (int) self->byteValue();
4833 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4835 return self->iterator();
4838 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4840 return (int)self->getIJ(tupleId,compoId);
4843 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4845 return (int)self->getIJSafe(tupleId,compoId);
4848 std::string __str__() const throw(INTERP_KERNEL::Exception)
4850 return self->repr();
4853 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4855 const char *vals=self->getConstPointer();
4856 int nbOfComp=self->getNumberOfComponents();
4857 int nbOfTuples=self->getNumberOfTuples();
4858 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4861 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4864 int ival=-1; std::vector<int> ivval;
4865 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4866 std::vector<char> vals(sz);
4867 std::copy(pt,pt+sz,vals.begin());
4868 return self->presenceOfTuple(vals);
4871 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4874 int ival=-1; std::vector<int> ivval;
4875 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4876 std::vector<char> vals2(sz);
4877 std::copy(pt,pt+sz,vals2.begin());
4878 return self->presenceOfValue(vals2);
4881 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4884 int ival=-1; std::vector<int> ivval;
4885 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4886 std::vector<char> vals2(sz);
4887 std::copy(pt,pt+sz,vals2.begin());
4888 return self->locateValue(vals2);
4891 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4894 int ival=-1; std::vector<int> ivval;
4895 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4896 std::vector<char> vals(sz);
4897 std::copy(pt,pt+sz,vals.begin());
4898 return self->locateTuple(vals);
4901 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4904 int ival=-1; std::vector<int> ivval;
4905 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4906 std::vector<char> vals(sz);
4907 std::copy(pt,pt+sz,vals.begin());
4908 return self->search(vals);
4911 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4913 int sz=self->getNumberOfComponents();
4914 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4915 self->getTuple(tupleId,tmp);
4916 PyObject *ret=PyTuple_New(sz);
4917 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4921 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4924 int r1=(int)self->getMaxValue(tmp);
4925 PyObject *ret=PyTuple_New(2);
4926 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4927 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4931 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4934 int r1=(int)self->getMinValue(tmp);
4935 PyObject *ret=PyTuple_New(2);
4936 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4937 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4941 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4943 int nbOfCompo=self->getNumberOfComponents();
4948 if(PyInt_Check(obj))
4950 int val=(int)PyInt_AS_LONG(obj);
4951 return self->locateValue(val);
4954 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4957 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4961 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4963 int nbOfCompo=self->getNumberOfComponents();
4970 if(PyInt_Check(obj))
4972 int val=(int)PyInt_AS_LONG(obj);
4973 return self->presenceOfValue(val);
4976 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
4979 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
4985 class DataArrayByteTuple;
4987 class DataArrayByteIterator
4990 DataArrayByteIterator(DataArrayByte *da);
4991 ~DataArrayByteIterator();
4994 class DataArrayByteTuple
4997 std::string repr() const throw(INTERP_KERNEL::Exception);
4998 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5001 std::string __str__() const throw(INTERP_KERNEL::Exception)
5003 return self->repr();
5006 char __int__() const throw(INTERP_KERNEL::Exception)
5008 return self->byteValue();
5011 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5013 return self->buildDAByte(1,self->getNumberOfCompo());
5018 class DataArrayAsciiCharIterator;
5020 class DataArrayAsciiChar : public DataArrayChar
5023 static DataArrayAsciiChar *New();
5024 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5025 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5026 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5029 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5031 return DataArrayAsciiChar::New();
5034 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5036 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) !";
5037 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5041 if(PyInt_Check(nbOfTuples))
5043 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5045 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5048 if(PyInt_Check(nbOfComp))
5049 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5050 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5052 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5053 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5054 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5055 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5059 throw INTERP_KERNEL::Exception(msg);
5062 {//DataArrayAsciiChar.New([1,3,4],3)
5063 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5065 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5066 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5070 else if(PyString_Check(nbOfTuples))
5072 if(PyString_Size(nbOfTuples)!=1)
5073 throw INTERP_KERNEL::Exception(msg);
5074 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5075 std::vector<std::string> tmp;
5076 if(fillStringVector(elt0,tmp))
5077 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5079 throw INTERP_KERNEL::Exception(msg);
5082 throw INTERP_KERNEL::Exception(msg);
5086 std::vector<std::string> tmmp;
5087 if(fillStringVector(elt0,tmmp))
5088 //DataArrayAsciiChar.New(["abc","de","fghi"])
5089 return DataArrayAsciiChar::New(tmmp,' ');
5092 // DataArrayAsciiChar.New([1,3,4])
5093 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5094 int tmpp1=-1,tmpp2=-1;
5095 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5096 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5101 else if(PyInt_Check(elt0))
5103 int nbOfTuples1=PyInt_AS_LONG(elt0);
5105 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5110 if(PyInt_Check(nbOfTuples))
5111 {//DataArrayAsciiChar.New(5,2)
5112 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5114 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5115 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5116 ret->alloc(nbOfTuples1,nbOfCompo);
5120 throw INTERP_KERNEL::Exception(msg);
5123 throw INTERP_KERNEL::Exception(msg);
5126 {//DataArrayAsciiChar.New(5)
5127 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5128 ret->alloc(nbOfTuples1,1);
5133 throw INTERP_KERNEL::Exception(msg);
5136 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5138 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5141 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5143 std::ostringstream oss;
5144 self->reprQuickOverview(oss);
5148 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5150 return self->iterator();
5153 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5155 char tmp[2]; tmp[1]='\0';
5156 tmp[0]=self->getIJ(tupleId,compoId);
5157 return std::string(tmp);
5160 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5162 char tmp[2]; tmp[1]='\0';
5163 tmp[0]=self->getIJSafe(tupleId,compoId);
5164 return std::string(tmp);
5167 std::string __str__() const throw(INTERP_KERNEL::Exception)
5169 return self->repr();
5172 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5174 const char *vals=self->getConstPointer();
5175 int nbOfComp=self->getNumberOfComponents();
5176 int nbOfTuples=self->getNumberOfTuples();
5177 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5180 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5182 if(PyString_Check(tupl))
5184 Py_ssize_t sz=PyString_Size(tupl);
5185 std::vector<char> vals(sz);
5186 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5187 return self->presenceOfTuple(vals);
5190 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5193 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5195 if(PyString_Check(vals))
5197 Py_ssize_t sz=PyString_Size(vals);
5198 std::vector<char> vals2(sz);
5199 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5200 return self->presenceOfValue(vals2);
5203 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5206 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5208 if(PyString_Check(vals))
5210 Py_ssize_t sz=PyString_Size(vals);
5211 std::vector<char> vals2(sz);
5212 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5213 return self->locateValue(vals2);
5216 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5219 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5221 if(PyString_Check(tupl))
5223 Py_ssize_t sz=PyString_Size(tupl);
5224 std::vector<char> vals(sz);
5225 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5226 return self->locateTuple(vals);
5229 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5232 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5234 if(PyString_Check(strOrListOfInt))
5236 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5237 std::vector<char> vals(sz);
5238 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5239 return self->search(vals);
5242 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5245 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5247 int sz=self->getNumberOfComponents();
5248 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5249 self->getTuple(tupleId,tmp);
5250 return PyString_FromString(tmp);
5253 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5256 char tmp2[2]; tmp2[1]='\0';
5257 tmp2[0]=self->getMaxValue(tmp);
5258 PyObject *ret=PyTuple_New(2);
5259 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5260 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5264 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5267 char tmp2[2]; tmp2[1]='\0';
5268 tmp2[0]=self->getMinValue(tmp);
5269 PyObject *ret=PyTuple_New(2);
5270 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5271 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5275 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5277 int nbOfCompo=self->getNumberOfComponents();
5282 if(PyString_Check(obj))
5284 Py_ssize_t sz=PyString_Size(obj);
5285 char *pt=PyString_AsString(obj);
5287 return self->locateValue(pt[0]);
5289 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5292 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5295 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5299 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5301 int nbOfCompo=self->getNumberOfComponents();
5308 if(PyString_Check(obj))
5310 Py_ssize_t sz=PyString_Size(obj);
5311 char *pt=PyString_AsString(obj);
5313 return self->presenceOfValue(pt[0]);
5315 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5318 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5321 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5325 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5328 std::vector<int> stdvecTyyppArr;
5329 std::pair<int, std::pair<int,int> > sTyyppArr;
5330 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5331 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5335 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5337 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5339 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5341 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5343 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5347 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5349 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.";
5351 std::vector<int> stdvecTyyppArr;
5352 std::pair<int, std::pair<int,int> > sTyyppArr;
5353 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5354 int nbOfCompo=self->getNumberOfComponents();
5355 int nbOfTuples=self->getNumberOfTuples();
5356 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5358 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5359 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5368 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5374 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5375 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5378 //value vector<string>
5381 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5382 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5385 //value DataArrayChar
5388 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5392 throw INTERP_KERNEL::Exception(msg);
5396 {//obj list-tuple[int]
5402 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5408 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5409 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5412 //value vector<string>
5415 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5416 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5419 //value DataArrayChar
5422 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5426 throw INTERP_KERNEL::Exception(msg);
5437 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5443 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5444 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5447 //value vector<string>
5450 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5451 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5454 //value DataArrayChar
5457 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5461 throw INTERP_KERNEL::Exception(msg);
5472 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5478 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5479 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5482 //value vector<string>
5485 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5486 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5489 //value DataArrayChar
5492 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5496 throw INTERP_KERNEL::Exception(msg);
5501 throw INTERP_KERNEL::Exception(msg);
5507 class DataArrayAsciiCharTuple;
5509 class DataArrayAsciiCharIterator
5512 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5513 ~DataArrayAsciiCharIterator();
5518 DataArrayAsciiCharTuple *ret=self->nextt();
5520 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5523 PyErr_SetString(PyExc_StopIteration,"No more data.");
5530 class DataArrayAsciiCharTuple
5533 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5534 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5537 std::string __str__() const throw(INTERP_KERNEL::Exception)
5539 return self->repr();
5542 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5544 return self->buildDAAsciiChar(1,self->getNumberOfCompo());