1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
23 class DataArray : public RefCountObject, public TimeLabel
26 void setName(const char *name);
27 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
28 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
29 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
30 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
31 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
32 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
33 std::string getName() const;
34 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
35 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
36 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
37 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
38 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
39 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
40 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
41 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
42 int getNumberOfComponents() const;
43 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
44 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
45 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
46 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
47 virtual void desallocate() throw(INTERP_KERNEL::Exception);
48 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
49 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
50 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
51 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
52 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
53 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
54 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
55 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
56 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
57 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
58 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
59 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
60 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
61 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
62 void updateTime() const;
65 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
67 const std::vector<std::string>& comps=self->getInfoOnComponents();
68 PyObject *ret=PyList_New((int)comps.size());
69 for(int i=0;i<(int)comps.size();i++)
70 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
74 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
77 convertPyToNewIntArr3(li,tmp);
78 self->copyPartOfStringInfoFrom(other,tmp);
81 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
84 convertPyToNewIntArr3(li,tmp);
85 self->copyPartOfStringInfoFrom2(tmp,other);
88 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
91 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
95 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
96 if(size!=self->getNumberOfTuples())
98 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
100 self->renumberInPlace(tmp);
104 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
106 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
107 da2->checkAllocated();
108 int size=self->getNumberOfTuples();
109 if(size!=self->getNumberOfTuples())
111 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
113 self->renumberInPlace(da2->getConstPointer());
117 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
120 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
121 if (!SWIG_IsOK(res1))
124 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
125 if(size!=self->getNumberOfTuples())
127 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
129 self->renumberInPlaceR(tmp);
133 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
135 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
136 da2->checkAllocated();
137 int size=self->getNumberOfTuples();
138 if(size!=self->getNumberOfTuples())
140 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
142 self->renumberInPlaceR(da2->getConstPointer());
146 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
147 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
149 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
150 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
151 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
152 DataArrayInt *tuplesSelecPtr2=0;
155 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
157 throw INTERP_KERNEL::Exception(msg);
159 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
162 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
164 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
165 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
168 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
170 std::vector<std::pair<int,int> > ranges;
171 convertPyToVectorPairInt(li,ranges);
172 return self->selectByTupleRanges(ranges);
175 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
177 std::vector<int> tmp;
178 convertPyToNewIntArr3(li,tmp);
179 DataArray *ret=self->keepSelectedComponents(tmp);
180 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
183 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
185 if(!PySlice_Check(slic))
186 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
187 Py_ssize_t strt=2,stp=2,step=2;
188 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
189 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
190 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
191 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
192 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 !");
194 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
195 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
198 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
200 if(!PySlice_Check(slic))
201 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
202 Py_ssize_t strt=2,stp=2,step=2;
203 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
204 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
205 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
207 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
208 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
211 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
213 if(!PySlice_Check(slic))
214 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
215 Py_ssize_t strt=2,stp=2,step=2;
216 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
217 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
218 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
219 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
220 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
221 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
224 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
226 if(!PySlice_Check(slic))
227 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
228 Py_ssize_t strt=2,stp=2,step=2;
229 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
230 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
231 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
232 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
233 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
234 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
237 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
239 if(!PySlice_Check(slic))
240 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
241 Py_ssize_t strt=2,stp=2,step=2;
242 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
243 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
244 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
245 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
248 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
250 if(!PySlice_Check(slic))
251 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
252 Py_ssize_t strt=2,stp=2,step=2;
253 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
254 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
255 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
256 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
262 class DataArrayDoubleIterator;
264 class DataArrayDouble : public DataArray
267 static DataArrayDouble *New();
268 double doubleValue() const throw(INTERP_KERNEL::Exception);
269 bool empty() 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 *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2293 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2294 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2295 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2296 int popBackSilent() throw(INTERP_KERNEL::Exception);
2297 void pack() const throw(INTERP_KERNEL::Exception);
2298 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2299 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2300 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2301 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2302 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2303 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2304 void reverse() throw(INTERP_KERNEL::Exception);
2305 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2306 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2307 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2308 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2309 void fillWithZero() throw(INTERP_KERNEL::Exception);
2310 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2311 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2312 std::string repr() const throw(INTERP_KERNEL::Exception);
2313 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2317 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2318 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2319 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2320 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2321 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2323 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2324 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2325 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2326 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
2327 void transpose() throw(INTERP_KERNEL::Exception);
2328 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2329 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2330 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2331 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2332 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2333 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2334 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2335 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2336 int front() const throw(INTERP_KERNEL::Exception);
2337 int back() const throw(INTERP_KERNEL::Exception);
2338 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2339 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2340 int *getPointer() throw(INTERP_KERNEL::Exception);
2341 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2342 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2343 const int *begin() const throw(INTERP_KERNEL::Exception);
2344 const int *end() const throw(INTERP_KERNEL::Exception);
2345 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2346 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2347 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2348 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2349 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2350 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2351 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2352 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2353 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2354 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2355 int count(int value) const throw(INTERP_KERNEL::Exception);
2356 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2357 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2358 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2359 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2360 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2361 void abs() throw(INTERP_KERNEL::Exception);
2362 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2363 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2364 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2365 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2366 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2367 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2368 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2369 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2370 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2372 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2373 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2375 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2377 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2385 void computeOffsets() throw(INTERP_KERNEL::Exception);
2386 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2387 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2392 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2393 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2394 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2395 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2396 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2397 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2398 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2399 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2400 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2401 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2402 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2403 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2405 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2408 DataArrayInt() throw(INTERP_KERNEL::Exception)
2410 return DataArrayInt::New();
2413 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2415 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)";
2416 std::string msg(msgBase);
2418 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2421 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2425 if(PyInt_Check(nbOfTuples))
2427 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2429 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2432 if(PyInt_Check(nbOfComp))
2433 {//DataArrayInt.New([1,3,4,5],2,2)
2434 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2436 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2437 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2438 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2439 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2443 throw INTERP_KERNEL::Exception(msg.c_str());
2446 {//DataArrayInt.New([1,3,4],3)
2447 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2449 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2450 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2455 throw INTERP_KERNEL::Exception(msg.c_str());
2458 {// DataArrayInt.New([1,3,4])
2459 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2460 int tmpp1=-1,tmpp2=-1;
2461 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2462 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2466 else if(PyInt_Check(elt0))
2468 int nbOfTuples1=PyInt_AS_LONG(elt0);
2470 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2475 if(PyInt_Check(nbOfTuples))
2476 {//DataArrayInt.New(5,2)
2477 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2479 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2480 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2481 ret->alloc(nbOfTuples1,nbOfCompo);
2485 throw INTERP_KERNEL::Exception(msg.c_str());
2488 throw INTERP_KERNEL::Exception(msg.c_str());
2491 {//DataArrayInt.New(5)
2492 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2493 ret->alloc(nbOfTuples1,1);
2498 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2499 {//DataArrayInt.New(numpyArray)
2500 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2504 throw INTERP_KERNEL::Exception(msg.c_str());
2507 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2509 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2512 std::string __str__() const throw(INTERP_KERNEL::Exception)
2514 return self->repr();
2517 int __len__() const throw(INTERP_KERNEL::Exception)
2519 if(self->isAllocated())
2521 return self->getNumberOfTuples();
2525 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2529 int __int__() const throw(INTERP_KERNEL::Exception)
2531 return self->intValue();
2534 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2536 return self->iterator();
2539 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2541 int sz=self->getNumberOfComponents();
2542 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2543 self->accumulate(tmp);
2544 return convertIntArrToPyList(tmp,sz);
2547 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2550 std::vector<int> val2;
2551 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2552 return self->accumulatePerChunck(bg,bg+sz);
2555 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2557 int newNbOfTuples=-1;
2558 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2559 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2560 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2561 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2562 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2563 PyObject *ret=PyTuple_New(2);
2564 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2565 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2569 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2571 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 !";
2572 if(PyList_Check(li) || PyTuple_Check(li))
2576 if(PyInt_Check(nbOfTuples))
2578 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2580 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2583 if(PyInt_Check(nbOfComp))
2584 {//DataArrayInt.setValues([1,3,4,5],2,2)
2585 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2587 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2588 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2589 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2592 throw INTERP_KERNEL::Exception(msg);
2595 {//DataArrayInt.setValues([1,3,4],3)
2597 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2598 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2602 throw INTERP_KERNEL::Exception(msg);
2605 {// DataArrayInt.setValues([1,3,4])
2606 int tmpp1=-1,tmpp2=-1;
2607 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2608 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2612 throw INTERP_KERNEL::Exception(msg);
2615 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2617 const int *vals=self->getConstPointer();
2618 return convertIntArrToPyList(vals,self->getNbOfElems());
2622 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2624 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2628 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2631 bool ret0=self->isEqualIfNotWhy(other,ret1);
2632 PyObject *ret=PyTuple_New(2);
2633 PyObject *ret0Py=ret0?Py_True:Py_False;
2635 PyTuple_SetItem(ret,0,ret0Py);
2636 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2640 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2642 const int *vals=self->getConstPointer();
2643 int nbOfComp=self->getNumberOfComponents();
2644 int nbOfTuples=self->getNumberOfTuples();
2645 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2648 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2650 std::vector<const DataArrayInt *> groups;
2651 std::vector< std::vector<int> > fidsOfGroups;
2652 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2653 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2654 PyObject *ret = PyList_New(2);
2655 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2656 int sz=fidsOfGroups.size();
2657 PyObject *ret1 = PyList_New(sz);
2658 for(int i=0;i<sz;i++)
2659 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2660 PyList_SetItem(ret,1,ret1);
2664 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2667 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2668 if (!SWIG_IsOK(res1))
2671 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2672 self->transformWithIndArr(tmp,tmp+size);
2676 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2677 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2681 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2685 std::vector<int> multiVal;
2686 std::pair<int, std::pair<int,int> > slic;
2687 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2688 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2692 return self->getIdsEqualList(&singleVal,&singleVal+1);
2694 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2696 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2698 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2702 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2706 std::vector<int> multiVal;
2707 std::pair<int, std::pair<int,int> > slic;
2708 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2709 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2713 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2715 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2717 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2719 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2723 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2725 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2727 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2728 if (!SWIG_IsOK(res1))
2731 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2732 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2736 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2738 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2739 da2->checkAllocated();
2740 int size=self->getNumberOfTuples();
2741 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2743 PyObject *ret = PyList_New(3);
2744 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2745 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2746 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2750 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2753 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2754 if (!SWIG_IsOK(res1))
2757 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2758 return self->transformWithIndArrR(tmp,tmp+size);
2762 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2763 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2767 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2770 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2771 if (!SWIG_IsOK(res1))
2774 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2775 if(size!=self->getNumberOfTuples())
2777 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2779 return self->renumberAndReduce(tmp,newNbOfTuple);
2783 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2785 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2786 da2->checkAllocated();
2787 int size=self->getNumberOfTuples();
2788 if(size!=self->getNumberOfTuples())
2790 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2792 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2796 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2799 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2800 if (!SWIG_IsOK(res1))
2803 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2804 if(size!=self->getNumberOfTuples())
2806 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2808 return self->renumber(tmp);
2812 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2814 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2815 da2->checkAllocated();
2816 int size=self->getNumberOfTuples();
2817 if(size!=self->getNumberOfTuples())
2819 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2821 return self->renumber(da2->getConstPointer());
2825 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2828 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2829 if (!SWIG_IsOK(res1))
2832 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2833 if(size!=self->getNumberOfTuples())
2835 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2837 return self->renumberR(tmp);
2841 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2843 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2844 da2->checkAllocated();
2845 int size=self->getNumberOfTuples();
2846 if(size!=self->getNumberOfTuples())
2848 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2850 return self->renumberR(da2->getConstPointer());
2854 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2857 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2858 if (!SWIG_IsOK(res1))
2861 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2862 return self->selectByTupleId(tmp,tmp+size);
2866 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2868 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2869 da2->checkAllocated();
2870 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2874 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2877 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2878 if (!SWIG_IsOK(res1))
2881 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2882 return self->selectByTupleIdSafe(tmp,tmp+size);
2886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2888 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2889 da2->checkAllocated();
2890 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2894 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2896 std::vector<int> tmp;
2897 convertPyToNewIntArr3(li,tmp);
2898 self->setSelectedComponents(a,tmp);
2901 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2903 int sz=self->getNumberOfComponents();
2904 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2905 self->getTuple(tupleId,tmp);
2906 return convertIntArrToPyList(tmp,sz);
2909 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2911 DataArrayInt *arr=0;
2912 DataArrayInt *arrI=0;
2913 self->changeSurjectiveFormat(targetNb,arr,arrI);
2914 PyObject *res = PyList_New(2);
2915 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2916 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2920 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2922 std::vector<const DataArrayInt *> tmp;
2923 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2924 return DataArrayInt::Meld(tmp);
2927 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2929 std::vector<const DataArrayInt *> tmp;
2930 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2931 return DataArrayInt::Aggregate(tmp);
2934 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2936 std::vector<const DataArrayInt *> tmp;
2937 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2938 return DataArrayInt::AggregateIndexes(tmp);
2941 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2943 std::vector<const DataArrayInt *> tmp;
2944 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2945 return DataArrayInt::BuildUnion(tmp);
2948 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2950 std::vector<const DataArrayInt *> tmp;
2951 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2952 return DataArrayInt::BuildIntersection(tmp);
2955 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2958 int r1=self->getMaxValue(tmp);
2959 PyObject *ret=PyTuple_New(2);
2960 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2961 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2965 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2968 int r1=self->getMinValue(tmp);
2969 PyObject *ret=PyTuple_New(2);
2970 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2971 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2975 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2977 int nbOfCompo=self->getNumberOfComponents();
2982 if(PyInt_Check(obj))
2984 int val=(int)PyInt_AS_LONG(obj);
2985 return self->locateValue(val);
2988 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2992 std::vector<int> arr;
2993 convertPyToNewIntArr3(obj,arr);
2994 return self->locateTuple(arr);
2999 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3001 int nbOfCompo=self->getNumberOfComponents();
3008 if(PyInt_Check(obj))
3010 int val=(int)PyInt_AS_LONG(obj);
3011 return self->presenceOfValue(val);
3014 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3018 std::vector<int> arr;
3019 convertPyToNewIntArr3(obj,arr);
3020 return self->presenceOfTuple(arr);
3025 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3027 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3028 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3029 self->checkAllocated();
3030 int nbOfTuples=self->getNumberOfTuples();
3031 int nbOfComponents=self->getNumberOfComponents();
3033 std::vector<int> vt1,vc1;
3034 std::pair<int, std::pair<int,int> > pt1,pc1;
3035 DataArrayInt *dt1=0,*dc1=0;
3037 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3038 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3043 if(nbOfComponents==1)
3044 return PyInt_FromLong(self->getIJSafe(it1,0));
3045 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3048 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3050 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3052 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3054 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3057 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3058 std::vector<int> v2(1,ic1);
3059 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3063 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3064 std::vector<int> v2(1,ic1);
3065 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3069 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3070 std::vector<int> v2(1,ic1);
3071 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3075 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3076 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3080 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3081 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3085 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3086 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3090 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3091 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3095 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3096 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3097 std::vector<int> v2(nbOfComp);
3098 for(int i=0;i<nbOfComp;i++)
3099 v2[i]=pc1.first+i*pc1.second.second;
3100 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3104 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3105 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3106 std::vector<int> v2(nbOfComp);
3107 for(int i=0;i<nbOfComp;i++)
3108 v2[i]=pc1.first+i*pc1.second.second;
3109 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3113 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3114 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3115 std::vector<int> v2(nbOfComp);
3116 for(int i=0;i<nbOfComp;i++)
3117 v2[i]=pc1.first+i*pc1.second.second;
3118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3122 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3123 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3124 std::vector<int> v2(nbOfComp);
3125 for(int i=0;i<nbOfComp;i++)
3126 v2[i]=pc1.first+i*pc1.second.second;
3127 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3130 throw INTERP_KERNEL::Exception(msg);
3134 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3136 self->checkAllocated();
3137 const char msg[]="Unexpected situation in __setitem__ !";
3138 int nbOfTuples=self->getNumberOfTuples();
3139 int nbOfComponents=self->getNumberOfComponents();
3142 std::vector<int> v1;
3144 DataArrayIntTuple *dd1=0;
3145 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3147 std::vector<int> vt1,vc1;
3148 std::pair<int, std::pair<int,int> > pt1,pc1;
3149 DataArrayInt *dt1=0,*dc1=0;
3150 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3151 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3159 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3162 tmp=DataArrayInt::New();
3163 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3164 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3167 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3170 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3171 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3174 throw INTERP_KERNEL::Exception(msg);
3183 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3186 tmp=DataArrayInt::New();
3187 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3188 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3191 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3194 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3195 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3198 throw INTERP_KERNEL::Exception(msg);
3207 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3210 tmp=DataArrayInt::New();
3211 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3212 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3215 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3218 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3219 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3222 throw INTERP_KERNEL::Exception(msg);
3231 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3234 tmp=DataArrayInt::New();
3235 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3236 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3239 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3242 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3243 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3246 throw INTERP_KERNEL::Exception(msg);
3255 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3258 tmp=DataArrayInt::New();
3259 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3260 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3263 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3266 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3267 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3270 throw INTERP_KERNEL::Exception(msg);
3279 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3282 tmp=DataArrayInt::New();
3283 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3284 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3287 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3290 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3291 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3294 throw INTERP_KERNEL::Exception(msg);
3303 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3306 tmp=DataArrayInt::New();
3307 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3308 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3311 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3314 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3315 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3318 throw INTERP_KERNEL::Exception(msg);
3327 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3330 tmp=DataArrayInt::New();
3331 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3332 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3335 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3338 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3339 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3342 throw INTERP_KERNEL::Exception(msg);
3351 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3354 tmp=DataArrayInt::New();
3355 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3356 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3359 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3362 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3363 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3366 throw INTERP_KERNEL::Exception(msg);
3375 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3378 tmp=DataArrayInt::New();
3379 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3380 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3383 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3386 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3387 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3390 throw INTERP_KERNEL::Exception(msg);
3399 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3402 tmp=DataArrayInt::New();
3403 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3404 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3407 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3410 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3411 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3414 throw INTERP_KERNEL::Exception(msg);
3423 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3426 tmp=DataArrayInt::New();
3427 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3428 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3431 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3434 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3435 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3438 throw INTERP_KERNEL::Exception(msg);
3447 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3450 tmp=DataArrayInt::New();
3451 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3452 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3455 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3458 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3459 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3462 throw INTERP_KERNEL::Exception(msg);
3471 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3474 tmp=DataArrayInt::New();
3475 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3476 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3479 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3482 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3483 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3486 throw INTERP_KERNEL::Exception(msg);
3495 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3498 tmp=DataArrayInt::New();
3499 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3500 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3503 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3506 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3507 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3510 throw INTERP_KERNEL::Exception(msg);
3519 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3522 tmp=DataArrayInt::New();
3523 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3524 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3527 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3530 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3531 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3534 throw INTERP_KERNEL::Exception(msg);
3539 throw INTERP_KERNEL::Exception(msg);
3544 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3546 return self->negate();
3549 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3551 const char msg[]="Unexpected situation in __add__ !";
3554 std::vector<int> aa;
3555 DataArrayIntTuple *aaa;
3557 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3562 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3563 ret->applyLin(1,val);
3568 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3569 return DataArrayInt::Add(self,aaaa);
3573 return DataArrayInt::Add(self,a);
3577 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3578 return DataArrayInt::Add(self,aaaa);
3581 throw INTERP_KERNEL::Exception(msg);
3585 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3587 const char msg[]="Unexpected situation in __radd__ !";
3590 std::vector<int> aa;
3591 DataArrayIntTuple *aaa;
3593 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3598 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3599 ret->applyLin(1,val);
3604 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3605 return DataArrayInt::Add(self,aaaa);
3609 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3610 return DataArrayInt::Add(self,aaaa);
3613 throw INTERP_KERNEL::Exception(msg);
3617 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3619 const char msg[]="Unexpected situation in __iadd__ !";
3622 std::vector<int> aa;
3623 DataArrayIntTuple *aaa;
3625 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3630 self->applyLin(1,val);
3631 Py_XINCREF(trueSelf);
3636 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3638 Py_XINCREF(trueSelf);
3644 Py_XINCREF(trueSelf);
3649 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3650 self->addEqual(aaaa);
3651 Py_XINCREF(trueSelf);
3655 throw INTERP_KERNEL::Exception(msg);
3659 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3661 const char msg[]="Unexpected situation in __sub__ !";
3664 std::vector<int> aa;
3665 DataArrayIntTuple *aaa;
3667 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3672 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3673 ret->applyLin(1,-val);
3678 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3679 return DataArrayInt::Substract(self,aaaa);
3683 return DataArrayInt::Substract(self,a);
3687 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3688 return DataArrayInt::Substract(self,aaaa);
3691 throw INTERP_KERNEL::Exception(msg);
3695 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3697 const char msg[]="Unexpected situation in __rsub__ !";
3700 std::vector<int> aa;
3701 DataArrayIntTuple *aaa;
3703 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3708 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3709 ret->applyLin(-1,val);
3714 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3715 return DataArrayInt::Substract(aaaa,self);
3719 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3720 return DataArrayInt::Substract(aaaa,self);
3723 throw INTERP_KERNEL::Exception(msg);
3727 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3729 const char msg[]="Unexpected situation in __isub__ !";
3732 std::vector<int> aa;
3733 DataArrayIntTuple *aaa;
3735 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3740 self->applyLin(1,-val);
3741 Py_XINCREF(trueSelf);
3746 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3747 self->substractEqual(bb);
3748 Py_XINCREF(trueSelf);
3753 self->substractEqual(a);
3754 Py_XINCREF(trueSelf);
3759 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3760 self->substractEqual(aaaa);
3761 Py_XINCREF(trueSelf);
3765 throw INTERP_KERNEL::Exception(msg);
3769 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3771 const char msg[]="Unexpected situation in __mul__ !";
3774 std::vector<int> aa;
3775 DataArrayIntTuple *aaa;
3777 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3782 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3783 ret->applyLin(val,0);
3788 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3789 return DataArrayInt::Multiply(self,aaaa);
3793 return DataArrayInt::Multiply(self,a);
3797 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3798 return DataArrayInt::Multiply(self,aaaa);
3801 throw INTERP_KERNEL::Exception(msg);
3805 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3807 const char msg[]="Unexpected situation in __rmul__ !";
3810 std::vector<int> aa;
3811 DataArrayIntTuple *aaa;
3813 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3818 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3819 ret->applyLin(val,0);
3824 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3825 return DataArrayInt::Multiply(self,aaaa);
3829 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3830 return DataArrayInt::Multiply(self,aaaa);
3833 throw INTERP_KERNEL::Exception(msg);
3837 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3839 const char msg[]="Unexpected situation in __imul__ !";
3842 std::vector<int> aa;
3843 DataArrayIntTuple *aaa;
3845 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3850 self->applyLin(val,0);
3851 Py_XINCREF(trueSelf);
3856 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3857 self->multiplyEqual(bb);
3858 Py_XINCREF(trueSelf);
3863 self->multiplyEqual(a);
3864 Py_XINCREF(trueSelf);
3869 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3870 self->multiplyEqual(aaaa);
3871 Py_XINCREF(trueSelf);
3875 throw INTERP_KERNEL::Exception(msg);
3879 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3881 const char msg[]="Unexpected situation in __div__ !";
3884 std::vector<int> aa;
3885 DataArrayIntTuple *aaa;
3887 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3892 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3893 ret->applyDivideBy(val);
3898 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3899 return DataArrayInt::Divide(self,aaaa);
3903 return DataArrayInt::Divide(self,a);
3907 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3908 return DataArrayInt::Divide(self,aaaa);
3911 throw INTERP_KERNEL::Exception(msg);
3915 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3917 const char msg[]="Unexpected situation in __rdiv__ !";
3920 std::vector<int> aa;
3921 DataArrayIntTuple *aaa;
3923 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3928 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3934 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3935 return DataArrayInt::Divide(aaaa,self);
3939 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3940 return DataArrayInt::Divide(aaaa,self);
3943 throw INTERP_KERNEL::Exception(msg);
3947 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3949 const char msg[]="Unexpected situation in __idiv__ !";
3952 std::vector<int> aa;
3953 DataArrayIntTuple *aaa;
3955 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3960 self->applyDivideBy(val);
3961 Py_XINCREF(trueSelf);
3966 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3967 self->divideEqual(bb);
3968 Py_XINCREF(trueSelf);
3973 self->divideEqual(a);
3974 Py_XINCREF(trueSelf);
3979 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3980 self->divideEqual(aaaa);
3981 Py_XINCREF(trueSelf);
3985 throw INTERP_KERNEL::Exception(msg);
3989 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3991 const char msg[]="Unexpected situation in __mod__ !";
3994 std::vector<int> aa;
3995 DataArrayIntTuple *aaa;
3997 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4002 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4003 ret->applyModulus(val);
4008 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4009 return DataArrayInt::Modulus(self,aaaa);
4013 return DataArrayInt::Modulus(self,a);
4017 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4018 return DataArrayInt::Modulus(self,aaaa);
4021 throw INTERP_KERNEL::Exception(msg);
4025 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4027 const char msg[]="Unexpected situation in __rmod__ !";
4030 std::vector<int> aa;
4031 DataArrayIntTuple *aaa;
4033 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4038 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4039 ret->applyRModulus(val);
4044 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4045 return DataArrayInt::Modulus(aaaa,self);
4049 return DataArrayInt::Modulus(a,self);
4053 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4054 return DataArrayInt::Modulus(aaaa,self);
4057 throw INTERP_KERNEL::Exception(msg);
4061 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4063 const char msg[]="Unexpected situation in __imod__ !";
4066 std::vector<int> aa;
4067 DataArrayIntTuple *aaa;
4069 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4074 self->applyModulus(val);
4075 Py_XINCREF(trueSelf);
4080 self->modulusEqual(a);
4081 Py_XINCREF(trueSelf);
4086 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4087 self->modulusEqual(aaaa);
4088 Py_XINCREF(trueSelf);
4092 throw INTERP_KERNEL::Exception(msg);
4096 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4098 const char msg[]="Unexpected situation in __pow__ !";
4101 std::vector<int> aa;
4102 DataArrayIntTuple *aaa;
4104 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4109 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4115 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4116 return DataArrayInt::Pow(self,aaaa);
4120 return DataArrayInt::Pow(self,a);
4124 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4125 return DataArrayInt::Pow(self,aaaa);
4128 throw INTERP_KERNEL::Exception(msg);
4132 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4134 const char msg[]="Unexpected situation in __rpow__ !";
4137 std::vector<int> aa;
4138 DataArrayIntTuple *aaa;
4140 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4145 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4146 ret->applyRPow(val);
4151 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4152 return DataArrayInt::Pow(aaaa,self);
4156 return DataArrayInt::Pow(a,self);
4160 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4161 return DataArrayInt::Pow(aaaa,self);
4164 throw INTERP_KERNEL::Exception(msg);
4168 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4170 const char msg[]="Unexpected situation in __ipow__ !";
4173 std::vector<int> aa;
4174 DataArrayIntTuple *aaa;
4176 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4181 self->applyPow(val);
4182 Py_XINCREF(trueSelf);
4188 Py_XINCREF(trueSelf);
4193 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4194 self->powEqual(aaaa);
4195 Py_XINCREF(trueSelf);
4199 throw INTERP_KERNEL::Exception(msg);
4203 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4205 std::ostringstream oss;
4206 self->reprQuickOverview(oss);
4210 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4212 int szArr,sw,iTypppArr;
4213 std::vector<int> stdvecTyyppArr;
4214 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4215 self->pushBackValsSilent(tmp,tmp+szArr);
4218 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4220 std::vector<int> ret1;
4221 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4222 std::size_t sz=ret0.size();
4223 PyObject *pyRet=PyTuple_New(2);
4224 PyObject *pyRet0=PyList_New((int)sz);
4225 PyObject *pyRet1=PyList_New((int)sz);
4226 for(std::size_t i=0;i<sz;i++)
4228 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4229 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4231 PyTuple_SetItem(pyRet,0,pyRet0);
4232 PyTuple_SetItem(pyRet,1,pyRet1);
4236 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4238 DataArrayInt *ret0=0,*ret1=0;
4239 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4240 PyObject *pyRet=PyTuple_New(2);
4241 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4242 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4248 class DataArrayIntTuple;
4250 class DataArrayIntIterator
4253 DataArrayIntIterator(DataArrayInt *da);
4254 ~DataArrayIntIterator();
4259 DataArrayIntTuple *ret=self->nextt();
4261 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4264 PyErr_SetString(PyExc_StopIteration,"No more data.");
4271 class DataArrayIntTuple
4274 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4275 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4278 std::string __str__() const throw(INTERP_KERNEL::Exception)
4280 return self->repr();
4283 int __int__() const throw(INTERP_KERNEL::Exception)
4285 return self->intValue();
4288 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4290 return self->buildDAInt(1,self->getNumberOfCompo());
4293 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4295 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4296 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4297 Py_XINCREF(trueSelf);
4301 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4303 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4304 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4305 Py_XINCREF(trueSelf);
4309 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4311 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4312 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4313 Py_XINCREF(trueSelf);
4317 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4319 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4320 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4321 Py_XINCREF(trueSelf);
4325 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4327 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4328 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4329 Py_XINCREF(trueSelf);
4333 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4335 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4338 std::vector<int> multiVal;
4339 std::pair<int, std::pair<int,int> > slic;
4340 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4341 const int *pt=self->getConstPointer();
4342 int nbc=self->getNumberOfCompo();
4343 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4350 std::ostringstream oss;
4351 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4352 throw INTERP_KERNEL::Exception(oss.str().c_str());
4355 return PyInt_FromLong(pt[singleVal]);
4359 return PyInt_FromLong(pt[nbc+singleVal]);
4362 std::ostringstream oss;
4363 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4364 throw INTERP_KERNEL::Exception(oss.str().c_str());
4370 PyObject *t=PyTuple_New(multiVal.size());
4371 for(int j=0;j<(int)multiVal.size();j++)
4373 int cid=multiVal[j];
4376 std::ostringstream oss;
4377 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4378 throw INTERP_KERNEL::Exception(oss.str().c_str());
4380 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4386 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4387 PyObject *t=PyTuple_New(sz);
4388 for(int j=0;j<sz;j++)
4389 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4393 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4397 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4399 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4400 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4403 std::vector<int> multiValV;
4404 std::pair<int, std::pair<int,int> > slicV;
4405 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4406 int nbc=self->getNumberOfCompo();
4407 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4409 std::vector<int> multiVal;
4410 std::pair<int, std::pair<int,int> > slic;
4411 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4412 int *pt=self->getPointer();
4413 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4420 std::ostringstream oss;
4421 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4422 throw INTERP_KERNEL::Exception(oss.str().c_str());
4428 pt[singleVal]=singleValV;
4433 if(multiValV.size()!=1)
4435 std::ostringstream oss;
4436 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4437 throw INTERP_KERNEL::Exception(oss.str().c_str());
4439 pt[singleVal]=multiValV[0];
4444 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4448 throw INTERP_KERNEL::Exception(msg);
4457 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4461 std::ostringstream oss;
4462 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4463 throw INTERP_KERNEL::Exception(oss.str().c_str());
4471 if(multiVal.size()!=multiValV.size())
4473 std::ostringstream oss;
4474 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4475 throw INTERP_KERNEL::Exception(oss.str().c_str());
4477 for(int i=0;i<(int)multiVal.size();i++)
4479 int pos=multiVal[i];
4482 std::ostringstream oss;
4483 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4484 throw INTERP_KERNEL::Exception(oss.str().c_str());
4486 pt[multiVal[i]]=multiValV[i];
4492 const int *ptV=daIntTyyppV->getConstPointer();
4493 if(nbc>daIntTyyppV->getNumberOfCompo())
4495 std::ostringstream oss;
4496 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4497 throw INTERP_KERNEL::Exception(oss.str().c_str());
4499 std::copy(ptV,ptV+nbc,pt);
4503 throw INTERP_KERNEL::Exception(msg);
4508 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4513 for(int j=0;j<sz;j++)
4514 pt[slic.first+j*slic.second.second]=singleValV;
4519 if(sz!=(int)multiValV.size())
4521 std::ostringstream oss;
4522 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4523 throw INTERP_KERNEL::Exception(oss.str().c_str());
4525 for(int j=0;j<sz;j++)
4526 pt[slic.first+j*slic.second.second]=multiValV[j];
4531 const int *ptV=daIntTyyppV->getConstPointer();
4532 if(sz>daIntTyyppV->getNumberOfCompo())
4534 std::ostringstream oss;
4535 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4536 throw INTERP_KERNEL::Exception(oss.str().c_str());
4538 for(int j=0;j<sz;j++)
4539 pt[slic.first+j*slic.second.second]=ptV[j];
4543 throw INTERP_KERNEL::Exception(msg);
4547 throw INTERP_KERNEL::Exception(msg);
4553 class DataArrayChar : public DataArray
4556 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4557 int getHashCode() const throw(INTERP_KERNEL::Exception);
4558 bool empty() const throw(INTERP_KERNEL::Exception);
4559 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4560 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4561 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4562 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4563 char popBackSilent() throw(INTERP_KERNEL::Exception);
4564 void pack() const throw(INTERP_KERNEL::Exception);
4565 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4566 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4567 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4568 void reverse() throw(INTERP_KERNEL::Exception);
4569 void fillWithZero() throw(INTERP_KERNEL::Exception);
4570 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4571 std::string repr() const throw(INTERP_KERNEL::Exception);
4572 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4573 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4574 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4575 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4576 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4577 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4578 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4579 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4580 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4581 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4582 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4583 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4584 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4585 char front() const throw(INTERP_KERNEL::Exception);
4586 char back() const throw(INTERP_KERNEL::Exception);
4587 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4588 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4589 char *getPointer() throw(INTERP_KERNEL::Exception);
4590 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4591 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4592 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4593 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4594 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4595 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4596 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4597 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4598 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4599 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4600 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4603 int __len__() const throw(INTERP_KERNEL::Exception)
4605 if(self->isAllocated())
4607 return self->getNumberOfTuples();
4611 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4615 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4618 bool ret0=self->isEqualIfNotWhy(other,ret1);
4619 PyObject *ret=PyTuple_New(2);
4620 PyObject *ret0Py=ret0?Py_True:Py_False;
4622 PyTuple_SetItem(ret,0,ret0Py);
4623 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4627 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4630 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4631 if (!SWIG_IsOK(res1))
4634 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4635 if(size!=self->getNumberOfTuples())
4637 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4639 return self->renumber(tmp);
4643 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4645 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4646 da2->checkAllocated();
4647 int size=self->getNumberOfTuples();
4648 if(size!=self->getNumberOfTuples())
4650 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4652 return self->renumber(da2->getConstPointer());
4656 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4659 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4660 if (!SWIG_IsOK(res1))
4663 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4664 if(size!=self->getNumberOfTuples())
4666 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4668 return self->renumberR(tmp);
4672 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4674 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4675 da2->checkAllocated();
4676 int size=self->getNumberOfTuples();
4677 if(size!=self->getNumberOfTuples())
4679 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4681 return self->renumberR(da2->getConstPointer());
4685 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4688 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4689 if (!SWIG_IsOK(res1))
4692 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4693 if(size!=self->getNumberOfTuples())
4695 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4697 return self->renumberAndReduce(tmp,newNbOfTuple);
4701 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4703 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4704 da2->checkAllocated();
4705 int size=self->getNumberOfTuples();
4706 if(size!=self->getNumberOfTuples())
4708 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4710 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4714 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4717 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4718 if (!SWIG_IsOK(res1))
4721 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4722 return self->selectByTupleIdSafe(tmp,tmp+size);
4726 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4728 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4729 da2->checkAllocated();
4730 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4734 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4736 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4737 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4738 return DataArrayChar::Aggregate(tmp);
4741 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4743 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4744 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4745 return DataArrayChar::Meld(tmp);
4750 class DataArrayByteIterator;
4752 class DataArrayByte : public DataArrayChar
4755 static DataArrayByte *New();
4756 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4757 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4758 char byteValue() const throw(INTERP_KERNEL::Exception);
4761 DataArrayByte() throw(INTERP_KERNEL::Exception)
4763 return DataArrayByte::New();
4766 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4768 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) !";
4769 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4773 if(PyInt_Check(nbOfTuples))
4775 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4777 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4780 if(PyInt_Check(nbOfComp))
4781 {//DataArrayByte.New([1,3,4,5],2,2)
4782 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4784 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4785 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4786 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4787 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4791 throw INTERP_KERNEL::Exception(msg);
4794 {//DataArrayByte.New([1,3,4],3)
4795 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4797 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4798 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4803 throw INTERP_KERNEL::Exception(msg);
4806 {// DataArrayByte.New([1,3,4])
4807 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4808 int tmpp1=-1,tmpp2=-1;
4809 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4810 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4814 else if(PyInt_Check(elt0))
4816 int nbOfTuples1=PyInt_AS_LONG(elt0);
4818 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4823 if(PyInt_Check(nbOfTuples))
4824 {//DataArrayByte.New(5,2)
4825 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4827 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4828 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4829 ret->alloc(nbOfTuples1,nbOfCompo);
4833 throw INTERP_KERNEL::Exception(msg);
4836 throw INTERP_KERNEL::Exception(msg);
4839 {//DataArrayByte.New(5)
4840 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4841 ret->alloc(nbOfTuples1,1);
4846 throw INTERP_KERNEL::Exception(msg);
4849 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4851 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4854 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4856 std::ostringstream oss;
4857 self->reprQuickOverview(oss);
4861 int __int__() const throw(INTERP_KERNEL::Exception)
4863 return (int) self->byteValue();
4866 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4868 return self->iterator();
4871 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4873 return (int)self->getIJ(tupleId,compoId);
4876 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4878 return (int)self->getIJSafe(tupleId,compoId);
4881 std::string __str__() const throw(INTERP_KERNEL::Exception)
4883 return self->repr();
4886 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4888 const char *vals=self->getConstPointer();
4889 int nbOfComp=self->getNumberOfComponents();
4890 int nbOfTuples=self->getNumberOfTuples();
4891 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4894 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4897 int ival=-1; std::vector<int> ivval;
4898 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4899 std::vector<char> vals(sz);
4900 std::copy(pt,pt+sz,vals.begin());
4901 return self->presenceOfTuple(vals);
4904 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4907 int ival=-1; std::vector<int> ivval;
4908 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4909 std::vector<char> vals2(sz);
4910 std::copy(pt,pt+sz,vals2.begin());
4911 return self->presenceOfValue(vals2);
4914 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4917 int ival=-1; std::vector<int> ivval;
4918 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4919 std::vector<char> vals2(sz);
4920 std::copy(pt,pt+sz,vals2.begin());
4921 return self->locateValue(vals2);
4924 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4927 int ival=-1; std::vector<int> ivval;
4928 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4929 std::vector<char> vals(sz);
4930 std::copy(pt,pt+sz,vals.begin());
4931 return self->locateTuple(vals);
4934 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4937 int ival=-1; std::vector<int> ivval;
4938 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4939 std::vector<char> vals(sz);
4940 std::copy(pt,pt+sz,vals.begin());
4941 return self->search(vals);
4944 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4946 int sz=self->getNumberOfComponents();
4947 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4948 self->getTuple(tupleId,tmp);
4949 PyObject *ret=PyTuple_New(sz);
4950 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4954 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4957 int r1=(int)self->getMaxValue(tmp);
4958 PyObject *ret=PyTuple_New(2);
4959 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4960 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4964 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4967 int r1=(int)self->getMinValue(tmp);
4968 PyObject *ret=PyTuple_New(2);
4969 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4970 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4974 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4976 int nbOfCompo=self->getNumberOfComponents();
4981 if(PyInt_Check(obj))
4983 int val=(int)PyInt_AS_LONG(obj);
4984 return self->locateValue(val);
4987 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4990 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4994 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4996 int nbOfCompo=self->getNumberOfComponents();
5003 if(PyInt_Check(obj))
5005 int val=(int)PyInt_AS_LONG(obj);
5006 return self->presenceOfValue(val);
5009 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5012 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5018 class DataArrayByteTuple;
5020 class DataArrayByteIterator
5023 DataArrayByteIterator(DataArrayByte *da);
5024 ~DataArrayByteIterator();
5027 class DataArrayByteTuple
5030 std::string repr() const throw(INTERP_KERNEL::Exception);
5031 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5034 std::string __str__() const throw(INTERP_KERNEL::Exception)
5036 return self->repr();
5039 char __int__() const throw(INTERP_KERNEL::Exception)
5041 return self->byteValue();
5044 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5046 return self->buildDAByte(1,self->getNumberOfCompo());
5051 class DataArrayAsciiCharIterator;
5053 class DataArrayAsciiChar : public DataArrayChar
5056 static DataArrayAsciiChar *New();
5057 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5058 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5059 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5062 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5064 return DataArrayAsciiChar::New();
5067 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5069 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) !";
5070 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5074 if(PyInt_Check(nbOfTuples))
5076 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5078 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5081 if(PyInt_Check(nbOfComp))
5082 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5083 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5085 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5086 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5087 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5088 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5092 throw INTERP_KERNEL::Exception(msg);
5095 {//DataArrayAsciiChar.New([1,3,4],3)
5096 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5098 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5099 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5103 else if(PyString_Check(nbOfTuples))
5105 if(PyString_Size(nbOfTuples)!=1)
5106 throw INTERP_KERNEL::Exception(msg);
5107 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5108 std::vector<std::string> tmp;
5109 if(fillStringVector(elt0,tmp))
5110 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5112 throw INTERP_KERNEL::Exception(msg);
5115 throw INTERP_KERNEL::Exception(msg);
5119 std::vector<std::string> tmmp;
5120 if(fillStringVector(elt0,tmmp))
5121 //DataArrayAsciiChar.New(["abc","de","fghi"])
5122 return DataArrayAsciiChar::New(tmmp,' ');
5125 // DataArrayAsciiChar.New([1,3,4])
5126 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5127 int tmpp1=-1,tmpp2=-1;
5128 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5129 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5134 else if(PyInt_Check(elt0))
5136 int nbOfTuples1=PyInt_AS_LONG(elt0);
5138 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5143 if(PyInt_Check(nbOfTuples))
5144 {//DataArrayAsciiChar.New(5,2)
5145 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5147 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5148 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5149 ret->alloc(nbOfTuples1,nbOfCompo);
5153 throw INTERP_KERNEL::Exception(msg);
5156 throw INTERP_KERNEL::Exception(msg);
5159 {//DataArrayAsciiChar.New(5)
5160 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5161 ret->alloc(nbOfTuples1,1);
5166 throw INTERP_KERNEL::Exception(msg);
5169 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5171 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5174 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5176 std::ostringstream oss;
5177 self->reprQuickOverview(oss);
5181 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5183 return self->iterator();
5186 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5188 char tmp[2]; tmp[1]='\0';
5189 tmp[0]=self->getIJ(tupleId,compoId);
5190 return std::string(tmp);
5193 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5195 char tmp[2]; tmp[1]='\0';
5196 tmp[0]=self->getIJSafe(tupleId,compoId);
5197 return std::string(tmp);
5200 std::string __str__() const throw(INTERP_KERNEL::Exception)
5202 return self->repr();
5205 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5207 const char *vals=self->getConstPointer();
5208 int nbOfComp=self->getNumberOfComponents();
5209 int nbOfTuples=self->getNumberOfTuples();
5210 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5213 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5215 if(PyString_Check(tupl))
5217 Py_ssize_t sz=PyString_Size(tupl);
5218 std::vector<char> vals(sz);
5219 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5220 return self->presenceOfTuple(vals);
5223 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5226 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5228 if(PyString_Check(vals))
5230 Py_ssize_t sz=PyString_Size(vals);
5231 std::vector<char> vals2(sz);
5232 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5233 return self->presenceOfValue(vals2);
5236 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5239 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5241 if(PyString_Check(vals))
5243 Py_ssize_t sz=PyString_Size(vals);
5244 std::vector<char> vals2(sz);
5245 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5246 return self->locateValue(vals2);
5249 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5252 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5254 if(PyString_Check(tupl))
5256 Py_ssize_t sz=PyString_Size(tupl);
5257 std::vector<char> vals(sz);
5258 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5259 return self->locateTuple(vals);
5262 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5265 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5267 if(PyString_Check(strOrListOfInt))
5269 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5270 std::vector<char> vals(sz);
5271 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5272 return self->search(vals);
5275 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5278 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5280 int sz=self->getNumberOfComponents();
5281 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5282 self->getTuple(tupleId,tmp);
5283 return PyString_FromString(tmp);
5286 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5289 char tmp2[2]; tmp2[1]='\0';
5290 tmp2[0]=self->getMaxValue(tmp);
5291 PyObject *ret=PyTuple_New(2);
5292 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5293 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5297 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5300 char tmp2[2]; tmp2[1]='\0';
5301 tmp2[0]=self->getMinValue(tmp);
5302 PyObject *ret=PyTuple_New(2);
5303 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5304 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5308 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5310 int nbOfCompo=self->getNumberOfComponents();
5315 if(PyString_Check(obj))
5317 Py_ssize_t sz=PyString_Size(obj);
5318 char *pt=PyString_AsString(obj);
5320 return self->locateValue(pt[0]);
5322 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5325 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5328 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5332 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5334 int nbOfCompo=self->getNumberOfComponents();
5341 if(PyString_Check(obj))
5343 Py_ssize_t sz=PyString_Size(obj);
5344 char *pt=PyString_AsString(obj);
5346 return self->presenceOfValue(pt[0]);
5348 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5351 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5354 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5358 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5361 std::vector<int> stdvecTyyppArr;
5362 std::pair<int, std::pair<int,int> > sTyyppArr;
5363 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5364 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5368 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5370 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5372 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5374 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5376 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5380 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5382 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.";
5384 std::vector<int> stdvecTyyppArr;
5385 std::pair<int, std::pair<int,int> > sTyyppArr;
5386 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5387 int nbOfCompo=self->getNumberOfComponents();
5388 int nbOfTuples=self->getNumberOfTuples();
5389 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5391 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5392 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5401 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5407 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5408 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5411 //value vector<string>
5414 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5415 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5418 //value DataArrayChar
5421 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5425 throw INTERP_KERNEL::Exception(msg);
5429 {//obj list-tuple[int]
5435 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5441 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5442 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5445 //value vector<string>
5448 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5449 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5452 //value DataArrayChar
5455 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5459 throw INTERP_KERNEL::Exception(msg);
5470 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5476 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5477 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5480 //value vector<string>
5483 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5484 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5487 //value DataArrayChar
5490 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5494 throw INTERP_KERNEL::Exception(msg);
5505 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5511 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5512 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5515 //value vector<string>
5518 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5519 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5522 //value DataArrayChar
5525 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5529 throw INTERP_KERNEL::Exception(msg);
5534 throw INTERP_KERNEL::Exception(msg);
5540 class DataArrayAsciiCharTuple;
5542 class DataArrayAsciiCharIterator
5545 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5546 ~DataArrayAsciiCharIterator();
5551 DataArrayAsciiCharTuple *ret=self->nextt();
5553 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5556 PyErr_SetString(PyExc_StopIteration,"No more data.");
5563 class DataArrayAsciiCharTuple
5566 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5567 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5570 std::string __str__() const throw(INTERP_KERNEL::Exception)
5572 return self->repr();
5575 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5577 return self->buildDAAsciiChar(1,self->getNumberOfCompo());