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 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
52 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
53 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
54 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
55 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
56 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
57 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
58 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
59 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
60 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
61 void updateTime() const;
64 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
66 const std::vector<std::string>& comps=self->getInfoOnComponents();
67 PyObject *ret=PyList_New((int)comps.size());
68 for(int i=0;i<(int)comps.size();i++)
69 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
73 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
76 convertPyToNewIntArr3(li,tmp);
77 self->copyPartOfStringInfoFrom(other,tmp);
80 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
83 convertPyToNewIntArr3(li,tmp);
84 self->copyPartOfStringInfoFrom2(tmp,other);
87 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
90 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
94 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
95 if(size!=self->getNumberOfTuples())
97 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
99 self->renumberInPlace(tmp);
103 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
105 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
106 da2->checkAllocated();
107 int size=self->getNumberOfTuples();
108 if(size!=self->getNumberOfTuples())
110 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
112 self->renumberInPlace(da2->getConstPointer());
116 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
119 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
120 if (!SWIG_IsOK(res1))
123 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
124 if(size!=self->getNumberOfTuples())
126 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
128 self->renumberInPlaceR(tmp);
132 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
134 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
135 da2->checkAllocated();
136 int size=self->getNumberOfTuples();
137 if(size!=self->getNumberOfTuples())
139 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
141 self->renumberInPlaceR(da2->getConstPointer());
145 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
146 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
148 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
149 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
150 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
151 DataArrayInt *tuplesSelecPtr2=0;
154 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
156 throw INTERP_KERNEL::Exception(msg);
158 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
161 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
163 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
164 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
167 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
169 std::vector<std::pair<int,int> > ranges;
170 convertPyToVectorPairInt(li,ranges);
171 return self->selectByTupleRanges(ranges);
174 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
176 std::vector<int> tmp;
177 convertPyToNewIntArr3(li,tmp);
178 DataArray *ret=self->keepSelectedComponents(tmp);
179 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
182 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
184 if(!PySlice_Check(slic))
185 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
186 Py_ssize_t strt=2,stp=2,step=2;
187 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
188 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
189 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
190 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
191 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 !");
193 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
194 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
197 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
199 if(!PySlice_Check(slic))
200 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
201 Py_ssize_t strt=2,stp=2,step=2;
202 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
203 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
204 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
206 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
207 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
210 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
212 if(!PySlice_Check(slic))
213 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
214 Py_ssize_t strt=2,stp=2,step=2;
215 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
216 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
217 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
218 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
219 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
220 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
223 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
225 if(!PySlice_Check(slic))
226 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
227 Py_ssize_t strt=2,stp=2,step=2;
228 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
229 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
230 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
231 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
232 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
233 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
236 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
238 if(!PySlice_Check(slic))
239 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
240 Py_ssize_t strt=2,stp=2,step=2;
241 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
242 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
243 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
244 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
247 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
249 if(!PySlice_Check(slic))
250 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
251 Py_ssize_t strt=2,stp=2,step=2;
252 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
253 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
254 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
255 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
261 class DataArrayDoubleIterator;
263 class DataArrayDouble : public DataArray
266 static DataArrayDouble *New();
267 double doubleValue() const throw(INTERP_KERNEL::Exception);
268 bool empty() const throw(INTERP_KERNEL::Exception);
269 DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
270 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
271 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
272 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
273 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
274 void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
275 double popBackSilent() throw(INTERP_KERNEL::Exception);
276 void pack() const throw(INTERP_KERNEL::Exception);
277 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
278 void fillWithZero() throw(INTERP_KERNEL::Exception);
279 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
280 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
281 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
282 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
283 void reverse() throw(INTERP_KERNEL::Exception);
284 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
285 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
286 std::string repr() const throw(INTERP_KERNEL::Exception);
287 std::string reprZip() const throw(INTERP_KERNEL::Exception);
288 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
289 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
290 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
291 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
292 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
293 DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
294 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
295 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
296 void transpose() throw(INTERP_KERNEL::Exception);
297 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
298 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
299 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
300 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
301 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
302 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
303 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
304 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
305 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
306 double front() const throw(INTERP_KERNEL::Exception);
307 double back() const throw(INTERP_KERNEL::Exception);
308 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
309 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
310 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
311 double *getPointer() throw(INTERP_KERNEL::Exception);
312 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
313 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
314 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
315 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
316 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
317 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
318 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
319 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
320 double getAverageValue() const throw(INTERP_KERNEL::Exception);
321 double norm2() const throw(INTERP_KERNEL::Exception);
322 double normMax() const throw(INTERP_KERNEL::Exception);
323 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
324 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
325 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
326 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
327 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
328 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
329 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
330 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
331 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
332 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
333 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
334 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
335 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
336 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
337 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
338 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
339 void abs() throw(INTERP_KERNEL::Exception);
340 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
341 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
342 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
343 void applyPow(double val) throw(INTERP_KERNEL::Exception);
344 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
345 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
346 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
347 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
348 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
349 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
350 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
351 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
352 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
353 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
354 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
355 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
356 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
357 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
358 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
359 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
360 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
361 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
362 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
363 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
364 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
365 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
366 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
367 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
368 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
369 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
372 DataArrayDouble() throw(INTERP_KERNEL::Exception)
374 return DataArrayDouble::New();
377 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
379 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)";
380 std::string msg(msgBase);
382 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
385 if(PyList_Check(elt0) || PyTuple_Check(elt0))
389 if(PyInt_Check(nbOfTuples))
391 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
393 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
396 if(PyInt_Check(elt2))
397 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
398 int nbOfCompo=PyInt_AS_LONG(elt2);
400 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
401 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
402 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
403 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
407 throw INTERP_KERNEL::Exception(msg.c_str());
410 {//DataArrayDouble.New([1.,3.,4.],3)
411 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
413 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
414 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
419 throw INTERP_KERNEL::Exception(msg.c_str());
422 {// DataArrayDouble.New([1.,3.,4.])
423 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
424 int tmpp1=-1,tmpp2=-1;
425 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
426 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
430 else if(PyInt_Check(elt0))
432 int nbOfTuples1=PyInt_AS_LONG(elt0);
434 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
439 if(PyInt_Check(nbOfTuples))
440 {//DataArrayDouble.New(5,2)
441 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
443 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
444 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
445 ret->alloc(nbOfTuples1,nbOfCompo);
449 throw INTERP_KERNEL::Exception(msg.c_str());
452 throw INTERP_KERNEL::Exception(msg.c_str());
455 {//DataArrayDouble.New(5)
456 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
457 ret->alloc(nbOfTuples1,1);
462 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
463 {//DataArrayDouble.New(numpyArray)
464 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
468 throw INTERP_KERNEL::Exception(msg.c_str());
471 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
473 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
476 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
479 std::vector<double> bb;
481 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
482 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
483 self->pushBackValsSilent(tmp,tmp+nbTuples);
486 std::string __repr__() const throw(INTERP_KERNEL::Exception)
488 std::ostringstream oss;
489 self->reprQuickOverview(oss);
493 std::string __str__() const throw(INTERP_KERNEL::Exception)
498 double __float__() const throw(INTERP_KERNEL::Exception)
500 return self->doubleValue();
503 int __len__() const throw(INTERP_KERNEL::Exception)
505 if(self->isAllocated())
507 return self->getNumberOfTuples();
511 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
515 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
517 return self->iterator();
520 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
522 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 !";
523 if(PyList_Check(li) || PyTuple_Check(li))
527 if(PyInt_Check(nbOfTuples))
529 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
531 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
534 if(PyInt_Check(nbOfComp))
535 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
536 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
538 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
539 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
540 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
543 throw INTERP_KERNEL::Exception(msg);
546 {//DataArrayDouble.setValues([1.,3.,4.],3)
548 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
549 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
553 throw INTERP_KERNEL::Exception(msg);
556 {// DataArrayDouble.setValues([1.,3.,4.])
557 int tmpp1=-1,tmpp2=-1;
558 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
559 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
563 throw INTERP_KERNEL::Exception(msg);
566 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
568 const double *vals=self->getConstPointer();
569 return convertDblArrToPyList(vals,self->getNbOfElems());
573 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
575 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
579 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
582 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
583 PyObject *ret=PyTuple_New(2);
584 PyObject *ret0Py=ret0?Py_True:Py_False;
586 PyTuple_SetItem(ret,0,ret0Py);
587 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
591 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
593 const double *vals=self->getConstPointer();
594 int nbOfComp=self->getNumberOfComponents();
595 int nbOfTuples=self->getNumberOfTuples();
596 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
599 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
602 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
603 if (!SWIG_IsOK(res1))
606 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
607 if(size!=self->getNumberOfTuples())
609 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
611 return self->renumber(tmp);
615 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
617 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
618 da2->checkAllocated();
619 int size=self->getNumberOfTuples();
620 if(size!=self->getNumberOfTuples())
622 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
624 return self->renumber(da2->getConstPointer());
628 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
631 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
632 if (!SWIG_IsOK(res1))
635 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
636 if(size!=self->getNumberOfTuples())
638 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
640 return self->renumberR(tmp);
644 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
646 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
647 da2->checkAllocated();
648 int size=self->getNumberOfTuples();
649 if(size!=self->getNumberOfTuples())
651 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
653 return self->renumberR(da2->getConstPointer());
657 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
660 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
661 if (!SWIG_IsOK(res1))
664 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
665 if(size!=self->getNumberOfTuples())
667 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
669 return self->renumberAndReduce(tmp,newNbOfTuple);
673 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
675 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
676 da2->checkAllocated();
677 int size=self->getNumberOfTuples();
678 if(size!=self->getNumberOfTuples())
680 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
682 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
686 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
689 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
690 if (!SWIG_IsOK(res1))
693 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
694 return self->selectByTupleId(tmp,tmp+size);
698 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
700 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
701 da2->checkAllocated();
702 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
706 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
709 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
710 if (!SWIG_IsOK(res1))
713 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
714 return self->selectByTupleIdSafe(tmp,tmp+size);
718 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
720 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
721 da2->checkAllocated();
722 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
726 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
728 int thisTupleId,otherTupleId;
729 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
730 PyObject *ret=PyTuple_New(3);
731 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
732 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
733 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
737 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
740 double r1=self->getMaxValue(tmp);
741 PyObject *ret=PyTuple_New(2);
742 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
743 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
747 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
750 double r1=self->getMaxValue2(tmp);
751 PyObject *ret=PyTuple_New(2);
752 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
753 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
757 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
760 double r1=self->getMinValue(tmp);
761 PyObject *ret=PyTuple_New(2);
762 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
763 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
767 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
770 double r1=self->getMinValue2(tmp);
771 PyObject *ret=PyTuple_New(2);
772 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
773 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
777 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
779 int nbOfCompo=self->getNumberOfComponents();
780 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
781 self->getMinMaxPerComponent(tmp);
782 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
786 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
788 int sz=self->getNumberOfComponents();
789 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
790 self->accumulate(tmp);
791 return convertDblArrToPyList(tmp,sz);
794 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
797 std::vector<int> val2;
798 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
799 return self->accumulatePerChunck(bg,bg+sz);
802 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
804 DataArrayInt *comm, *commIndex;
805 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
806 PyObject *res = PyList_New(2);
807 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
808 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
812 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
816 DataArrayDoubleTuple *aa;
817 std::vector<double> bb;
819 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
820 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
822 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
823 PyObject *ret=PyTuple_New(2);
824 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
825 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
829 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
831 std::vector<int> tmp;
832 convertPyToNewIntArr3(li,tmp);
833 self->setSelectedComponents(a,tmp);
836 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
838 int sz=self->getNumberOfComponents();
839 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
840 self->getTuple(tupleId,tmp);
841 return convertDblArrToPyList(tmp,sz);
844 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
846 std::vector<const DataArrayDouble *> tmp;
847 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
848 return DataArrayDouble::Aggregate(tmp);
851 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
853 std::vector<const DataArrayDouble *> tmp;
854 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
855 return DataArrayDouble::Meld(tmp);
858 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
862 DataArrayDoubleTuple *aa;
863 std::vector<double> bb;
865 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
866 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
867 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
868 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
869 DataArrayInt *c=0,*cI=0;
870 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
871 PyObject *ret=PyTuple_New(2);
872 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
873 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
877 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
879 DataArrayInt *ret1=0;
880 bool ret0=self->areIncludedInMe(other,prec,ret1);
881 PyObject *ret=PyTuple_New(2);
882 PyObject *ret0Py=ret0?Py_True:Py_False;
884 PyTuple_SetItem(ret,0,ret0Py);
885 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
889 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
891 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
892 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
893 self->checkAllocated();
894 int nbOfTuples=self->getNumberOfTuples();
895 int nbOfComponents=self->getNumberOfComponents();
897 std::vector<int> vt1,vc1;
898 std::pair<int, std::pair<int,int> > pt1,pc1;
899 DataArrayInt *dt1=0,*dc1=0;
901 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
902 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
906 if(nbOfComponents==1)
907 return PyFloat_FromDouble(self->getIJSafe(it1,0));
908 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
910 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
912 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
914 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
916 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
919 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
920 std::vector<int> v2(1,ic1);
921 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
925 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
926 std::vector<int> v2(1,ic1);
927 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
931 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
932 std::vector<int> v2(1,ic1);
933 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
937 ret=self->selectByTupleIdSafe(&it1,&it1+1);
938 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
942 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
943 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
947 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
948 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
952 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
953 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
957 ret=self->selectByTupleIdSafe(&it1,&it1+1);
958 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
959 std::vector<int> v2(nbOfComp);
960 for(int i=0;i<nbOfComp;i++)
961 v2[i]=pc1.first+i*pc1.second.second;
962 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
966 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
967 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
968 std::vector<int> v2(nbOfComp);
969 for(int i=0;i<nbOfComp;i++)
970 v2[i]=pc1.first+i*pc1.second.second;
971 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
975 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
976 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
977 std::vector<int> v2(nbOfComp);
978 for(int i=0;i<nbOfComp;i++)
979 v2[i]=pc1.first+i*pc1.second.second;
980 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
984 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
985 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
986 std::vector<int> v2(nbOfComp);
987 for(int i=0;i<nbOfComp;i++)
988 v2[i]=pc1.first+i*pc1.second.second;
989 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
992 throw INTERP_KERNEL::Exception(msg);
996 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
998 self->checkAllocated();
999 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1000 int nbOfTuples=self->getNumberOfTuples();
1001 int nbOfComponents=self->getNumberOfComponents();
1004 std::vector<double> v1;
1005 DataArrayDouble *d1=0;
1006 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1008 std::vector<int> vt1,vc1;
1009 std::pair<int, std::pair<int,int> > pt1,pc1;
1010 DataArrayInt *dt1=0,*dc1=0;
1011 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1012 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1020 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1023 tmp=DataArrayDouble::New();
1024 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1025 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1028 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1031 throw INTERP_KERNEL::Exception(msg);
1040 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1043 tmp=DataArrayDouble::New();
1044 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1045 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1048 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1051 throw INTERP_KERNEL::Exception(msg);
1060 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1063 tmp=DataArrayDouble::New();
1064 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1065 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1068 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1071 throw INTERP_KERNEL::Exception(msg);
1080 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1083 tmp=DataArrayDouble::New();
1084 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1085 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1088 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1091 throw INTERP_KERNEL::Exception(msg);
1100 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1103 tmp=DataArrayDouble::New();
1104 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1105 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1108 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1111 throw INTERP_KERNEL::Exception(msg);
1120 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1123 tmp=DataArrayDouble::New();
1124 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1125 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1128 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1131 throw INTERP_KERNEL::Exception(msg);
1140 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1143 tmp=DataArrayDouble::New();
1144 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1145 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1148 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1151 throw INTERP_KERNEL::Exception(msg);
1160 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1163 tmp=DataArrayDouble::New();
1164 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1165 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1168 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1171 throw INTERP_KERNEL::Exception(msg);
1180 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1183 tmp=DataArrayDouble::New();
1184 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1185 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1188 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1191 throw INTERP_KERNEL::Exception(msg);
1200 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1203 tmp=DataArrayDouble::New();
1204 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1205 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1208 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1211 throw INTERP_KERNEL::Exception(msg);
1220 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1223 tmp=DataArrayDouble::New();
1224 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1225 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1228 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1231 throw INTERP_KERNEL::Exception(msg);
1240 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1243 tmp=DataArrayDouble::New();
1244 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1245 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1248 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1251 throw INTERP_KERNEL::Exception(msg);
1260 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1263 tmp=DataArrayDouble::New();
1264 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1265 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1268 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1271 throw INTERP_KERNEL::Exception(msg);
1280 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1283 tmp=DataArrayDouble::New();
1284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1285 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1288 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1291 throw INTERP_KERNEL::Exception(msg);
1300 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1303 tmp=DataArrayDouble::New();
1304 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1305 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1308 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1311 throw INTERP_KERNEL::Exception(msg);
1320 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1323 tmp=DataArrayDouble::New();
1324 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1325 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1328 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1331 throw INTERP_KERNEL::Exception(msg);
1336 throw INTERP_KERNEL::Exception(msg);
1341 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1343 return self->negate();
1346 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1348 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1351 DataArrayDoubleTuple *aa;
1352 std::vector<double> bb;
1356 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1358 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1361 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1362 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1364 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1367 throw INTERP_KERNEL::Exception(msg);
1370 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1375 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1376 ret->applyLin(1.,val);
1377 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1381 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1385 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1386 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1390 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1391 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1394 throw INTERP_KERNEL::Exception(msg);
1398 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1400 const char msg[]="Unexpected situation in __radd__ !";
1403 DataArrayDoubleTuple *aa;
1404 std::vector<double> bb;
1406 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1411 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1412 ret->applyLin(1.,val);
1417 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1418 return DataArrayDouble::Add(self,aaa);
1422 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1423 return DataArrayDouble::Add(self,aaa);
1426 throw INTERP_KERNEL::Exception(msg);
1430 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1432 const char msg[]="Unexpected situation in __iadd__ !";
1435 DataArrayDoubleTuple *aa;
1436 std::vector<double> bb;
1438 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1443 self->applyLin(1.,val);
1444 Py_XINCREF(trueSelf);
1450 Py_XINCREF(trueSelf);
1455 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1456 self->addEqual(aaa);
1457 Py_XINCREF(trueSelf);
1462 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1463 self->addEqual(aaa);
1464 Py_XINCREF(trueSelf);
1468 throw INTERP_KERNEL::Exception(msg);
1472 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1474 const char msg[]="Unexpected situation in __sub__ !";
1477 DataArrayDoubleTuple *aa;
1478 std::vector<double> bb;
1482 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1484 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1487 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1488 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1490 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1493 throw INTERP_KERNEL::Exception(msg);
1496 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1501 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1502 ret->applyLin(1.,-val);
1503 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1507 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1511 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1512 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1516 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1517 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1520 throw INTERP_KERNEL::Exception(msg);
1524 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1526 const char msg[]="Unexpected situation in __rsub__ !";
1529 DataArrayDoubleTuple *aa;
1530 std::vector<double> bb;
1532 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1537 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1538 ret->applyLin(-1.,val);
1543 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1544 return DataArrayDouble::Substract(aaa,self);
1548 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1549 return DataArrayDouble::Substract(aaa,self);
1552 throw INTERP_KERNEL::Exception(msg);
1556 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1558 const char msg[]="Unexpected situation in __isub__ !";
1561 DataArrayDoubleTuple *aa;
1562 std::vector<double> bb;
1564 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1569 self->applyLin(1,-val);
1570 Py_XINCREF(trueSelf);
1575 self->substractEqual(a);
1576 Py_XINCREF(trueSelf);
1581 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1582 self->substractEqual(aaa);
1583 Py_XINCREF(trueSelf);
1588 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1589 self->substractEqual(aaa);
1590 Py_XINCREF(trueSelf);
1594 throw INTERP_KERNEL::Exception(msg);
1598 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1600 const char msg[]="Unexpected situation in __mul__ !";
1603 DataArrayDoubleTuple *aa;
1604 std::vector<double> bb;
1608 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1610 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1613 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1614 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1616 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1619 throw INTERP_KERNEL::Exception(msg);
1622 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1627 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1628 ret->applyLin(val,0.);
1629 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1633 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1637 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1638 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1642 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1643 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1646 throw INTERP_KERNEL::Exception(msg);
1650 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1652 const char msg[]="Unexpected situation in __rmul__ !";
1655 DataArrayDoubleTuple *aa;
1656 std::vector<double> bb;
1658 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1663 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1664 ret->applyLin(val,0.);
1669 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1670 return DataArrayDouble::Multiply(self,aaa);
1674 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1675 return DataArrayDouble::Multiply(self,aaa);
1678 throw INTERP_KERNEL::Exception(msg);
1682 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1684 const char msg[]="Unexpected situation in __imul__ !";
1687 DataArrayDoubleTuple *aa;
1688 std::vector<double> bb;
1690 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1695 self->applyLin(val,0.);
1696 Py_XINCREF(trueSelf);
1701 self->multiplyEqual(a);
1702 Py_XINCREF(trueSelf);
1707 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1708 self->multiplyEqual(aaa);
1709 Py_XINCREF(trueSelf);
1714 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1715 self->multiplyEqual(aaa);
1716 Py_XINCREF(trueSelf);
1720 throw INTERP_KERNEL::Exception(msg);
1724 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1726 const char msg[]="Unexpected situation in __div__ !";
1729 DataArrayDoubleTuple *aa;
1730 std::vector<double> bb;
1734 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1736 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1739 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1740 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1745 throw INTERP_KERNEL::Exception(msg);
1748 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1754 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1755 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1756 ret->applyLin(1/val,0.);
1757 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1761 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1765 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1766 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1770 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1771 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1774 throw INTERP_KERNEL::Exception(msg);
1778 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1780 const char msg[]="Unexpected situation in __rdiv__ !";
1783 DataArrayDoubleTuple *aa;
1784 std::vector<double> bb;
1786 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1791 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1797 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1798 return DataArrayDouble::Divide(aaa,self);
1802 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1803 return DataArrayDouble::Divide(aaa,self);
1806 throw INTERP_KERNEL::Exception(msg);
1810 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1812 const char msg[]="Unexpected situation in __idiv__ !";
1815 DataArrayDoubleTuple *aa;
1816 std::vector<double> bb;
1818 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1824 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1825 self->applyLin(1./val,0.);
1826 Py_XINCREF(trueSelf);
1831 self->divideEqual(a);
1832 Py_XINCREF(trueSelf);
1837 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1838 self->divideEqual(aaa);
1839 Py_XINCREF(trueSelf);
1844 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1845 self->divideEqual(aaa);
1846 Py_XINCREF(trueSelf);
1850 throw INTERP_KERNEL::Exception(msg);
1854 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1856 const char msg[]="Unexpected situation in __pow__ !";
1859 DataArrayDoubleTuple *aa;
1860 std::vector<double> bb;
1862 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1867 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1873 return DataArrayDouble::Pow(self,a);
1877 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1878 return DataArrayDouble::Pow(self,aaa);
1882 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1883 return DataArrayDouble::Pow(self,aaa);
1886 throw INTERP_KERNEL::Exception(msg);
1890 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1892 const char msg[]="Unexpected situation in __rpow__ !";
1895 DataArrayDoubleTuple *aa;
1896 std::vector<double> bb;
1898 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1903 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1904 ret->applyRPow(val);
1909 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1910 return DataArrayDouble::Pow(aaa,self);
1914 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1915 return DataArrayDouble::Pow(aaa,self);
1918 throw INTERP_KERNEL::Exception(msg);
1922 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1924 const char msg[]="Unexpected situation in __ipow__ !";
1927 DataArrayDoubleTuple *aa;
1928 std::vector<double> bb;
1930 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1935 self->applyPow(val);
1936 Py_XINCREF(trueSelf);
1942 Py_XINCREF(trueSelf);
1947 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1948 self->powEqual(aaa);
1949 Py_XINCREF(trueSelf);
1954 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1955 self->powEqual(aaa);
1956 Py_XINCREF(trueSelf);
1960 throw INTERP_KERNEL::Exception(msg);
1964 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1966 DataArrayInt *c=0,*cI=0;
1968 self->computeTupleIdsNearTuples(other,eps,c,cI);
1969 PyObject *ret=PyTuple_New(2);
1970 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1971 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1975 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1977 DataArrayInt *ret1=0;
1978 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1979 PyObject *ret=PyTuple_New(2);
1980 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1981 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1987 class DataArrayDoubleTuple;
1989 class DataArrayDoubleIterator
1992 DataArrayDoubleIterator(DataArrayDouble *da);
1993 ~DataArrayDoubleIterator();
1998 DataArrayDoubleTuple *ret=self->nextt();
2000 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2003 PyErr_SetString(PyExc_StopIteration,"No more data.");
2010 class DataArrayDoubleTuple
2013 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2014 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2017 std::string __str__() const throw(INTERP_KERNEL::Exception)
2019 return self->repr();
2022 double __float__() const throw(INTERP_KERNEL::Exception)
2024 return self->doubleValue();
2027 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2029 return self->buildDADouble(1,self->getNumberOfCompo());
2032 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2034 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2035 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2036 Py_XINCREF(trueSelf);
2040 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2042 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2043 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2044 Py_XINCREF(trueSelf);
2048 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2050 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2051 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2052 Py_XINCREF(trueSelf);
2056 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2058 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2059 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2060 Py_XINCREF(trueSelf);
2064 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2066 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2069 std::vector<int> multiVal;
2070 std::pair<int, std::pair<int,int> > slic;
2071 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2072 const double *pt=self->getConstPointer();
2073 int nbc=self->getNumberOfCompo();
2074 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2081 std::ostringstream oss;
2082 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2083 throw INTERP_KERNEL::Exception(oss.str().c_str());
2086 return PyFloat_FromDouble(pt[singleVal]);
2090 return PyFloat_FromDouble(pt[nbc+singleVal]);
2093 std::ostringstream oss;
2094 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2095 throw INTERP_KERNEL::Exception(oss.str().c_str());
2101 PyObject *t=PyTuple_New(multiVal.size());
2102 for(int j=0;j<(int)multiVal.size();j++)
2104 int cid=multiVal[j];
2107 std::ostringstream oss;
2108 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2109 throw INTERP_KERNEL::Exception(oss.str().c_str());
2111 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2117 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2118 PyObject *t=PyTuple_New(sz);
2119 for(int j=0;j<sz;j++)
2120 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2124 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2128 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2130 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2131 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2134 std::vector<double> multiValV;
2135 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2136 int nbc=self->getNumberOfCompo();
2137 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2139 std::vector<int> multiVal;
2140 std::pair<int, std::pair<int,int> > slic;
2141 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2142 double *pt=self->getPointer();
2143 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2150 std::ostringstream oss;
2151 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2152 throw INTERP_KERNEL::Exception(oss.str().c_str());
2158 pt[singleVal]=singleValV;
2163 if(multiValV.size()!=1)
2165 std::ostringstream oss;
2166 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2167 throw INTERP_KERNEL::Exception(oss.str().c_str());
2169 pt[singleVal]=multiValV[0];
2174 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2178 throw INTERP_KERNEL::Exception(msg);
2187 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2191 std::ostringstream oss;
2192 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2193 throw INTERP_KERNEL::Exception(oss.str().c_str());
2201 if(multiVal.size()!=multiValV.size())
2203 std::ostringstream oss;
2204 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2205 throw INTERP_KERNEL::Exception(oss.str().c_str());
2207 for(int i=0;i<(int)multiVal.size();i++)
2209 int pos=multiVal[i];
2212 std::ostringstream oss;
2213 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2214 throw INTERP_KERNEL::Exception(oss.str().c_str());
2216 pt[multiVal[i]]=multiValV[i];
2222 const double *ptV=daIntTyyppV->getConstPointer();
2223 if(nbc>daIntTyyppV->getNumberOfCompo())
2225 std::ostringstream oss;
2226 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2227 throw INTERP_KERNEL::Exception(oss.str().c_str());
2229 std::copy(ptV,ptV+nbc,pt);
2233 throw INTERP_KERNEL::Exception(msg);
2238 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2243 for(int j=0;j<sz;j++)
2244 pt[slic.first+j*slic.second.second]=singleValV;
2249 if(sz!=(int)multiValV.size())
2251 std::ostringstream oss;
2252 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2253 throw INTERP_KERNEL::Exception(oss.str().c_str());
2255 for(int j=0;j<sz;j++)
2256 pt[slic.first+j*slic.second.second]=multiValV[j];
2261 const double *ptV=daIntTyyppV->getConstPointer();
2262 if(sz>daIntTyyppV->getNumberOfCompo())
2264 std::ostringstream oss;
2265 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2266 throw INTERP_KERNEL::Exception(oss.str().c_str());
2268 for(int j=0;j<sz;j++)
2269 pt[slic.first+j*slic.second.second]=ptV[j];
2273 throw INTERP_KERNEL::Exception(msg);
2277 throw INTERP_KERNEL::Exception(msg);
2283 class DataArrayIntIterator;
2285 class DataArrayInt : public DataArray
2288 static DataArrayInt *New();
2289 int intValue() const throw(INTERP_KERNEL::Exception);
2290 int getHashCode() const throw(INTERP_KERNEL::Exception);
2291 bool empty() const throw(INTERP_KERNEL::Exception);
2292 DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
2293 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2294 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2295 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2296 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2297 int popBackSilent() throw(INTERP_KERNEL::Exception);
2298 void pack() const throw(INTERP_KERNEL::Exception);
2299 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2300 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2301 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2302 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2303 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2304 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2305 void reverse() throw(INTERP_KERNEL::Exception);
2306 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2307 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2308 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2309 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2310 void fillWithZero() throw(INTERP_KERNEL::Exception);
2311 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2312 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2313 std::string repr() const throw(INTERP_KERNEL::Exception);
2314 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2317 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2318 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2319 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2320 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2321 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2323 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2324 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2325 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2326 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2327 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
2328 void transpose() throw(INTERP_KERNEL::Exception);
2329 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2330 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2331 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2332 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2333 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2334 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2335 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2336 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2337 int front() const throw(INTERP_KERNEL::Exception);
2338 int back() const throw(INTERP_KERNEL::Exception);
2339 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2340 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2341 int *getPointer() throw(INTERP_KERNEL::Exception);
2342 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2343 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2344 const int *begin() const throw(INTERP_KERNEL::Exception);
2345 const int *end() const throw(INTERP_KERNEL::Exception);
2346 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2347 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2348 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2349 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2350 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2351 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2352 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2353 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2354 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2355 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2356 int count(int value) const throw(INTERP_KERNEL::Exception);
2357 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2358 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2359 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2360 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2361 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2362 void abs() throw(INTERP_KERNEL::Exception);
2363 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2364 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2365 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2367 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2368 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2369 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2370 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2371 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2373 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2375 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2377 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2378 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2385 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2386 void computeOffsets() throw(INTERP_KERNEL::Exception);
2387 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2393 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2394 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2395 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2396 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2397 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2398 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2399 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2400 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2401 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2402 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2403 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2404 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2406 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2409 DataArrayInt() throw(INTERP_KERNEL::Exception)
2411 return DataArrayInt::New();
2414 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2416 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)";
2417 std::string msg(msgBase);
2419 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2422 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2426 if(PyInt_Check(nbOfTuples))
2428 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2430 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2433 if(PyInt_Check(nbOfComp))
2434 {//DataArrayInt.New([1,3,4,5],2,2)
2435 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2437 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2438 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2439 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2440 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2444 throw INTERP_KERNEL::Exception(msg.c_str());
2447 {//DataArrayInt.New([1,3,4],3)
2448 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2450 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2451 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2456 throw INTERP_KERNEL::Exception(msg.c_str());
2459 {// DataArrayInt.New([1,3,4])
2460 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2461 int tmpp1=-1,tmpp2=-1;
2462 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2463 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2467 else if(PyInt_Check(elt0))
2469 int nbOfTuples1=PyInt_AS_LONG(elt0);
2471 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2476 if(PyInt_Check(nbOfTuples))
2477 {//DataArrayInt.New(5,2)
2478 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2480 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2481 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2482 ret->alloc(nbOfTuples1,nbOfCompo);
2486 throw INTERP_KERNEL::Exception(msg.c_str());
2489 throw INTERP_KERNEL::Exception(msg.c_str());
2492 {//DataArrayInt.New(5)
2493 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2494 ret->alloc(nbOfTuples1,1);
2499 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2500 {//DataArrayInt.New(numpyArray)
2501 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
2505 throw INTERP_KERNEL::Exception(msg.c_str());
2508 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2510 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2513 std::string __str__() const throw(INTERP_KERNEL::Exception)
2515 return self->repr();
2518 int __len__() const throw(INTERP_KERNEL::Exception)
2520 if(self->isAllocated())
2522 return self->getNumberOfTuples();
2526 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2530 int __int__() const throw(INTERP_KERNEL::Exception)
2532 return self->intValue();
2535 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2537 return self->iterator();
2540 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2542 int sz=self->getNumberOfComponents();
2543 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2544 self->accumulate(tmp);
2545 return convertIntArrToPyList(tmp,sz);
2548 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2551 std::vector<int> val2;
2552 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2553 return self->accumulatePerChunck(bg,bg+sz);
2556 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2558 int newNbOfTuples=-1;
2559 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2560 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2561 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2562 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2563 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2564 PyObject *ret=PyTuple_New(2);
2565 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2566 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2570 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2572 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 !";
2573 if(PyList_Check(li) || PyTuple_Check(li))
2577 if(PyInt_Check(nbOfTuples))
2579 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2581 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2584 if(PyInt_Check(nbOfComp))
2585 {//DataArrayInt.setValues([1,3,4,5],2,2)
2586 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2588 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2589 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2590 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2593 throw INTERP_KERNEL::Exception(msg);
2596 {//DataArrayInt.setValues([1,3,4],3)
2598 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2599 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2603 throw INTERP_KERNEL::Exception(msg);
2606 {// DataArrayInt.setValues([1,3,4])
2607 int tmpp1=-1,tmpp2=-1;
2608 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2609 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2613 throw INTERP_KERNEL::Exception(msg);
2616 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2618 const int *vals=self->getConstPointer();
2619 return convertIntArrToPyList(vals,self->getNbOfElems());
2623 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2625 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT,"DataArrayInt");
2629 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2632 bool ret0=self->isEqualIfNotWhy(other,ret1);
2633 PyObject *ret=PyTuple_New(2);
2634 PyObject *ret0Py=ret0?Py_True:Py_False;
2636 PyTuple_SetItem(ret,0,ret0Py);
2637 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2641 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2643 const int *vals=self->getConstPointer();
2644 int nbOfComp=self->getNumberOfComponents();
2645 int nbOfTuples=self->getNumberOfTuples();
2646 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2649 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2651 std::vector<const DataArrayInt *> groups;
2652 std::vector< std::vector<int> > fidsOfGroups;
2653 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2654 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2655 PyObject *ret = PyList_New(2);
2656 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2657 int sz=fidsOfGroups.size();
2658 PyObject *ret1 = PyList_New(sz);
2659 for(int i=0;i<sz;i++)
2660 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2661 PyList_SetItem(ret,1,ret1);
2665 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2668 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2669 if (!SWIG_IsOK(res1))
2672 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2673 self->transformWithIndArr(tmp,tmp+size);
2677 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2678 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2682 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2686 std::vector<int> multiVal;
2687 std::pair<int, std::pair<int,int> > slic;
2688 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2689 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2693 return self->getIdsEqualList(&singleVal,&singleVal+1);
2695 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2697 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2699 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2703 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2707 std::vector<int> multiVal;
2708 std::pair<int, std::pair<int,int> > slic;
2709 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2710 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2714 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2716 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2718 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2720 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2724 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2726 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2728 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2729 if (!SWIG_IsOK(res1))
2732 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2733 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2737 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2739 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2740 da2->checkAllocated();
2741 int size=self->getNumberOfTuples();
2742 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2744 PyObject *ret = PyList_New(3);
2745 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2746 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2747 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2751 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2754 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2755 if (!SWIG_IsOK(res1))
2758 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2759 return self->transformWithIndArrR(tmp,tmp+size);
2763 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2764 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2768 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2771 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2772 if (!SWIG_IsOK(res1))
2775 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2776 if(size!=self->getNumberOfTuples())
2778 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2780 return self->renumberAndReduce(tmp,newNbOfTuple);
2784 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2786 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2787 da2->checkAllocated();
2788 int size=self->getNumberOfTuples();
2789 if(size!=self->getNumberOfTuples())
2791 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2793 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2797 DataArrayInt *renumber(PyObject *li) 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->renumber(tmp);
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->renumber(da2->getConstPointer());
2826 DataArrayInt *renumberR(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->renumberR(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->renumberR(da2->getConstPointer());
2855 DataArrayInt *selectByTupleId(PyObject *li) const 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 return self->selectByTupleId(tmp,tmp+size);
2867 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2869 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2870 da2->checkAllocated();
2871 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2875 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2878 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2879 if (!SWIG_IsOK(res1))
2882 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2883 return self->selectByTupleIdSafe(tmp,tmp+size);
2887 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2889 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2890 da2->checkAllocated();
2891 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2895 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2897 std::vector<int> tmp;
2898 convertPyToNewIntArr3(li,tmp);
2899 self->setSelectedComponents(a,tmp);
2902 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2904 int sz=self->getNumberOfComponents();
2905 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2906 self->getTuple(tupleId,tmp);
2907 return convertIntArrToPyList(tmp,sz);
2910 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2912 DataArrayInt *arr=0;
2913 DataArrayInt *arrI=0;
2914 self->changeSurjectiveFormat(targetNb,arr,arrI);
2915 PyObject *res = PyList_New(2);
2916 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2917 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2921 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2923 std::vector<const DataArrayInt *> tmp;
2924 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2925 return DataArrayInt::Meld(tmp);
2928 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2930 std::vector<const DataArrayInt *> tmp;
2931 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2932 return DataArrayInt::Aggregate(tmp);
2935 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2937 std::vector<const DataArrayInt *> tmp;
2938 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2939 return DataArrayInt::AggregateIndexes(tmp);
2942 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2944 std::vector<const DataArrayInt *> tmp;
2945 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2946 return DataArrayInt::BuildUnion(tmp);
2949 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2951 std::vector<const DataArrayInt *> tmp;
2952 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2953 return DataArrayInt::BuildIntersection(tmp);
2956 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2959 int r1=self->getMaxValue(tmp);
2960 PyObject *ret=PyTuple_New(2);
2961 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2962 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2966 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2969 int r1=self->getMinValue(tmp);
2970 PyObject *ret=PyTuple_New(2);
2971 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2972 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2976 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2978 int nbOfCompo=self->getNumberOfComponents();
2983 if(PyInt_Check(obj))
2985 int val=(int)PyInt_AS_LONG(obj);
2986 return self->locateValue(val);
2989 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2993 std::vector<int> arr;
2994 convertPyToNewIntArr3(obj,arr);
2995 return self->locateTuple(arr);
3000 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3002 int nbOfCompo=self->getNumberOfComponents();
3009 if(PyInt_Check(obj))
3011 int val=(int)PyInt_AS_LONG(obj);
3012 return self->presenceOfValue(val);
3015 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3019 std::vector<int> arr;
3020 convertPyToNewIntArr3(obj,arr);
3021 return self->presenceOfTuple(arr);
3026 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3028 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3029 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3030 self->checkAllocated();
3031 int nbOfTuples=self->getNumberOfTuples();
3032 int nbOfComponents=self->getNumberOfComponents();
3034 std::vector<int> vt1,vc1;
3035 std::pair<int, std::pair<int,int> > pt1,pc1;
3036 DataArrayInt *dt1=0,*dc1=0;
3038 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3039 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3044 if(nbOfComponents==1)
3045 return PyInt_FromLong(self->getIJSafe(it1,0));
3046 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3049 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3051 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3053 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3055 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3058 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3059 std::vector<int> v2(1,ic1);
3060 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3064 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3065 std::vector<int> v2(1,ic1);
3066 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3070 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3071 std::vector<int> v2(1,ic1);
3072 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3076 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3081 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3082 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3086 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3087 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3091 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3092 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3096 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3097 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3098 std::vector<int> v2(nbOfComp);
3099 for(int i=0;i<nbOfComp;i++)
3100 v2[i]=pc1.first+i*pc1.second.second;
3101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3105 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3106 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3107 std::vector<int> v2(nbOfComp);
3108 for(int i=0;i<nbOfComp;i++)
3109 v2[i]=pc1.first+i*pc1.second.second;
3110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3114 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3115 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3116 std::vector<int> v2(nbOfComp);
3117 for(int i=0;i<nbOfComp;i++)
3118 v2[i]=pc1.first+i*pc1.second.second;
3119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3123 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3124 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3125 std::vector<int> v2(nbOfComp);
3126 for(int i=0;i<nbOfComp;i++)
3127 v2[i]=pc1.first+i*pc1.second.second;
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3131 throw INTERP_KERNEL::Exception(msg);
3135 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3137 self->checkAllocated();
3138 const char msg[]="Unexpected situation in __setitem__ !";
3139 int nbOfTuples=self->getNumberOfTuples();
3140 int nbOfComponents=self->getNumberOfComponents();
3143 std::vector<int> v1;
3145 DataArrayIntTuple *dd1=0;
3146 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3148 std::vector<int> vt1,vc1;
3149 std::pair<int, std::pair<int,int> > pt1,pc1;
3150 DataArrayInt *dt1=0,*dc1=0;
3151 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3152 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3160 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3163 tmp=DataArrayInt::New();
3164 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3165 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3168 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3171 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3172 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3175 throw INTERP_KERNEL::Exception(msg);
3184 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3187 tmp=DataArrayInt::New();
3188 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3189 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3192 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3195 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3196 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3199 throw INTERP_KERNEL::Exception(msg);
3208 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3211 tmp=DataArrayInt::New();
3212 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3213 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3216 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3219 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3220 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3223 throw INTERP_KERNEL::Exception(msg);
3232 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3235 tmp=DataArrayInt::New();
3236 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3237 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3240 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3243 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3244 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3247 throw INTERP_KERNEL::Exception(msg);
3256 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3259 tmp=DataArrayInt::New();
3260 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3261 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3264 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3267 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3268 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3271 throw INTERP_KERNEL::Exception(msg);
3280 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3283 tmp=DataArrayInt::New();
3284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3285 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3288 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3291 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3292 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3295 throw INTERP_KERNEL::Exception(msg);
3304 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3307 tmp=DataArrayInt::New();
3308 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3309 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3312 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3315 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3316 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3319 throw INTERP_KERNEL::Exception(msg);
3328 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3331 tmp=DataArrayInt::New();
3332 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3333 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3336 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3339 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3340 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3343 throw INTERP_KERNEL::Exception(msg);
3352 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3355 tmp=DataArrayInt::New();
3356 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3357 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3360 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3363 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3364 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3367 throw INTERP_KERNEL::Exception(msg);
3376 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3379 tmp=DataArrayInt::New();
3380 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3381 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3384 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3387 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3388 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3391 throw INTERP_KERNEL::Exception(msg);
3400 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3403 tmp=DataArrayInt::New();
3404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3405 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3408 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3411 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3412 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3415 throw INTERP_KERNEL::Exception(msg);
3424 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3427 tmp=DataArrayInt::New();
3428 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3429 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3432 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3435 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3436 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3439 throw INTERP_KERNEL::Exception(msg);
3448 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3451 tmp=DataArrayInt::New();
3452 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3453 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3456 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3459 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3460 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3463 throw INTERP_KERNEL::Exception(msg);
3472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3475 tmp=DataArrayInt::New();
3476 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3477 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3480 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3483 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3484 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3487 throw INTERP_KERNEL::Exception(msg);
3496 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3499 tmp=DataArrayInt::New();
3500 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3501 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3504 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3507 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3508 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3511 throw INTERP_KERNEL::Exception(msg);
3520 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3523 tmp=DataArrayInt::New();
3524 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3525 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3528 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3531 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3532 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3535 throw INTERP_KERNEL::Exception(msg);
3540 throw INTERP_KERNEL::Exception(msg);
3545 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3547 return self->negate();
3550 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3552 const char msg[]="Unexpected situation in __add__ !";
3555 std::vector<int> aa;
3556 DataArrayIntTuple *aaa;
3558 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3563 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3564 ret->applyLin(1,val);
3569 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3570 return DataArrayInt::Add(self,aaaa);
3574 return DataArrayInt::Add(self,a);
3578 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3579 return DataArrayInt::Add(self,aaaa);
3582 throw INTERP_KERNEL::Exception(msg);
3586 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3588 const char msg[]="Unexpected situation in __radd__ !";
3591 std::vector<int> aa;
3592 DataArrayIntTuple *aaa;
3594 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3599 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3600 ret->applyLin(1,val);
3605 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3606 return DataArrayInt::Add(self,aaaa);
3610 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3611 return DataArrayInt::Add(self,aaaa);
3614 throw INTERP_KERNEL::Exception(msg);
3618 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3620 const char msg[]="Unexpected situation in __iadd__ !";
3623 std::vector<int> aa;
3624 DataArrayIntTuple *aaa;
3626 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3631 self->applyLin(1,val);
3632 Py_XINCREF(trueSelf);
3637 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3639 Py_XINCREF(trueSelf);
3645 Py_XINCREF(trueSelf);
3650 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3651 self->addEqual(aaaa);
3652 Py_XINCREF(trueSelf);
3656 throw INTERP_KERNEL::Exception(msg);
3660 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3662 const char msg[]="Unexpected situation in __sub__ !";
3665 std::vector<int> aa;
3666 DataArrayIntTuple *aaa;
3668 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3673 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3674 ret->applyLin(1,-val);
3679 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3680 return DataArrayInt::Substract(self,aaaa);
3684 return DataArrayInt::Substract(self,a);
3688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3689 return DataArrayInt::Substract(self,aaaa);
3692 throw INTERP_KERNEL::Exception(msg);
3696 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3698 const char msg[]="Unexpected situation in __rsub__ !";
3701 std::vector<int> aa;
3702 DataArrayIntTuple *aaa;
3704 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3709 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3710 ret->applyLin(-1,val);
3715 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3716 return DataArrayInt::Substract(aaaa,self);
3720 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3721 return DataArrayInt::Substract(aaaa,self);
3724 throw INTERP_KERNEL::Exception(msg);
3728 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3730 const char msg[]="Unexpected situation in __isub__ !";
3733 std::vector<int> aa;
3734 DataArrayIntTuple *aaa;
3736 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3741 self->applyLin(1,-val);
3742 Py_XINCREF(trueSelf);
3747 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3748 self->substractEqual(bb);
3749 Py_XINCREF(trueSelf);
3754 self->substractEqual(a);
3755 Py_XINCREF(trueSelf);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3761 self->substractEqual(aaaa);
3762 Py_XINCREF(trueSelf);
3766 throw INTERP_KERNEL::Exception(msg);
3770 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3772 const char msg[]="Unexpected situation in __mul__ !";
3775 std::vector<int> aa;
3776 DataArrayIntTuple *aaa;
3778 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3783 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3784 ret->applyLin(val,0);
3789 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3790 return DataArrayInt::Multiply(self,aaaa);
3794 return DataArrayInt::Multiply(self,a);
3798 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3799 return DataArrayInt::Multiply(self,aaaa);
3802 throw INTERP_KERNEL::Exception(msg);
3806 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3808 const char msg[]="Unexpected situation in __rmul__ !";
3811 std::vector<int> aa;
3812 DataArrayIntTuple *aaa;
3814 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3820 ret->applyLin(val,0);
3825 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3826 return DataArrayInt::Multiply(self,aaaa);
3830 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3831 return DataArrayInt::Multiply(self,aaaa);
3834 throw INTERP_KERNEL::Exception(msg);
3838 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3840 const char msg[]="Unexpected situation in __imul__ !";
3843 std::vector<int> aa;
3844 DataArrayIntTuple *aaa;
3846 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3851 self->applyLin(val,0);
3852 Py_XINCREF(trueSelf);
3857 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3858 self->multiplyEqual(bb);
3859 Py_XINCREF(trueSelf);
3864 self->multiplyEqual(a);
3865 Py_XINCREF(trueSelf);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3871 self->multiplyEqual(aaaa);
3872 Py_XINCREF(trueSelf);
3876 throw INTERP_KERNEL::Exception(msg);
3880 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3882 const char msg[]="Unexpected situation in __div__ !";
3885 std::vector<int> aa;
3886 DataArrayIntTuple *aaa;
3888 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3893 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3894 ret->applyDivideBy(val);
3899 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3900 return DataArrayInt::Divide(self,aaaa);
3904 return DataArrayInt::Divide(self,a);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3909 return DataArrayInt::Divide(self,aaaa);
3912 throw INTERP_KERNEL::Exception(msg);
3916 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 const char msg[]="Unexpected situation in __rdiv__ !";
3921 std::vector<int> aa;
3922 DataArrayIntTuple *aaa;
3924 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3929 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3935 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3936 return DataArrayInt::Divide(aaaa,self);
3940 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3941 return DataArrayInt::Divide(aaaa,self);
3944 throw INTERP_KERNEL::Exception(msg);
3948 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3950 const char msg[]="Unexpected situation in __idiv__ !";
3953 std::vector<int> aa;
3954 DataArrayIntTuple *aaa;
3956 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3961 self->applyDivideBy(val);
3962 Py_XINCREF(trueSelf);
3967 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3968 self->divideEqual(bb);
3969 Py_XINCREF(trueSelf);
3974 self->divideEqual(a);
3975 Py_XINCREF(trueSelf);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3981 self->divideEqual(aaaa);
3982 Py_XINCREF(trueSelf);
3986 throw INTERP_KERNEL::Exception(msg);
3990 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3992 const char msg[]="Unexpected situation in __mod__ !";
3995 std::vector<int> aa;
3996 DataArrayIntTuple *aaa;
3998 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4003 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4004 ret->applyModulus(val);
4009 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4010 return DataArrayInt::Modulus(self,aaaa);
4014 return DataArrayInt::Modulus(self,a);
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4019 return DataArrayInt::Modulus(self,aaaa);
4022 throw INTERP_KERNEL::Exception(msg);
4026 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4028 const char msg[]="Unexpected situation in __rmod__ !";
4031 std::vector<int> aa;
4032 DataArrayIntTuple *aaa;
4034 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4039 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4040 ret->applyRModulus(val);
4045 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4046 return DataArrayInt::Modulus(aaaa,self);
4050 return DataArrayInt::Modulus(a,self);
4054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4055 return DataArrayInt::Modulus(aaaa,self);
4058 throw INTERP_KERNEL::Exception(msg);
4062 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4064 const char msg[]="Unexpected situation in __imod__ !";
4067 std::vector<int> aa;
4068 DataArrayIntTuple *aaa;
4070 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4075 self->applyModulus(val);
4076 Py_XINCREF(trueSelf);
4081 self->modulusEqual(a);
4082 Py_XINCREF(trueSelf);
4087 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4088 self->modulusEqual(aaaa);
4089 Py_XINCREF(trueSelf);
4093 throw INTERP_KERNEL::Exception(msg);
4097 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4099 const char msg[]="Unexpected situation in __pow__ !";
4102 std::vector<int> aa;
4103 DataArrayIntTuple *aaa;
4105 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4110 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4116 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4117 return DataArrayInt::Pow(self,aaaa);
4121 return DataArrayInt::Pow(self,a);
4125 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4126 return DataArrayInt::Pow(self,aaaa);
4129 throw INTERP_KERNEL::Exception(msg);
4133 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4135 const char msg[]="Unexpected situation in __rpow__ !";
4138 std::vector<int> aa;
4139 DataArrayIntTuple *aaa;
4141 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4146 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4147 ret->applyRPow(val);
4152 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4153 return DataArrayInt::Pow(aaaa,self);
4157 return DataArrayInt::Pow(a,self);
4161 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4162 return DataArrayInt::Pow(aaaa,self);
4165 throw INTERP_KERNEL::Exception(msg);
4169 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4171 const char msg[]="Unexpected situation in __ipow__ !";
4174 std::vector<int> aa;
4175 DataArrayIntTuple *aaa;
4177 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4182 self->applyPow(val);
4183 Py_XINCREF(trueSelf);
4189 Py_XINCREF(trueSelf);
4194 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4195 self->powEqual(aaaa);
4196 Py_XINCREF(trueSelf);
4200 throw INTERP_KERNEL::Exception(msg);
4204 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4206 std::ostringstream oss;
4207 self->reprQuickOverview(oss);
4211 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4213 int szArr,sw,iTypppArr;
4214 std::vector<int> stdvecTyyppArr;
4215 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4216 self->pushBackValsSilent(tmp,tmp+szArr);
4219 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4221 std::vector<int> ret1;
4222 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4223 std::size_t sz=ret0.size();
4224 PyObject *pyRet=PyTuple_New(2);
4225 PyObject *pyRet0=PyList_New((int)sz);
4226 PyObject *pyRet1=PyList_New((int)sz);
4227 for(std::size_t i=0;i<sz;i++)
4229 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4230 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4232 PyTuple_SetItem(pyRet,0,pyRet0);
4233 PyTuple_SetItem(pyRet,1,pyRet1);
4237 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4239 DataArrayInt *ret0=0,*ret1=0;
4240 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4241 PyObject *pyRet=PyTuple_New(2);
4242 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4243 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4249 class DataArrayIntTuple;
4251 class DataArrayIntIterator
4254 DataArrayIntIterator(DataArrayInt *da);
4255 ~DataArrayIntIterator();
4260 DataArrayIntTuple *ret=self->nextt();
4262 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4265 PyErr_SetString(PyExc_StopIteration,"No more data.");
4272 class DataArrayIntTuple
4275 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4276 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4279 std::string __str__() const throw(INTERP_KERNEL::Exception)
4281 return self->repr();
4284 int __int__() const throw(INTERP_KERNEL::Exception)
4286 return self->intValue();
4289 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4291 return self->buildDAInt(1,self->getNumberOfCompo());
4294 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4296 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4297 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4298 Py_XINCREF(trueSelf);
4302 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4304 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4305 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4306 Py_XINCREF(trueSelf);
4310 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4312 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4313 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4314 Py_XINCREF(trueSelf);
4318 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4321 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4322 Py_XINCREF(trueSelf);
4326 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4328 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4329 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4330 Py_XINCREF(trueSelf);
4334 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4336 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4339 std::vector<int> multiVal;
4340 std::pair<int, std::pair<int,int> > slic;
4341 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4342 const int *pt=self->getConstPointer();
4343 int nbc=self->getNumberOfCompo();
4344 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4351 std::ostringstream oss;
4352 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4353 throw INTERP_KERNEL::Exception(oss.str().c_str());
4356 return PyInt_FromLong(pt[singleVal]);
4360 return PyInt_FromLong(pt[nbc+singleVal]);
4363 std::ostringstream oss;
4364 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4365 throw INTERP_KERNEL::Exception(oss.str().c_str());
4371 PyObject *t=PyTuple_New(multiVal.size());
4372 for(int j=0;j<(int)multiVal.size();j++)
4374 int cid=multiVal[j];
4377 std::ostringstream oss;
4378 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4379 throw INTERP_KERNEL::Exception(oss.str().c_str());
4381 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4387 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4388 PyObject *t=PyTuple_New(sz);
4389 for(int j=0;j<sz;j++)
4390 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4394 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4398 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4400 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4401 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4404 std::vector<int> multiValV;
4405 std::pair<int, std::pair<int,int> > slicV;
4406 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4407 int nbc=self->getNumberOfCompo();
4408 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4410 std::vector<int> multiVal;
4411 std::pair<int, std::pair<int,int> > slic;
4412 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4413 int *pt=self->getPointer();
4414 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4421 std::ostringstream oss;
4422 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4423 throw INTERP_KERNEL::Exception(oss.str().c_str());
4429 pt[singleVal]=singleValV;
4434 if(multiValV.size()!=1)
4436 std::ostringstream oss;
4437 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4438 throw INTERP_KERNEL::Exception(oss.str().c_str());
4440 pt[singleVal]=multiValV[0];
4445 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4449 throw INTERP_KERNEL::Exception(msg);
4458 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4462 std::ostringstream oss;
4463 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4464 throw INTERP_KERNEL::Exception(oss.str().c_str());
4472 if(multiVal.size()!=multiValV.size())
4474 std::ostringstream oss;
4475 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4476 throw INTERP_KERNEL::Exception(oss.str().c_str());
4478 for(int i=0;i<(int)multiVal.size();i++)
4480 int pos=multiVal[i];
4483 std::ostringstream oss;
4484 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4485 throw INTERP_KERNEL::Exception(oss.str().c_str());
4487 pt[multiVal[i]]=multiValV[i];
4493 const int *ptV=daIntTyyppV->getConstPointer();
4494 if(nbc>daIntTyyppV->getNumberOfCompo())
4496 std::ostringstream oss;
4497 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4498 throw INTERP_KERNEL::Exception(oss.str().c_str());
4500 std::copy(ptV,ptV+nbc,pt);
4504 throw INTERP_KERNEL::Exception(msg);
4509 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4514 for(int j=0;j<sz;j++)
4515 pt[slic.first+j*slic.second.second]=singleValV;
4520 if(sz!=(int)multiValV.size())
4522 std::ostringstream oss;
4523 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4524 throw INTERP_KERNEL::Exception(oss.str().c_str());
4526 for(int j=0;j<sz;j++)
4527 pt[slic.first+j*slic.second.second]=multiValV[j];
4532 const int *ptV=daIntTyyppV->getConstPointer();
4533 if(sz>daIntTyyppV->getNumberOfCompo())
4535 std::ostringstream oss;
4536 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4537 throw INTERP_KERNEL::Exception(oss.str().c_str());
4539 for(int j=0;j<sz;j++)
4540 pt[slic.first+j*slic.second.second]=ptV[j];
4544 throw INTERP_KERNEL::Exception(msg);
4548 throw INTERP_KERNEL::Exception(msg);
4554 class DataArrayChar : public DataArray
4557 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4558 virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
4559 int getHashCode() const throw(INTERP_KERNEL::Exception);
4560 bool empty() const throw(INTERP_KERNEL::Exception);
4561 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4562 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4563 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4564 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4565 char popBackSilent() throw(INTERP_KERNEL::Exception);
4566 void pack() const throw(INTERP_KERNEL::Exception);
4567 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4568 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4569 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4570 void reverse() throw(INTERP_KERNEL::Exception);
4571 void fillWithZero() throw(INTERP_KERNEL::Exception);
4572 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4573 std::string repr() const throw(INTERP_KERNEL::Exception);
4574 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4575 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4576 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4577 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4578 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4579 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4580 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4581 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4582 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4583 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4584 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4585 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4586 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4587 char front() const throw(INTERP_KERNEL::Exception);
4588 char back() const throw(INTERP_KERNEL::Exception);
4589 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4590 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4591 char *getPointer() throw(INTERP_KERNEL::Exception);
4592 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4593 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4594 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4595 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4596 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4597 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4598 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4599 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4600 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4601 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4602 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4605 int __len__() const throw(INTERP_KERNEL::Exception)
4607 if(self->isAllocated())
4609 return self->getNumberOfTuples();
4613 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4617 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4620 bool ret0=self->isEqualIfNotWhy(other,ret1);
4621 PyObject *ret=PyTuple_New(2);
4622 PyObject *ret0Py=ret0?Py_True:Py_False;
4624 PyTuple_SetItem(ret,0,ret0Py);
4625 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4629 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4632 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4633 if (!SWIG_IsOK(res1))
4636 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4637 if(size!=self->getNumberOfTuples())
4639 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4641 return self->renumber(tmp);
4645 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4647 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4648 da2->checkAllocated();
4649 int size=self->getNumberOfTuples();
4650 if(size!=self->getNumberOfTuples())
4652 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4654 return self->renumber(da2->getConstPointer());
4658 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4661 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4662 if (!SWIG_IsOK(res1))
4665 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4666 if(size!=self->getNumberOfTuples())
4668 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4670 return self->renumberR(tmp);
4674 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4676 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4677 da2->checkAllocated();
4678 int size=self->getNumberOfTuples();
4679 if(size!=self->getNumberOfTuples())
4681 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4683 return self->renumberR(da2->getConstPointer());
4687 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4690 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4691 if (!SWIG_IsOK(res1))
4694 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4695 if(size!=self->getNumberOfTuples())
4697 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4699 return self->renumberAndReduce(tmp,newNbOfTuple);
4703 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4705 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4706 da2->checkAllocated();
4707 int size=self->getNumberOfTuples();
4708 if(size!=self->getNumberOfTuples())
4710 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4712 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4716 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4719 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4720 if (!SWIG_IsOK(res1))
4723 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4724 return self->selectByTupleIdSafe(tmp,tmp+size);
4728 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4730 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4731 da2->checkAllocated();
4732 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4736 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4738 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4739 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4740 return DataArrayChar::Aggregate(tmp);
4743 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4745 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4746 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4747 return DataArrayChar::Meld(tmp);
4752 class DataArrayByteIterator;
4754 class DataArrayByte : public DataArrayChar
4757 static DataArrayByte *New();
4758 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4759 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4760 char byteValue() const throw(INTERP_KERNEL::Exception);
4763 DataArrayByte() throw(INTERP_KERNEL::Exception)
4765 return DataArrayByte::New();
4768 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4770 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) !";
4771 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4775 if(PyInt_Check(nbOfTuples))
4777 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4779 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4782 if(PyInt_Check(nbOfComp))
4783 {//DataArrayByte.New([1,3,4,5],2,2)
4784 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4786 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4787 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4788 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4789 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4793 throw INTERP_KERNEL::Exception(msg);
4796 {//DataArrayByte.New([1,3,4],3)
4797 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4799 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4800 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4805 throw INTERP_KERNEL::Exception(msg);
4808 {// DataArrayByte.New([1,3,4])
4809 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4810 int tmpp1=-1,tmpp2=-1;
4811 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4812 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4816 else if(PyInt_Check(elt0))
4818 int nbOfTuples1=PyInt_AS_LONG(elt0);
4820 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4825 if(PyInt_Check(nbOfTuples))
4826 {//DataArrayByte.New(5,2)
4827 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4829 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4830 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4831 ret->alloc(nbOfTuples1,nbOfCompo);
4835 throw INTERP_KERNEL::Exception(msg);
4838 throw INTERP_KERNEL::Exception(msg);
4841 {//DataArrayByte.New(5)
4842 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4843 ret->alloc(nbOfTuples1,1);
4848 throw INTERP_KERNEL::Exception(msg);
4851 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4853 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4856 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4858 std::ostringstream oss;
4859 self->reprQuickOverview(oss);
4863 int __int__() const throw(INTERP_KERNEL::Exception)
4865 return (int) self->byteValue();
4868 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4870 return self->iterator();
4873 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4875 return (int)self->getIJ(tupleId,compoId);
4878 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4880 return (int)self->getIJSafe(tupleId,compoId);
4883 std::string __str__() const throw(INTERP_KERNEL::Exception)
4885 return self->repr();
4888 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4890 const char *vals=self->getConstPointer();
4891 int nbOfComp=self->getNumberOfComponents();
4892 int nbOfTuples=self->getNumberOfTuples();
4893 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4896 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4899 int ival=-1; std::vector<int> ivval;
4900 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4901 std::vector<char> vals(sz);
4902 std::copy(pt,pt+sz,vals.begin());
4903 return self->presenceOfTuple(vals);
4906 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4909 int ival=-1; std::vector<int> ivval;
4910 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4911 std::vector<char> vals2(sz);
4912 std::copy(pt,pt+sz,vals2.begin());
4913 return self->presenceOfValue(vals2);
4916 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4919 int ival=-1; std::vector<int> ivval;
4920 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4921 std::vector<char> vals2(sz);
4922 std::copy(pt,pt+sz,vals2.begin());
4923 return self->locateValue(vals2);
4926 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4929 int ival=-1; std::vector<int> ivval;
4930 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4931 std::vector<char> vals(sz);
4932 std::copy(pt,pt+sz,vals.begin());
4933 return self->locateTuple(vals);
4936 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4939 int ival=-1; std::vector<int> ivval;
4940 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4941 std::vector<char> vals(sz);
4942 std::copy(pt,pt+sz,vals.begin());
4943 return self->search(vals);
4946 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4948 int sz=self->getNumberOfComponents();
4949 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4950 self->getTuple(tupleId,tmp);
4951 PyObject *ret=PyTuple_New(sz);
4952 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4956 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4959 int r1=(int)self->getMaxValue(tmp);
4960 PyObject *ret=PyTuple_New(2);
4961 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4962 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4966 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4969 int r1=(int)self->getMinValue(tmp);
4970 PyObject *ret=PyTuple_New(2);
4971 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4972 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4976 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4978 int nbOfCompo=self->getNumberOfComponents();
4983 if(PyInt_Check(obj))
4985 int val=(int)PyInt_AS_LONG(obj);
4986 return self->locateValue(val);
4989 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4992 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4996 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4998 int nbOfCompo=self->getNumberOfComponents();
5005 if(PyInt_Check(obj))
5007 int val=(int)PyInt_AS_LONG(obj);
5008 return self->presenceOfValue(val);
5011 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5014 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5020 class DataArrayByteTuple;
5022 class DataArrayByteIterator
5025 DataArrayByteIterator(DataArrayByte *da);
5026 ~DataArrayByteIterator();
5029 class DataArrayByteTuple
5032 std::string repr() const throw(INTERP_KERNEL::Exception);
5033 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5036 std::string __str__() const throw(INTERP_KERNEL::Exception)
5038 return self->repr();
5041 char __int__() const throw(INTERP_KERNEL::Exception)
5043 return self->byteValue();
5046 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5048 return self->buildDAByte(1,self->getNumberOfCompo());
5053 class DataArrayAsciiCharIterator;
5055 class DataArrayAsciiChar : public DataArrayChar
5058 static DataArrayAsciiChar *New();
5059 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5060 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5061 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5064 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5066 return DataArrayAsciiChar::New();
5069 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5071 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) !";
5072 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5076 if(PyInt_Check(nbOfTuples))
5078 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5080 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5083 if(PyInt_Check(nbOfComp))
5084 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5085 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5087 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5088 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5089 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5090 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5094 throw INTERP_KERNEL::Exception(msg);
5097 {//DataArrayAsciiChar.New([1,3,4],3)
5098 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5100 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5101 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5105 else if(PyString_Check(nbOfTuples))
5107 if(PyString_Size(nbOfTuples)!=1)
5108 throw INTERP_KERNEL::Exception(msg);
5109 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5110 std::vector<std::string> tmp;
5111 if(fillStringVector(elt0,tmp))
5112 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5114 throw INTERP_KERNEL::Exception(msg);
5117 throw INTERP_KERNEL::Exception(msg);
5121 std::vector<std::string> tmmp;
5122 if(fillStringVector(elt0,tmmp))
5123 //DataArrayAsciiChar.New(["abc","de","fghi"])
5124 return DataArrayAsciiChar::New(tmmp,' ');
5127 // DataArrayAsciiChar.New([1,3,4])
5128 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5129 int tmpp1=-1,tmpp2=-1;
5130 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5131 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5136 else if(PyInt_Check(elt0))
5138 int nbOfTuples1=PyInt_AS_LONG(elt0);
5140 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5145 if(PyInt_Check(nbOfTuples))
5146 {//DataArrayAsciiChar.New(5,2)
5147 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5149 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5150 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5151 ret->alloc(nbOfTuples1,nbOfCompo);
5155 throw INTERP_KERNEL::Exception(msg);
5158 throw INTERP_KERNEL::Exception(msg);
5161 {//DataArrayAsciiChar.New(5)
5162 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5163 ret->alloc(nbOfTuples1,1);
5168 throw INTERP_KERNEL::Exception(msg);
5171 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5173 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5176 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5178 std::ostringstream oss;
5179 self->reprQuickOverview(oss);
5183 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5185 return self->iterator();
5188 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5190 char tmp[2]; tmp[1]='\0';
5191 tmp[0]=self->getIJ(tupleId,compoId);
5192 return std::string(tmp);
5195 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5197 char tmp[2]; tmp[1]='\0';
5198 tmp[0]=self->getIJSafe(tupleId,compoId);
5199 return std::string(tmp);
5202 std::string __str__() const throw(INTERP_KERNEL::Exception)
5204 return self->repr();
5207 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5209 const char *vals=self->getConstPointer();
5210 int nbOfComp=self->getNumberOfComponents();
5211 int nbOfTuples=self->getNumberOfTuples();
5212 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5215 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5217 if(PyString_Check(tupl))
5219 Py_ssize_t sz=PyString_Size(tupl);
5220 std::vector<char> vals(sz);
5221 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5222 return self->presenceOfTuple(vals);
5225 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5228 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5230 if(PyString_Check(vals))
5232 Py_ssize_t sz=PyString_Size(vals);
5233 std::vector<char> vals2(sz);
5234 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5235 return self->presenceOfValue(vals2);
5238 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5241 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5243 if(PyString_Check(vals))
5245 Py_ssize_t sz=PyString_Size(vals);
5246 std::vector<char> vals2(sz);
5247 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5248 return self->locateValue(vals2);
5251 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5254 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5256 if(PyString_Check(tupl))
5258 Py_ssize_t sz=PyString_Size(tupl);
5259 std::vector<char> vals(sz);
5260 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5261 return self->locateTuple(vals);
5264 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5267 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5269 if(PyString_Check(strOrListOfInt))
5271 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5272 std::vector<char> vals(sz);
5273 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5274 return self->search(vals);
5277 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5280 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5282 int sz=self->getNumberOfComponents();
5283 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5284 self->getTuple(tupleId,tmp);
5285 return PyString_FromString(tmp);
5288 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5291 char tmp2[2]; tmp2[1]='\0';
5292 tmp2[0]=self->getMaxValue(tmp);
5293 PyObject *ret=PyTuple_New(2);
5294 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5295 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5299 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5302 char tmp2[2]; tmp2[1]='\0';
5303 tmp2[0]=self->getMinValue(tmp);
5304 PyObject *ret=PyTuple_New(2);
5305 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5306 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5310 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5312 int nbOfCompo=self->getNumberOfComponents();
5317 if(PyString_Check(obj))
5319 Py_ssize_t sz=PyString_Size(obj);
5320 char *pt=PyString_AsString(obj);
5322 return self->locateValue(pt[0]);
5324 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5327 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5330 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5334 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5336 int nbOfCompo=self->getNumberOfComponents();
5343 if(PyString_Check(obj))
5345 Py_ssize_t sz=PyString_Size(obj);
5346 char *pt=PyString_AsString(obj);
5348 return self->presenceOfValue(pt[0]);
5350 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5353 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5356 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5360 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5363 std::vector<int> stdvecTyyppArr;
5364 std::pair<int, std::pair<int,int> > sTyyppArr;
5365 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5366 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5370 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5372 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5374 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5376 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5378 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5382 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5384 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.";
5386 std::vector<int> stdvecTyyppArr;
5387 std::pair<int, std::pair<int,int> > sTyyppArr;
5388 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5389 int nbOfCompo=self->getNumberOfComponents();
5390 int nbOfTuples=self->getNumberOfTuples();
5391 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5393 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5394 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5403 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5409 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5410 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5413 //value vector<string>
5416 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5417 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5420 //value DataArrayChar
5423 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5427 throw INTERP_KERNEL::Exception(msg);
5431 {//obj list-tuple[int]
5437 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5443 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5444 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5447 //value vector<string>
5450 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5451 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5454 //value DataArrayChar
5457 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5461 throw INTERP_KERNEL::Exception(msg);
5472 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5478 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5479 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5482 //value vector<string>
5485 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5486 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5489 //value DataArrayChar
5492 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5496 throw INTERP_KERNEL::Exception(msg);
5507 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5513 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5514 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5517 //value vector<string>
5520 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5521 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5524 //value DataArrayChar
5527 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5531 throw INTERP_KERNEL::Exception(msg);
5536 throw INTERP_KERNEL::Exception(msg);
5542 class DataArrayAsciiCharTuple;
5544 class DataArrayAsciiCharIterator
5547 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5548 ~DataArrayAsciiCharIterator();
5553 DataArrayAsciiCharTuple *ret=self->nextt();
5555 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5558 PyErr_SetString(PyExc_StopIteration,"No more data.");
5565 class DataArrayAsciiCharTuple
5568 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5569 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5572 std::string __str__() const throw(INTERP_KERNEL::Exception)
5574 return self->repr();
5577 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5579 return self->buildDAAsciiChar(1,self->getNumberOfCompo());