1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
23 class DataArray : public RefCountObject, public TimeLabel
26 void setName(const char *name);
27 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
28 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
29 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
30 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
31 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
32 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
33 std::string getName() const;
34 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
35 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
36 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
37 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
38 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
39 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
40 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
41 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
42 int getNumberOfComponents() const;
43 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
44 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
45 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
46 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
47 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
48 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
49 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
50 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
51 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
52 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
53 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
54 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
55 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
56 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
57 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
58 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
59 void updateTime() const;
62 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
64 const std::vector<std::string>& comps=self->getInfoOnComponents();
65 PyObject *ret=PyList_New((int)comps.size());
66 for(int i=0;i<(int)comps.size();i++)
67 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
71 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
74 convertPyToNewIntArr3(li,tmp);
75 self->copyPartOfStringInfoFrom(other,tmp);
78 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
81 convertPyToNewIntArr3(li,tmp);
82 self->copyPartOfStringInfoFrom2(tmp,other);
85 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
88 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
92 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
93 if(size!=self->getNumberOfTuples())
95 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
97 self->renumberInPlace(tmp);
101 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
103 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
104 da2->checkAllocated();
105 int size=self->getNumberOfTuples();
106 if(size!=self->getNumberOfTuples())
108 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
110 self->renumberInPlace(da2->getConstPointer());
114 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
117 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
118 if (!SWIG_IsOK(res1))
121 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
122 if(size!=self->getNumberOfTuples())
124 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
126 self->renumberInPlaceR(tmp);
130 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
132 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
133 da2->checkAllocated();
134 int size=self->getNumberOfTuples();
135 if(size!=self->getNumberOfTuples())
137 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
139 self->renumberInPlaceR(da2->getConstPointer());
143 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
144 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
146 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
147 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
148 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
149 DataArrayInt *tuplesSelecPtr2=0;
152 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
154 throw INTERP_KERNEL::Exception(msg);
156 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
159 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
161 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
162 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
165 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
167 std::vector<std::pair<int,int> > ranges;
168 convertPyToVectorPairInt(li,ranges);
169 return self->selectByTupleRanges(ranges);
172 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
174 std::vector<int> tmp;
175 convertPyToNewIntArr3(li,tmp);
176 DataArray *ret=self->keepSelectedComponents(tmp);
177 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
180 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
182 if(!PySlice_Check(slic))
183 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
184 Py_ssize_t strt=2,stp=2,step=2;
185 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
186 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
187 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
188 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
189 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
191 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
192 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
195 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
197 if(!PySlice_Check(slic))
198 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
199 Py_ssize_t strt=2,stp=2,step=2;
200 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
201 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
202 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
204 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
205 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
208 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
210 if(!PySlice_Check(slic))
211 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
212 Py_ssize_t strt=2,stp=2,step=2;
213 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
214 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
215 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
216 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
217 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
218 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
221 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
223 if(!PySlice_Check(slic))
224 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
225 Py_ssize_t strt=2,stp=2,step=2;
226 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
227 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
228 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
229 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
230 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
231 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
234 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
236 if(!PySlice_Check(slic))
237 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
238 Py_ssize_t strt=2,stp=2,step=2;
239 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
240 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
241 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
242 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
245 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
247 if(!PySlice_Check(slic))
248 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
249 Py_ssize_t strt=2,stp=2,step=2;
250 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
251 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
252 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
253 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
259 class DataArrayDoubleIterator;
261 class DataArrayDouble : public DataArray
264 static DataArrayDouble *New();
265 double doubleValue() const throw(INTERP_KERNEL::Exception);
266 bool empty() const throw(INTERP_KERNEL::Exception);
267 DataArrayDouble *deepCpy() const throw(INTERP_KERNEL::Exception);
268 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
269 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
270 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
271 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
272 void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
273 double popBackSilent() throw(INTERP_KERNEL::Exception);
274 void pack() const throw(INTERP_KERNEL::Exception);
275 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
276 void fillWithZero() throw(INTERP_KERNEL::Exception);
277 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
278 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
279 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
280 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
281 void reverse() throw(INTERP_KERNEL::Exception);
282 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
283 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
284 std::string repr() const throw(INTERP_KERNEL::Exception);
285 std::string reprZip() const throw(INTERP_KERNEL::Exception);
286 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
287 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
288 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
289 DataArrayInt *convertToIntArr() const;
290 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
291 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
292 DataArrayDouble *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
293 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
294 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
295 void transpose() throw(INTERP_KERNEL::Exception);
296 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
297 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
298 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
299 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
300 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
301 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
302 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
303 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
304 double getIJ(int tupleId, int compoId) const;
305 double back() const throw(INTERP_KERNEL::Exception);
306 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
307 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
308 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
309 double *getPointer() throw(INTERP_KERNEL::Exception);
310 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
311 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
312 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
313 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
314 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
315 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
316 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
317 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
318 double getAverageValue() const throw(INTERP_KERNEL::Exception);
319 double norm2() const throw(INTERP_KERNEL::Exception);
320 double normMax() const throw(INTERP_KERNEL::Exception);
321 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
322 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
323 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
324 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
325 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
326 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
327 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
328 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
329 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
330 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
331 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
332 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
333 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
334 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
335 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
336 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
337 void abs() throw(INTERP_KERNEL::Exception);
338 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
339 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
340 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
341 void applyPow(double val) throw(INTERP_KERNEL::Exception);
342 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
343 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
344 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
345 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
346 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
347 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
348 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
349 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
350 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
351 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
352 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
353 static DataArrayDouble *Aggregate(const std::vector<const DataArrayDouble *>& arr) throw(INTERP_KERNEL::Exception);
354 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
355 static DataArrayDouble *Meld(const std::vector<const DataArrayDouble *>& arr) 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__()
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 *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
879 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
880 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
881 self->checkAllocated();
882 int nbOfTuples=self->getNumberOfTuples();
883 int nbOfComponents=self->getNumberOfComponents();
885 std::vector<int> vt1,vc1;
886 std::pair<int, std::pair<int,int> > pt1,pc1;
887 DataArrayInt *dt1=0,*dc1=0;
889 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
890 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
894 if(nbOfComponents==1)
895 return PyFloat_FromDouble(self->getIJSafe(it1,0));
896 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
898 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
900 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
902 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
904 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
907 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
908 std::vector<int> v2(1,ic1);
909 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
913 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
914 std::vector<int> v2(1,ic1);
915 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
919 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
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->selectByTupleIdSafe(&it1,&it1+1);
926 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
930 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
931 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
935 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
936 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
940 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
941 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
945 ret=self->selectByTupleIdSafe(&it1,&it1+1);
946 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
947 std::vector<int> v2(nbOfComp);
948 for(int i=0;i<nbOfComp;i++)
949 v2[i]=pc1.first+i*pc1.second.second;
950 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
954 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
955 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
956 std::vector<int> v2(nbOfComp);
957 for(int i=0;i<nbOfComp;i++)
958 v2[i]=pc1.first+i*pc1.second.second;
959 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
963 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
964 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
965 std::vector<int> v2(nbOfComp);
966 for(int i=0;i<nbOfComp;i++)
967 v2[i]=pc1.first+i*pc1.second.second;
968 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
972 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
973 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
974 std::vector<int> v2(nbOfComp);
975 for(int i=0;i<nbOfComp;i++)
976 v2[i]=pc1.first+i*pc1.second.second;
977 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
980 throw INTERP_KERNEL::Exception(msg);
984 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
986 self->checkAllocated();
987 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
988 int nbOfTuples=self->getNumberOfTuples();
989 int nbOfComponents=self->getNumberOfComponents();
992 std::vector<double> v1;
993 DataArrayDouble *d1=0;
994 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
996 std::vector<int> vt1,vc1;
997 std::pair<int, std::pair<int,int> > pt1,pc1;
998 DataArrayInt *dt1=0,*dc1=0;
999 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1000 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1008 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1011 tmp=DataArrayDouble::New();
1012 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1013 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1016 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1019 throw INTERP_KERNEL::Exception(msg);
1028 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1031 tmp=DataArrayDouble::New();
1032 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1033 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1036 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1039 throw INTERP_KERNEL::Exception(msg);
1048 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1051 tmp=DataArrayDouble::New();
1052 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1053 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1056 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1059 throw INTERP_KERNEL::Exception(msg);
1068 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1071 tmp=DataArrayDouble::New();
1072 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1073 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1076 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1079 throw INTERP_KERNEL::Exception(msg);
1088 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1091 tmp=DataArrayDouble::New();
1092 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1093 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1096 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1099 throw INTERP_KERNEL::Exception(msg);
1108 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1111 tmp=DataArrayDouble::New();
1112 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1113 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1116 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1119 throw INTERP_KERNEL::Exception(msg);
1128 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1131 tmp=DataArrayDouble::New();
1132 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1133 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1136 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1139 throw INTERP_KERNEL::Exception(msg);
1148 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1151 tmp=DataArrayDouble::New();
1152 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1153 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1156 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1159 throw INTERP_KERNEL::Exception(msg);
1168 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1171 tmp=DataArrayDouble::New();
1172 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1173 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1176 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1179 throw INTERP_KERNEL::Exception(msg);
1188 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1191 tmp=DataArrayDouble::New();
1192 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1193 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1196 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1199 throw INTERP_KERNEL::Exception(msg);
1208 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1211 tmp=DataArrayDouble::New();
1212 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1213 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1216 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1219 throw INTERP_KERNEL::Exception(msg);
1228 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1231 tmp=DataArrayDouble::New();
1232 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1233 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1236 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1239 throw INTERP_KERNEL::Exception(msg);
1248 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1251 tmp=DataArrayDouble::New();
1252 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1253 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1256 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1259 throw INTERP_KERNEL::Exception(msg);
1268 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1271 tmp=DataArrayDouble::New();
1272 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1273 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1276 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1279 throw INTERP_KERNEL::Exception(msg);
1288 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1291 tmp=DataArrayDouble::New();
1292 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1293 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1296 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1299 throw INTERP_KERNEL::Exception(msg);
1308 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1311 tmp=DataArrayDouble::New();
1312 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1313 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1316 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1319 throw INTERP_KERNEL::Exception(msg);
1324 throw INTERP_KERNEL::Exception(msg);
1329 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1331 return self->negate();
1334 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1336 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1339 DataArrayDoubleTuple *aa;
1340 std::vector<double> bb;
1344 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1346 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1349 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1350 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1352 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1355 throw INTERP_KERNEL::Exception(msg);
1358 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1363 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1364 ret->applyLin(1.,val);
1365 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1369 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1373 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1374 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1378 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1379 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1382 throw INTERP_KERNEL::Exception(msg);
1386 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1388 const char msg[]="Unexpected situation in __radd__ !";
1391 DataArrayDoubleTuple *aa;
1392 std::vector<double> bb;
1394 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1399 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1400 ret->applyLin(1.,val);
1405 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1406 return DataArrayDouble::Add(self,aaa);
1410 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1411 return DataArrayDouble::Add(self,aaa);
1414 throw INTERP_KERNEL::Exception(msg);
1418 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1420 const char msg[]="Unexpected situation in __iadd__ !";
1423 DataArrayDoubleTuple *aa;
1424 std::vector<double> bb;
1426 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1431 self->applyLin(1.,val);
1432 Py_XINCREF(trueSelf);
1438 Py_XINCREF(trueSelf);
1443 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1444 self->addEqual(aaa);
1445 Py_XINCREF(trueSelf);
1450 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1451 self->addEqual(aaa);
1452 Py_XINCREF(trueSelf);
1456 throw INTERP_KERNEL::Exception(msg);
1460 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1462 const char msg[]="Unexpected situation in __sub__ !";
1465 DataArrayDoubleTuple *aa;
1466 std::vector<double> bb;
1470 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1472 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1475 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1476 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1478 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1481 throw INTERP_KERNEL::Exception(msg);
1484 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1489 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1490 ret->applyLin(1.,-val);
1491 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1495 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1499 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1500 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1504 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1505 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1508 throw INTERP_KERNEL::Exception(msg);
1512 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1514 const char msg[]="Unexpected situation in __rsub__ !";
1517 DataArrayDoubleTuple *aa;
1518 std::vector<double> bb;
1520 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1525 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1526 ret->applyLin(-1.,val);
1531 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1532 return DataArrayDouble::Substract(aaa,self);
1536 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1537 return DataArrayDouble::Substract(aaa,self);
1540 throw INTERP_KERNEL::Exception(msg);
1544 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1546 const char msg[]="Unexpected situation in __isub__ !";
1549 DataArrayDoubleTuple *aa;
1550 std::vector<double> bb;
1552 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1557 self->applyLin(1,-val);
1558 Py_XINCREF(trueSelf);
1563 self->substractEqual(a);
1564 Py_XINCREF(trueSelf);
1569 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1570 self->substractEqual(aaa);
1571 Py_XINCREF(trueSelf);
1576 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1577 self->substractEqual(aaa);
1578 Py_XINCREF(trueSelf);
1582 throw INTERP_KERNEL::Exception(msg);
1586 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1588 const char msg[]="Unexpected situation in __mul__ !";
1591 DataArrayDoubleTuple *aa;
1592 std::vector<double> bb;
1596 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1598 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1601 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1602 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1604 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1607 throw INTERP_KERNEL::Exception(msg);
1610 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1615 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1616 ret->applyLin(val,0.);
1617 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1621 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1625 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1626 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1630 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1631 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1634 throw INTERP_KERNEL::Exception(msg);
1638 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1640 const char msg[]="Unexpected situation in __rmul__ !";
1643 DataArrayDoubleTuple *aa;
1644 std::vector<double> bb;
1646 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1651 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1652 ret->applyLin(val,0.);
1657 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1658 return DataArrayDouble::Multiply(self,aaa);
1662 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1663 return DataArrayDouble::Multiply(self,aaa);
1666 throw INTERP_KERNEL::Exception(msg);
1670 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1672 const char msg[]="Unexpected situation in __imul__ !";
1675 DataArrayDoubleTuple *aa;
1676 std::vector<double> bb;
1678 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1683 self->applyLin(val,0.);
1684 Py_XINCREF(trueSelf);
1689 self->multiplyEqual(a);
1690 Py_XINCREF(trueSelf);
1695 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1696 self->multiplyEqual(aaa);
1697 Py_XINCREF(trueSelf);
1702 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1703 self->multiplyEqual(aaa);
1704 Py_XINCREF(trueSelf);
1708 throw INTERP_KERNEL::Exception(msg);
1712 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1714 const char msg[]="Unexpected situation in __div__ !";
1717 DataArrayDoubleTuple *aa;
1718 std::vector<double> bb;
1722 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1724 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1727 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1728 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1730 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1733 throw INTERP_KERNEL::Exception(msg);
1736 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1742 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1743 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1744 ret->applyLin(1/val,0.);
1745 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1749 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1753 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1754 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1758 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1759 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1762 throw INTERP_KERNEL::Exception(msg);
1766 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1768 const char msg[]="Unexpected situation in __rdiv__ !";
1771 DataArrayDoubleTuple *aa;
1772 std::vector<double> bb;
1774 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1779 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1785 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1786 return DataArrayDouble::Divide(aaa,self);
1790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1791 return DataArrayDouble::Divide(aaa,self);
1794 throw INTERP_KERNEL::Exception(msg);
1798 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1800 const char msg[]="Unexpected situation in __idiv__ !";
1803 DataArrayDoubleTuple *aa;
1804 std::vector<double> bb;
1806 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1812 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1813 self->applyLin(1./val,0.);
1814 Py_XINCREF(trueSelf);
1819 self->divideEqual(a);
1820 Py_XINCREF(trueSelf);
1825 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1826 self->divideEqual(aaa);
1827 Py_XINCREF(trueSelf);
1832 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1833 self->divideEqual(aaa);
1834 Py_XINCREF(trueSelf);
1838 throw INTERP_KERNEL::Exception(msg);
1842 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1844 const char msg[]="Unexpected situation in __pow__ !";
1847 DataArrayDoubleTuple *aa;
1848 std::vector<double> bb;
1850 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1855 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1861 return DataArrayDouble::Pow(self,a);
1865 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1866 return DataArrayDouble::Pow(self,aaa);
1870 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1871 return DataArrayDouble::Pow(self,aaa);
1874 throw INTERP_KERNEL::Exception(msg);
1878 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1880 const char msg[]="Unexpected situation in __rpow__ !";
1883 DataArrayDoubleTuple *aa;
1884 std::vector<double> bb;
1886 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1891 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1892 ret->applyRPow(val);
1897 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1898 return DataArrayDouble::Pow(aaa,self);
1902 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1903 return DataArrayDouble::Pow(aaa,self);
1906 throw INTERP_KERNEL::Exception(msg);
1910 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1912 const char msg[]="Unexpected situation in __ipow__ !";
1915 DataArrayDoubleTuple *aa;
1916 std::vector<double> bb;
1918 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1923 self->applyPow(val);
1924 Py_XINCREF(trueSelf);
1930 Py_XINCREF(trueSelf);
1935 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1936 self->powEqual(aaa);
1937 Py_XINCREF(trueSelf);
1942 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1943 self->powEqual(aaa);
1944 Py_XINCREF(trueSelf);
1948 throw INTERP_KERNEL::Exception(msg);
1952 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1954 DataArrayInt *c=0,*cI=0;
1956 self->computeTupleIdsNearTuples(other,eps,c,cI);
1957 PyObject *ret=PyTuple_New(2);
1958 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1959 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1963 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1965 DataArrayInt *ret1=0;
1966 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1967 PyObject *ret=PyTuple_New(2);
1968 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1969 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1975 class DataArrayDoubleTuple;
1977 class DataArrayDoubleIterator
1980 DataArrayDoubleIterator(DataArrayDouble *da);
1981 ~DataArrayDoubleIterator();
1986 DataArrayDoubleTuple *ret=self->nextt();
1988 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1991 PyErr_SetString(PyExc_StopIteration,"No more data.");
1998 class DataArrayDoubleTuple
2001 int getNumberOfCompo() const;
2002 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2005 std::string __str__() const throw(INTERP_KERNEL::Exception)
2007 return self->repr();
2010 double __float__() const throw(INTERP_KERNEL::Exception)
2012 return self->doubleValue();
2015 DataArrayDouble *buildDADouble()
2017 return self->buildDADouble(1,self->getNumberOfCompo());
2020 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2022 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2023 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2024 Py_XINCREF(trueSelf);
2028 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2030 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2031 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2032 Py_XINCREF(trueSelf);
2036 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2038 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2039 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2040 Py_XINCREF(trueSelf);
2044 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2046 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2047 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2048 Py_XINCREF(trueSelf);
2052 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2054 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2057 std::vector<int> multiVal;
2058 std::pair<int, std::pair<int,int> > slic;
2059 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2060 const double *pt=self->getConstPointer();
2061 int nbc=self->getNumberOfCompo();
2062 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2069 std::ostringstream oss;
2070 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2071 throw INTERP_KERNEL::Exception(oss.str().c_str());
2074 return PyFloat_FromDouble(pt[singleVal]);
2078 return PyFloat_FromDouble(pt[nbc+singleVal]);
2081 std::ostringstream oss;
2082 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2083 throw INTERP_KERNEL::Exception(oss.str().c_str());
2089 PyObject *t=PyTuple_New(multiVal.size());
2090 for(int j=0;j<(int)multiVal.size();j++)
2092 int cid=multiVal[j];
2095 std::ostringstream oss;
2096 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2097 throw INTERP_KERNEL::Exception(oss.str().c_str());
2099 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2105 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2106 PyObject *t=PyTuple_New(sz);
2107 for(int j=0;j<sz;j++)
2108 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2112 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2116 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2118 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2119 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2122 std::vector<double> multiValV;
2123 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2124 int nbc=self->getNumberOfCompo();
2125 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2127 std::vector<int> multiVal;
2128 std::pair<int, std::pair<int,int> > slic;
2129 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2130 double *pt=self->getPointer();
2131 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2138 std::ostringstream oss;
2139 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2140 throw INTERP_KERNEL::Exception(oss.str().c_str());
2146 pt[singleVal]=singleValV;
2151 if(multiValV.size()!=1)
2153 std::ostringstream oss;
2154 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2155 throw INTERP_KERNEL::Exception(oss.str().c_str());
2157 pt[singleVal]=multiValV[0];
2162 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2166 throw INTERP_KERNEL::Exception(msg);
2175 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2179 std::ostringstream oss;
2180 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2181 throw INTERP_KERNEL::Exception(oss.str().c_str());
2189 if(multiVal.size()!=multiValV.size())
2191 std::ostringstream oss;
2192 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2193 throw INTERP_KERNEL::Exception(oss.str().c_str());
2195 for(int i=0;i<(int)multiVal.size();i++)
2197 int pos=multiVal[i];
2200 std::ostringstream oss;
2201 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2202 throw INTERP_KERNEL::Exception(oss.str().c_str());
2204 pt[multiVal[i]]=multiValV[i];
2210 const double *ptV=daIntTyyppV->getConstPointer();
2211 if(nbc>daIntTyyppV->getNumberOfCompo())
2213 std::ostringstream oss;
2214 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2215 throw INTERP_KERNEL::Exception(oss.str().c_str());
2217 std::copy(ptV,ptV+nbc,pt);
2221 throw INTERP_KERNEL::Exception(msg);
2226 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2231 for(int j=0;j<sz;j++)
2232 pt[slic.first+j*slic.second.second]=singleValV;
2237 if(sz!=(int)multiValV.size())
2239 std::ostringstream oss;
2240 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2241 throw INTERP_KERNEL::Exception(oss.str().c_str());
2243 for(int j=0;j<sz;j++)
2244 pt[slic.first+j*slic.second.second]=multiValV[j];
2249 const double *ptV=daIntTyyppV->getConstPointer();
2250 if(sz>daIntTyyppV->getNumberOfCompo())
2252 std::ostringstream oss;
2253 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2254 throw INTERP_KERNEL::Exception(oss.str().c_str());
2256 for(int j=0;j<sz;j++)
2257 pt[slic.first+j*slic.second.second]=ptV[j];
2261 throw INTERP_KERNEL::Exception(msg);
2265 throw INTERP_KERNEL::Exception(msg);
2271 class DataArrayIntIterator;
2273 class DataArrayInt : public DataArray
2276 static DataArrayInt *New();
2277 int intValue() const throw(INTERP_KERNEL::Exception);
2278 int getHashCode() const throw(INTERP_KERNEL::Exception);
2279 bool empty() const throw(INTERP_KERNEL::Exception);
2280 DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
2281 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2282 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2283 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2284 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2285 int popBackSilent() throw(INTERP_KERNEL::Exception);
2286 void pack() const throw(INTERP_KERNEL::Exception);
2287 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2288 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2289 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2290 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2291 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2292 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2293 void reverse() throw(INTERP_KERNEL::Exception);
2294 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2295 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2296 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2297 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2298 void fillWithZero() throw(INTERP_KERNEL::Exception);
2299 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2300 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2301 std::string repr() const throw(INTERP_KERNEL::Exception);
2302 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2303 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const;
2304 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const;
2305 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2306 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
2307 DataArrayDouble *convertToDblArr() const;
2308 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2311 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2312 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2313 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2314 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2316 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
2317 void transpose() throw(INTERP_KERNEL::Exception);
2318 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2319 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2320 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2321 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2322 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2323 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2324 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2325 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2326 int back() const throw(INTERP_KERNEL::Exception);
2327 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2328 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2329 int *getPointer() throw(INTERP_KERNEL::Exception);
2330 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2331 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2332 const int *begin() const throw(INTERP_KERNEL::Exception);
2333 const int *end() const throw(INTERP_KERNEL::Exception);
2334 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2335 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2336 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2337 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2338 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2339 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2340 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2341 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2342 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2343 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2344 int count(int value) const throw(INTERP_KERNEL::Exception);
2345 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2346 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2347 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2348 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2349 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2350 void abs() throw(INTERP_KERNEL::Exception);
2351 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2352 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2353 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2355 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2356 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2357 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2358 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2359 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2361 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2);
2362 static DataArrayInt *Aggregate(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2363 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2364 static DataArrayInt *Meld(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2365 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2366 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2367 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2373 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2374 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2375 void computeOffsets() throw(INTERP_KERNEL::Exception);
2376 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2377 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2382 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2383 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2384 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2385 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2386 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2387 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2388 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2389 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2390 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2391 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2392 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2393 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2395 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2398 DataArrayInt() throw(INTERP_KERNEL::Exception)
2400 return DataArrayInt::New();
2403 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2405 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)";
2406 std::string msg(msgBase);
2408 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2411 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2415 if(PyInt_Check(nbOfTuples))
2417 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2419 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2422 if(PyInt_Check(nbOfComp))
2423 {//DataArrayInt.New([1,3,4,5],2,2)
2424 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2426 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2427 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2428 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2429 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2433 throw INTERP_KERNEL::Exception(msg.c_str());
2436 {//DataArrayInt.New([1,3,4],3)
2437 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2439 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2440 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2445 throw INTERP_KERNEL::Exception(msg.c_str());
2448 {// DataArrayInt.New([1,3,4])
2449 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2450 int tmpp1=-1,tmpp2=-1;
2451 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2452 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2456 else if(PyInt_Check(elt0))
2458 int nbOfTuples1=PyInt_AS_LONG(elt0);
2460 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2465 if(PyInt_Check(nbOfTuples))
2466 {//DataArrayInt.New(5,2)
2467 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2469 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2470 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2471 ret->alloc(nbOfTuples1,nbOfCompo);
2475 throw INTERP_KERNEL::Exception(msg.c_str());
2478 throw INTERP_KERNEL::Exception(msg.c_str());
2481 {//DataArrayInt.New(5)
2482 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2483 ret->alloc(nbOfTuples1,1);
2488 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2489 {//DataArrayInt.New(numpyArray)
2490 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
2494 throw INTERP_KERNEL::Exception(msg.c_str());
2497 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2499 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2502 std::string __str__() const throw(INTERP_KERNEL::Exception)
2504 return self->repr();
2507 int __len__() const throw(INTERP_KERNEL::Exception)
2509 if(self->isAllocated())
2511 return self->getNumberOfTuples();
2515 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2519 int __int__() const throw(INTERP_KERNEL::Exception)
2521 return self->intValue();
2524 DataArrayIntIterator *__iter__()
2526 return self->iterator();
2529 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2531 int sz=self->getNumberOfComponents();
2532 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2533 self->accumulate(tmp);
2534 return convertIntArrToPyList(tmp,sz);
2537 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2540 std::vector<int> val2;
2541 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2542 return self->accumulatePerChunck(bg,bg+sz);
2545 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2547 int newNbOfTuples=-1;
2548 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2549 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2550 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2551 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2552 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2553 PyObject *ret=PyTuple_New(2);
2554 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2555 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2559 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2561 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 !";
2562 if(PyList_Check(li) || PyTuple_Check(li))
2566 if(PyInt_Check(nbOfTuples))
2568 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2570 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2573 if(PyInt_Check(nbOfComp))
2574 {//DataArrayInt.setValues([1,3,4,5],2,2)
2575 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2577 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2578 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2579 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2582 throw INTERP_KERNEL::Exception(msg);
2585 {//DataArrayInt.setValues([1,3,4],3)
2587 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2588 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2592 throw INTERP_KERNEL::Exception(msg);
2595 {// DataArrayInt.setValues([1,3,4])
2596 int tmpp1=-1,tmpp2=-1;
2597 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2598 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2602 throw INTERP_KERNEL::Exception(msg);
2605 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2607 const int *vals=self->getConstPointer();
2608 return convertIntArrToPyList(vals,self->getNbOfElems());
2612 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2614 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT,"DataArrayInt");
2618 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2621 bool ret0=self->isEqualIfNotWhy(other,ret1);
2622 PyObject *ret=PyTuple_New(2);
2623 PyObject *ret0Py=ret0?Py_True:Py_False;
2625 PyTuple_SetItem(ret,0,ret0Py);
2626 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2630 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2632 const int *vals=self->getConstPointer();
2633 int nbOfComp=self->getNumberOfComponents();
2634 int nbOfTuples=self->getNumberOfTuples();
2635 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2638 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2640 std::vector<const DataArrayInt *> groups;
2641 std::vector< std::vector<int> > fidsOfGroups;
2642 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2643 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2644 PyObject *ret = PyList_New(2);
2645 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2646 int sz=fidsOfGroups.size();
2647 PyObject *ret1 = PyList_New(sz);
2648 for(int i=0;i<sz;i++)
2649 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2650 PyList_SetItem(ret,1,ret1);
2654 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2657 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2658 if (!SWIG_IsOK(res1))
2661 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2662 self->transformWithIndArr(tmp,tmp+size);
2666 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2667 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2671 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2675 std::vector<int> multiVal;
2676 std::pair<int, std::pair<int,int> > slic;
2677 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2678 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2682 return self->getIdsEqualList(&singleVal,&singleVal+1);
2684 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2686 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2688 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2692 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2696 std::vector<int> multiVal;
2697 std::pair<int, std::pair<int,int> > slic;
2698 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2699 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2703 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2705 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2707 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2709 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2713 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2715 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2717 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2718 if (!SWIG_IsOK(res1))
2721 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2722 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2726 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2728 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2729 da2->checkAllocated();
2730 int size=self->getNumberOfTuples();
2731 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2733 PyObject *ret = PyList_New(3);
2734 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2735 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2736 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2740 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2743 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2744 if (!SWIG_IsOK(res1))
2747 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2748 return self->transformWithIndArrR(tmp,tmp+size);
2752 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2753 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2757 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2760 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2761 if (!SWIG_IsOK(res1))
2764 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2765 if(size!=self->getNumberOfTuples())
2767 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2769 return self->renumberAndReduce(tmp,newNbOfTuple);
2773 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2775 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2776 da2->checkAllocated();
2777 int size=self->getNumberOfTuples();
2778 if(size!=self->getNumberOfTuples())
2780 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2782 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2786 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2789 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2790 if (!SWIG_IsOK(res1))
2793 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2794 if(size!=self->getNumberOfTuples())
2796 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2798 return self->renumber(tmp);
2802 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2804 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2805 da2->checkAllocated();
2806 int size=self->getNumberOfTuples();
2807 if(size!=self->getNumberOfTuples())
2809 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2811 return self->renumber(da2->getConstPointer());
2815 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2818 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2819 if (!SWIG_IsOK(res1))
2822 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2823 if(size!=self->getNumberOfTuples())
2825 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2827 return self->renumberR(tmp);
2831 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2833 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2834 da2->checkAllocated();
2835 int size=self->getNumberOfTuples();
2836 if(size!=self->getNumberOfTuples())
2838 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2840 return self->renumberR(da2->getConstPointer());
2844 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2847 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2848 if (!SWIG_IsOK(res1))
2851 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2852 return self->selectByTupleId(tmp,tmp+size);
2856 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2858 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2859 da2->checkAllocated();
2860 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2864 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2867 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2868 if (!SWIG_IsOK(res1))
2871 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2872 return self->selectByTupleIdSafe(tmp,tmp+size);
2876 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2878 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2879 da2->checkAllocated();
2880 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2884 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2886 std::vector<int> tmp;
2887 convertPyToNewIntArr3(li,tmp);
2888 self->setSelectedComponents(a,tmp);
2891 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2893 int sz=self->getNumberOfComponents();
2894 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2895 self->getTuple(tupleId,tmp);
2896 return convertIntArrToPyList(tmp,sz);
2899 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2901 DataArrayInt *arr=0;
2902 DataArrayInt *arrI=0;
2903 self->changeSurjectiveFormat(targetNb,arr,arrI);
2904 PyObject *res = PyList_New(2);
2905 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2906 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2910 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2912 std::vector<const DataArrayInt *> tmp;
2913 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2914 return DataArrayInt::Meld(tmp);
2917 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2919 std::vector<const DataArrayInt *> tmp;
2920 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2921 return DataArrayInt::Aggregate(tmp);
2924 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2926 std::vector<const DataArrayInt *> tmp;
2927 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2928 return DataArrayInt::BuildUnion(tmp);
2931 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2933 std::vector<const DataArrayInt *> tmp;
2934 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2935 return DataArrayInt::BuildIntersection(tmp);
2938 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2941 int r1=self->getMaxValue(tmp);
2942 PyObject *ret=PyTuple_New(2);
2943 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2944 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2948 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2951 int r1=self->getMinValue(tmp);
2952 PyObject *ret=PyTuple_New(2);
2953 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2954 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2958 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2960 int nbOfCompo=self->getNumberOfComponents();
2965 if(PyInt_Check(obj))
2967 int val=(int)PyInt_AS_LONG(obj);
2968 return self->locateValue(val);
2971 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2975 std::vector<int> arr;
2976 convertPyToNewIntArr3(obj,arr);
2977 return self->locateTuple(arr);
2982 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2984 int nbOfCompo=self->getNumberOfComponents();
2991 if(PyInt_Check(obj))
2993 int val=(int)PyInt_AS_LONG(obj);
2994 return self->presenceOfValue(val);
2997 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3001 std::vector<int> arr;
3002 convertPyToNewIntArr3(obj,arr);
3003 return self->presenceOfTuple(arr);
3008 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3010 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3011 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3012 self->checkAllocated();
3013 int nbOfTuples=self->getNumberOfTuples();
3014 int nbOfComponents=self->getNumberOfComponents();
3016 std::vector<int> vt1,vc1;
3017 std::pair<int, std::pair<int,int> > pt1,pc1;
3018 DataArrayInt *dt1=0,*dc1=0;
3020 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3021 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3026 if(nbOfComponents==1)
3027 return PyInt_FromLong(self->getIJSafe(it1,0));
3028 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3031 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3033 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3035 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3037 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3040 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3041 std::vector<int> v2(1,ic1);
3042 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3046 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3047 std::vector<int> v2(1,ic1);
3048 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3052 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3053 std::vector<int> v2(1,ic1);
3054 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3058 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3059 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3063 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3064 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3068 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3069 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3073 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3074 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3078 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3079 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3080 std::vector<int> v2(nbOfComp);
3081 for(int i=0;i<nbOfComp;i++)
3082 v2[i]=pc1.first+i*pc1.second.second;
3083 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3087 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3088 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3089 std::vector<int> v2(nbOfComp);
3090 for(int i=0;i<nbOfComp;i++)
3091 v2[i]=pc1.first+i*pc1.second.second;
3092 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3096 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3097 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3098 std::vector<int> v2(nbOfComp);
3099 for(int i=0;i<nbOfComp;i++)
3100 v2[i]=pc1.first+i*pc1.second.second;
3101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3105 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3106 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3107 std::vector<int> v2(nbOfComp);
3108 for(int i=0;i<nbOfComp;i++)
3109 v2[i]=pc1.first+i*pc1.second.second;
3110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3113 throw INTERP_KERNEL::Exception(msg);
3117 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3119 self->checkAllocated();
3120 const char msg[]="Unexpected situation in __setitem__ !";
3121 int nbOfTuples=self->getNumberOfTuples();
3122 int nbOfComponents=self->getNumberOfComponents();
3125 std::vector<int> v1;
3127 DataArrayIntTuple *dd1=0;
3128 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3130 std::vector<int> vt1,vc1;
3131 std::pair<int, std::pair<int,int> > pt1,pc1;
3132 DataArrayInt *dt1=0,*dc1=0;
3133 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3134 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3142 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3145 tmp=DataArrayInt::New();
3146 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3147 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3150 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3153 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3154 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3157 throw INTERP_KERNEL::Exception(msg);
3166 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3169 tmp=DataArrayInt::New();
3170 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3171 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3174 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3177 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3178 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3181 throw INTERP_KERNEL::Exception(msg);
3190 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3193 tmp=DataArrayInt::New();
3194 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3195 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3198 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3201 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3202 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3205 throw INTERP_KERNEL::Exception(msg);
3214 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3217 tmp=DataArrayInt::New();
3218 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3219 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3222 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3225 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3226 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3229 throw INTERP_KERNEL::Exception(msg);
3238 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3241 tmp=DataArrayInt::New();
3242 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3243 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3246 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3249 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3250 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3253 throw INTERP_KERNEL::Exception(msg);
3262 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3265 tmp=DataArrayInt::New();
3266 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3267 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3270 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3273 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3274 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3277 throw INTERP_KERNEL::Exception(msg);
3286 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3289 tmp=DataArrayInt::New();
3290 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3291 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3294 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3297 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3298 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3301 throw INTERP_KERNEL::Exception(msg);
3310 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3313 tmp=DataArrayInt::New();
3314 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3315 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3318 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3321 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3322 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3325 throw INTERP_KERNEL::Exception(msg);
3334 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3337 tmp=DataArrayInt::New();
3338 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3339 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3342 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3345 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3346 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3349 throw INTERP_KERNEL::Exception(msg);
3358 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3361 tmp=DataArrayInt::New();
3362 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3363 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3366 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3369 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3370 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3373 throw INTERP_KERNEL::Exception(msg);
3382 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3385 tmp=DataArrayInt::New();
3386 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3387 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3390 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3393 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3394 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3397 throw INTERP_KERNEL::Exception(msg);
3406 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3409 tmp=DataArrayInt::New();
3410 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3411 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3414 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3417 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3418 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3421 throw INTERP_KERNEL::Exception(msg);
3430 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3433 tmp=DataArrayInt::New();
3434 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3435 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3438 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3441 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3442 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3445 throw INTERP_KERNEL::Exception(msg);
3454 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3457 tmp=DataArrayInt::New();
3458 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3459 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3462 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3465 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3466 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3469 throw INTERP_KERNEL::Exception(msg);
3478 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3481 tmp=DataArrayInt::New();
3482 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3483 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3486 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3489 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3490 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3493 throw INTERP_KERNEL::Exception(msg);
3502 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3505 tmp=DataArrayInt::New();
3506 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3507 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3510 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3513 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3514 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3517 throw INTERP_KERNEL::Exception(msg);
3522 throw INTERP_KERNEL::Exception(msg);
3527 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3529 return self->negate();
3532 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3534 const char msg[]="Unexpected situation in __add__ !";
3537 std::vector<int> aa;
3538 DataArrayIntTuple *aaa;
3540 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3545 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3546 ret->applyLin(1,val);
3551 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3552 return DataArrayInt::Add(self,aaaa);
3556 return DataArrayInt::Add(self,a);
3560 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3561 return DataArrayInt::Add(self,aaaa);
3564 throw INTERP_KERNEL::Exception(msg);
3568 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3570 const char msg[]="Unexpected situation in __radd__ !";
3573 std::vector<int> aa;
3574 DataArrayIntTuple *aaa;
3576 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3581 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3582 ret->applyLin(1,val);
3587 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3588 return DataArrayInt::Add(self,aaaa);
3592 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3593 return DataArrayInt::Add(self,aaaa);
3596 throw INTERP_KERNEL::Exception(msg);
3600 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3602 const char msg[]="Unexpected situation in __iadd__ !";
3605 std::vector<int> aa;
3606 DataArrayIntTuple *aaa;
3608 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3613 self->applyLin(1,val);
3614 Py_XINCREF(trueSelf);
3619 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3621 Py_XINCREF(trueSelf);
3627 Py_XINCREF(trueSelf);
3632 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3633 self->addEqual(aaaa);
3634 Py_XINCREF(trueSelf);
3638 throw INTERP_KERNEL::Exception(msg);
3642 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3644 const char msg[]="Unexpected situation in __sub__ !";
3647 std::vector<int> aa;
3648 DataArrayIntTuple *aaa;
3650 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3655 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3656 ret->applyLin(1,-val);
3661 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3662 return DataArrayInt::Substract(self,aaaa);
3666 return DataArrayInt::Substract(self,a);
3670 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3671 return DataArrayInt::Substract(self,aaaa);
3674 throw INTERP_KERNEL::Exception(msg);
3678 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3680 const char msg[]="Unexpected situation in __rsub__ !";
3683 std::vector<int> aa;
3684 DataArrayIntTuple *aaa;
3686 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3691 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3692 ret->applyLin(-1,val);
3697 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3698 return DataArrayInt::Substract(aaaa,self);
3702 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3703 return DataArrayInt::Substract(aaaa,self);
3706 throw INTERP_KERNEL::Exception(msg);
3710 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3712 const char msg[]="Unexpected situation in __isub__ !";
3715 std::vector<int> aa;
3716 DataArrayIntTuple *aaa;
3718 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3723 self->applyLin(1,-val);
3724 Py_XINCREF(trueSelf);
3729 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3730 self->substractEqual(bb);
3731 Py_XINCREF(trueSelf);
3736 self->substractEqual(a);
3737 Py_XINCREF(trueSelf);
3742 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3743 self->substractEqual(aaaa);
3744 Py_XINCREF(trueSelf);
3748 throw INTERP_KERNEL::Exception(msg);
3752 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3754 const char msg[]="Unexpected situation in __mul__ !";
3757 std::vector<int> aa;
3758 DataArrayIntTuple *aaa;
3760 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3765 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3766 ret->applyLin(val,0);
3771 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3772 return DataArrayInt::Multiply(self,aaaa);
3776 return DataArrayInt::Multiply(self,a);
3780 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3781 return DataArrayInt::Multiply(self,aaaa);
3784 throw INTERP_KERNEL::Exception(msg);
3788 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3790 const char msg[]="Unexpected situation in __rmul__ !";
3793 std::vector<int> aa;
3794 DataArrayIntTuple *aaa;
3796 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3801 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3802 ret->applyLin(val,0);
3807 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3808 return DataArrayInt::Multiply(self,aaaa);
3812 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3813 return DataArrayInt::Multiply(self,aaaa);
3816 throw INTERP_KERNEL::Exception(msg);
3820 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3822 const char msg[]="Unexpected situation in __imul__ !";
3825 std::vector<int> aa;
3826 DataArrayIntTuple *aaa;
3828 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3833 self->applyLin(val,0);
3834 Py_XINCREF(trueSelf);
3839 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3840 self->multiplyEqual(bb);
3841 Py_XINCREF(trueSelf);
3846 self->multiplyEqual(a);
3847 Py_XINCREF(trueSelf);
3852 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3853 self->multiplyEqual(aaaa);
3854 Py_XINCREF(trueSelf);
3858 throw INTERP_KERNEL::Exception(msg);
3862 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3864 const char msg[]="Unexpected situation in __div__ !";
3867 std::vector<int> aa;
3868 DataArrayIntTuple *aaa;
3870 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3875 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3876 ret->applyDivideBy(val);
3881 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3882 return DataArrayInt::Divide(self,aaaa);
3886 return DataArrayInt::Divide(self,a);
3890 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3891 return DataArrayInt::Divide(self,aaaa);
3894 throw INTERP_KERNEL::Exception(msg);
3898 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3900 const char msg[]="Unexpected situation in __rdiv__ !";
3903 std::vector<int> aa;
3904 DataArrayIntTuple *aaa;
3906 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3911 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3917 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3918 return DataArrayInt::Divide(aaaa,self);
3922 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3923 return DataArrayInt::Divide(aaaa,self);
3926 throw INTERP_KERNEL::Exception(msg);
3930 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3932 const char msg[]="Unexpected situation in __idiv__ !";
3935 std::vector<int> aa;
3936 DataArrayIntTuple *aaa;
3938 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3943 self->applyDivideBy(val);
3944 Py_XINCREF(trueSelf);
3949 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3950 self->divideEqual(bb);
3951 Py_XINCREF(trueSelf);
3956 self->divideEqual(a);
3957 Py_XINCREF(trueSelf);
3962 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3963 self->divideEqual(aaaa);
3964 Py_XINCREF(trueSelf);
3968 throw INTERP_KERNEL::Exception(msg);
3972 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3974 const char msg[]="Unexpected situation in __mod__ !";
3977 std::vector<int> aa;
3978 DataArrayIntTuple *aaa;
3980 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3985 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3986 ret->applyModulus(val);
3991 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3992 return DataArrayInt::Modulus(self,aaaa);
3996 return DataArrayInt::Modulus(self,a);
4000 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4001 return DataArrayInt::Modulus(self,aaaa);
4004 throw INTERP_KERNEL::Exception(msg);
4008 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4010 const char msg[]="Unexpected situation in __rmod__ !";
4013 std::vector<int> aa;
4014 DataArrayIntTuple *aaa;
4016 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4021 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4022 ret->applyRModulus(val);
4027 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4028 return DataArrayInt::Modulus(aaaa,self);
4032 return DataArrayInt::Modulus(a,self);
4036 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4037 return DataArrayInt::Modulus(aaaa,self);
4040 throw INTERP_KERNEL::Exception(msg);
4044 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4046 const char msg[]="Unexpected situation in __imod__ !";
4049 std::vector<int> aa;
4050 DataArrayIntTuple *aaa;
4052 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4057 self->applyModulus(val);
4058 Py_XINCREF(trueSelf);
4063 self->modulusEqual(a);
4064 Py_XINCREF(trueSelf);
4069 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4070 self->modulusEqual(aaaa);
4071 Py_XINCREF(trueSelf);
4075 throw INTERP_KERNEL::Exception(msg);
4079 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4081 const char msg[]="Unexpected situation in __pow__ !";
4084 std::vector<int> aa;
4085 DataArrayIntTuple *aaa;
4087 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4092 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4098 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4099 return DataArrayInt::Pow(self,aaaa);
4103 return DataArrayInt::Pow(self,a);
4107 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4108 return DataArrayInt::Pow(self,aaaa);
4111 throw INTERP_KERNEL::Exception(msg);
4115 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4117 const char msg[]="Unexpected situation in __rpow__ !";
4120 std::vector<int> aa;
4121 DataArrayIntTuple *aaa;
4123 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4128 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4129 ret->applyRPow(val);
4134 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4135 return DataArrayInt::Pow(aaaa,self);
4139 return DataArrayInt::Pow(a,self);
4143 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4144 return DataArrayInt::Pow(aaaa,self);
4147 throw INTERP_KERNEL::Exception(msg);
4151 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4153 const char msg[]="Unexpected situation in __ipow__ !";
4156 std::vector<int> aa;
4157 DataArrayIntTuple *aaa;
4159 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4164 self->applyPow(val);
4165 Py_XINCREF(trueSelf);
4171 Py_XINCREF(trueSelf);
4176 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4177 self->powEqual(aaaa);
4178 Py_XINCREF(trueSelf);
4182 throw INTERP_KERNEL::Exception(msg);
4186 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4188 std::ostringstream oss;
4189 self->reprQuickOverview(oss);
4193 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4195 int szArr,sw,iTypppArr;
4196 std::vector<int> stdvecTyyppArr;
4197 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4198 self->pushBackValsSilent(tmp,tmp+szArr);
4201 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4203 std::vector<int> ret1;
4204 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4205 std::size_t sz=ret0.size();
4206 PyObject *pyRet=PyTuple_New(2);
4207 PyObject *pyRet0=PyList_New((int)sz);
4208 PyObject *pyRet1=PyList_New((int)sz);
4209 for(std::size_t i=0;i<sz;i++)
4211 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4212 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4214 PyTuple_SetItem(pyRet,0,pyRet0);
4215 PyTuple_SetItem(pyRet,1,pyRet1);
4219 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4221 DataArrayInt *ret0=0,*ret1=0;
4222 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4223 PyObject *pyRet=PyTuple_New(2);
4224 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4225 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4231 class DataArrayIntTuple;
4233 class DataArrayIntIterator
4236 DataArrayIntIterator(DataArrayInt *da);
4237 ~DataArrayIntIterator();
4242 DataArrayIntTuple *ret=self->nextt();
4244 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4247 PyErr_SetString(PyExc_StopIteration,"No more data.");
4254 class DataArrayIntTuple
4257 int getNumberOfCompo() const;
4258 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4261 std::string __str__() const throw(INTERP_KERNEL::Exception)
4263 return self->repr();
4266 int __int__() const throw(INTERP_KERNEL::Exception)
4268 return self->intValue();
4271 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4273 return self->buildDAInt(1,self->getNumberOfCompo());
4276 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4278 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4279 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4280 Py_XINCREF(trueSelf);
4284 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4286 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4287 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4288 Py_XINCREF(trueSelf);
4292 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4294 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4295 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4296 Py_XINCREF(trueSelf);
4300 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4302 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4303 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4304 Py_XINCREF(trueSelf);
4308 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4310 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4311 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4312 Py_XINCREF(trueSelf);
4316 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4318 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4321 std::vector<int> multiVal;
4322 std::pair<int, std::pair<int,int> > slic;
4323 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4324 const int *pt=self->getConstPointer();
4325 int nbc=self->getNumberOfCompo();
4326 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4333 std::ostringstream oss;
4334 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4335 throw INTERP_KERNEL::Exception(oss.str().c_str());
4338 return PyInt_FromLong(pt[singleVal]);
4342 return PyInt_FromLong(pt[nbc+singleVal]);
4345 std::ostringstream oss;
4346 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4347 throw INTERP_KERNEL::Exception(oss.str().c_str());
4353 PyObject *t=PyTuple_New(multiVal.size());
4354 for(int j=0;j<(int)multiVal.size();j++)
4356 int cid=multiVal[j];
4359 std::ostringstream oss;
4360 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4361 throw INTERP_KERNEL::Exception(oss.str().c_str());
4363 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4369 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4370 PyObject *t=PyTuple_New(sz);
4371 for(int j=0;j<sz;j++)
4372 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4376 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4380 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4382 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4383 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4386 std::vector<int> multiValV;
4387 std::pair<int, std::pair<int,int> > slicV;
4388 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4389 int nbc=self->getNumberOfCompo();
4390 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4392 std::vector<int> multiVal;
4393 std::pair<int, std::pair<int,int> > slic;
4394 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4395 int *pt=self->getPointer();
4396 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4403 std::ostringstream oss;
4404 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4405 throw INTERP_KERNEL::Exception(oss.str().c_str());
4411 pt[singleVal]=singleValV;
4416 if(multiValV.size()!=1)
4418 std::ostringstream oss;
4419 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4420 throw INTERP_KERNEL::Exception(oss.str().c_str());
4422 pt[singleVal]=multiValV[0];
4427 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4431 throw INTERP_KERNEL::Exception(msg);
4440 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4444 std::ostringstream oss;
4445 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4446 throw INTERP_KERNEL::Exception(oss.str().c_str());
4454 if(multiVal.size()!=multiValV.size())
4456 std::ostringstream oss;
4457 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4458 throw INTERP_KERNEL::Exception(oss.str().c_str());
4460 for(int i=0;i<(int)multiVal.size();i++)
4462 int pos=multiVal[i];
4465 std::ostringstream oss;
4466 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4467 throw INTERP_KERNEL::Exception(oss.str().c_str());
4469 pt[multiVal[i]]=multiValV[i];
4475 const int *ptV=daIntTyyppV->getConstPointer();
4476 if(nbc>daIntTyyppV->getNumberOfCompo())
4478 std::ostringstream oss;
4479 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4480 throw INTERP_KERNEL::Exception(oss.str().c_str());
4482 std::copy(ptV,ptV+nbc,pt);
4486 throw INTERP_KERNEL::Exception(msg);
4491 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4496 for(int j=0;j<sz;j++)
4497 pt[slic.first+j*slic.second.second]=singleValV;
4502 if(sz!=(int)multiValV.size())
4504 std::ostringstream oss;
4505 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4506 throw INTERP_KERNEL::Exception(oss.str().c_str());
4508 for(int j=0;j<sz;j++)
4509 pt[slic.first+j*slic.second.second]=multiValV[j];
4514 const int *ptV=daIntTyyppV->getConstPointer();
4515 if(sz>daIntTyyppV->getNumberOfCompo())
4517 std::ostringstream oss;
4518 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4519 throw INTERP_KERNEL::Exception(oss.str().c_str());
4521 for(int j=0;j<sz;j++)
4522 pt[slic.first+j*slic.second.second]=ptV[j];
4526 throw INTERP_KERNEL::Exception(msg);
4530 throw INTERP_KERNEL::Exception(msg);
4536 class DataArrayChar : public DataArray
4539 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0;
4540 virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
4541 int getHashCode() const throw(INTERP_KERNEL::Exception);
4542 bool empty() const throw(INTERP_KERNEL::Exception);
4543 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4544 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4545 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4546 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4547 char popBackSilent() throw(INTERP_KERNEL::Exception);
4548 void pack() const throw(INTERP_KERNEL::Exception);
4549 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4550 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4551 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4552 void reverse() throw(INTERP_KERNEL::Exception);
4553 void fillWithZero() throw(INTERP_KERNEL::Exception);
4554 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4555 std::string repr() const throw(INTERP_KERNEL::Exception);
4556 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4557 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
4558 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4559 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4560 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4561 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4562 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4563 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4564 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4565 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4566 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4567 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4568 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4569 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4570 char back() const throw(INTERP_KERNEL::Exception);
4571 void setIJ(int tupleId, int compoId, char newVal);
4572 void setIJSilent(int tupleId, int compoId, char newVal);
4574 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4575 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4576 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4577 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4578 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4579 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4580 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4581 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4582 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4583 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
4584 static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
4585 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4586 static DataArrayChar *Meld(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
4589 int __len__() const throw(INTERP_KERNEL::Exception)
4591 if(self->isAllocated())
4593 return self->getNumberOfTuples();
4597 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4601 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4604 bool ret0=self->isEqualIfNotWhy(other,ret1);
4605 PyObject *ret=PyTuple_New(2);
4606 PyObject *ret0Py=ret0?Py_True:Py_False;
4608 PyTuple_SetItem(ret,0,ret0Py);
4609 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4613 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4616 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4617 if (!SWIG_IsOK(res1))
4620 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4621 if(size!=self->getNumberOfTuples())
4623 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4625 return self->renumber(tmp);
4629 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4631 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4632 da2->checkAllocated();
4633 int size=self->getNumberOfTuples();
4634 if(size!=self->getNumberOfTuples())
4636 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4638 return self->renumber(da2->getConstPointer());
4642 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4645 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4646 if (!SWIG_IsOK(res1))
4649 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4650 if(size!=self->getNumberOfTuples())
4652 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4654 return self->renumberR(tmp);
4658 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4660 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4661 da2->checkAllocated();
4662 int size=self->getNumberOfTuples();
4663 if(size!=self->getNumberOfTuples())
4665 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4667 return self->renumberR(da2->getConstPointer());
4671 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4674 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4675 if (!SWIG_IsOK(res1))
4678 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4679 if(size!=self->getNumberOfTuples())
4681 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4683 return self->renumberAndReduce(tmp,newNbOfTuple);
4687 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4689 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4690 da2->checkAllocated();
4691 int size=self->getNumberOfTuples();
4692 if(size!=self->getNumberOfTuples())
4694 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4696 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4700 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4703 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4704 if (!SWIG_IsOK(res1))
4707 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4708 return self->selectByTupleIdSafe(tmp,tmp+size);
4712 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4714 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4715 da2->checkAllocated();
4716 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4720 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4722 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4723 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4724 return DataArrayChar::Aggregate(tmp);
4727 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4729 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4730 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4731 return DataArrayChar::Meld(tmp);
4736 class DataArrayByteIterator;
4738 class DataArrayByte : public DataArrayChar
4741 static DataArrayByte *New();
4742 DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4743 DataArrayByteIterator *iterator();
4744 DataArrayByte *performCpy(bool deepCpy) const;
4745 char byteValue() const throw(INTERP_KERNEL::Exception);
4748 DataArrayByte() throw(INTERP_KERNEL::Exception)
4750 return DataArrayByte::New();
4753 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4755 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) !";
4756 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4760 if(PyInt_Check(nbOfTuples))
4762 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4764 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4767 if(PyInt_Check(nbOfComp))
4768 {//DataArrayByte.New([1,3,4,5],2,2)
4769 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4771 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4772 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4773 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4774 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4778 throw INTERP_KERNEL::Exception(msg);
4781 {//DataArrayByte.New([1,3,4],3)
4782 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4784 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4785 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4790 throw INTERP_KERNEL::Exception(msg);
4793 {// DataArrayByte.New([1,3,4])
4794 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4795 int tmpp1=-1,tmpp2=-1;
4796 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4797 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4801 else if(PyInt_Check(elt0))
4803 int nbOfTuples1=PyInt_AS_LONG(elt0);
4805 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4810 if(PyInt_Check(nbOfTuples))
4811 {//DataArrayByte.New(5,2)
4812 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4814 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4815 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4816 ret->alloc(nbOfTuples1,nbOfCompo);
4820 throw INTERP_KERNEL::Exception(msg);
4823 throw INTERP_KERNEL::Exception(msg);
4826 {//DataArrayByte.New(5)
4827 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4828 ret->alloc(nbOfTuples1,1);
4833 throw INTERP_KERNEL::Exception(msg);
4836 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4838 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4841 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4843 std::ostringstream oss;
4844 self->reprQuickOverview(oss);
4848 int __int__() const throw(INTERP_KERNEL::Exception)
4850 return (int) self->byteValue();
4853 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4855 return self->iterator();
4858 int getIJ(int tupleId, int compoId) const
4860 return (int)self->getIJ(tupleId,compoId);
4863 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4865 return (int)self->getIJSafe(tupleId,compoId);
4868 std::string __str__() const throw(INTERP_KERNEL::Exception)
4870 return self->repr();
4873 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4875 const char *vals=self->getConstPointer();
4876 int nbOfComp=self->getNumberOfComponents();
4877 int nbOfTuples=self->getNumberOfTuples();
4878 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4881 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4884 int ival=-1; std::vector<int> ivval;
4885 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4886 std::vector<char> vals(sz);
4887 std::copy(pt,pt+sz,vals.begin());
4888 return self->presenceOfTuple(vals);
4891 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4894 int ival=-1; std::vector<int> ivval;
4895 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4896 std::vector<char> vals2(sz);
4897 std::copy(pt,pt+sz,vals2.begin());
4898 return self->presenceOfValue(vals2);
4901 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4904 int ival=-1; std::vector<int> ivval;
4905 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4906 std::vector<char> vals2(sz);
4907 std::copy(pt,pt+sz,vals2.begin());
4908 return self->locateValue(vals2);
4911 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4914 int ival=-1; std::vector<int> ivval;
4915 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4916 std::vector<char> vals(sz);
4917 std::copy(pt,pt+sz,vals.begin());
4918 return self->locateTuple(vals);
4921 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4924 int ival=-1; std::vector<int> ivval;
4925 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4926 std::vector<char> vals(sz);
4927 std::copy(pt,pt+sz,vals.begin());
4928 return self->search(vals);
4931 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4933 int sz=self->getNumberOfComponents();
4934 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4935 self->getTuple(tupleId,tmp);
4936 PyObject *ret=PyTuple_New(sz);
4937 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4941 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4944 int r1=(int)self->getMaxValue(tmp);
4945 PyObject *ret=PyTuple_New(2);
4946 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4947 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4951 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4954 int r1=(int)self->getMinValue(tmp);
4955 PyObject *ret=PyTuple_New(2);
4956 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4957 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4961 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4963 int nbOfCompo=self->getNumberOfComponents();
4968 if(PyInt_Check(obj))
4970 int val=(int)PyInt_AS_LONG(obj);
4971 return self->locateValue(val);
4974 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4977 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4981 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4983 int nbOfCompo=self->getNumberOfComponents();
4990 if(PyInt_Check(obj))
4992 int val=(int)PyInt_AS_LONG(obj);
4993 return self->presenceOfValue(val);
4996 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
4999 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5005 class DataArrayByteTuple;
5007 class DataArrayByteIterator
5010 DataArrayByteIterator(DataArrayByte *da);
5011 ~DataArrayByteIterator();
5014 class DataArrayByteTuple
5017 std::string repr() const throw(INTERP_KERNEL::Exception);
5018 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5021 std::string __str__() const
5023 return self->repr();
5026 char __int__() const throw(INTERP_KERNEL::Exception)
5028 return self->byteValue();
5031 DataArrayByte *buildDAByte()
5033 return self->buildDAByte(1,self->getNumberOfCompo());
5038 class DataArrayAsciiCharIterator;
5040 class DataArrayAsciiChar : public DataArrayChar
5043 static DataArrayAsciiChar *New();
5044 DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
5045 DataArrayAsciiCharIterator *iterator();
5046 DataArrayAsciiChar *performCpy(bool deepCpy) const;
5047 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5050 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5052 return DataArrayAsciiChar::New();
5055 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5057 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) !";
5058 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5062 if(PyInt_Check(nbOfTuples))
5064 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5066 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5069 if(PyInt_Check(nbOfComp))
5070 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5071 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5073 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5074 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5075 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5076 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5080 throw INTERP_KERNEL::Exception(msg);
5083 {//DataArrayAsciiChar.New([1,3,4],3)
5084 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5086 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5087 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5091 else if(PyString_Check(nbOfTuples))
5093 if(PyString_Size(nbOfTuples)!=1)
5094 throw INTERP_KERNEL::Exception(msg);
5095 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5096 std::vector<std::string> tmp;
5097 if(fillStringVector(elt0,tmp))
5098 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5100 throw INTERP_KERNEL::Exception(msg);
5103 throw INTERP_KERNEL::Exception(msg);
5107 std::vector<std::string> tmmp;
5108 if(fillStringVector(elt0,tmmp))
5109 //DataArrayAsciiChar.New(["abc","de","fghi"])
5110 return DataArrayAsciiChar::New(tmmp,' ');
5113 // DataArrayAsciiChar.New([1,3,4])
5114 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5115 int tmpp1=-1,tmpp2=-1;
5116 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5117 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5122 else if(PyInt_Check(elt0))
5124 int nbOfTuples1=PyInt_AS_LONG(elt0);
5126 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5131 if(PyInt_Check(nbOfTuples))
5132 {//DataArrayAsciiChar.New(5,2)
5133 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5135 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5136 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5137 ret->alloc(nbOfTuples1,nbOfCompo);
5141 throw INTERP_KERNEL::Exception(msg);
5144 throw INTERP_KERNEL::Exception(msg);
5147 {//DataArrayAsciiChar.New(5)
5148 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5149 ret->alloc(nbOfTuples1,1);
5154 throw INTERP_KERNEL::Exception(msg);
5157 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5159 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5162 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5164 std::ostringstream oss;
5165 self->reprQuickOverview(oss);
5169 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5171 return self->iterator();
5174 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5176 char tmp[2]; tmp[1]='\0';
5177 tmp[0]=self->getIJ(tupleId,compoId);
5178 return std::string(tmp);
5181 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5183 char tmp[2]; tmp[1]='\0';
5184 tmp[0]=self->getIJSafe(tupleId,compoId);
5185 return std::string(tmp);
5188 std::string __str__() const throw(INTERP_KERNEL::Exception)
5190 return self->repr();
5193 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5195 const char *vals=self->getConstPointer();
5196 int nbOfComp=self->getNumberOfComponents();
5197 int nbOfTuples=self->getNumberOfTuples();
5198 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5201 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5203 if(PyString_Check(tupl))
5205 Py_ssize_t sz=PyString_Size(tupl);
5206 std::vector<char> vals(sz);
5207 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5208 return self->presenceOfTuple(vals);
5211 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5214 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5216 if(PyString_Check(vals))
5218 Py_ssize_t sz=PyString_Size(vals);
5219 std::vector<char> vals2(sz);
5220 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5221 return self->presenceOfValue(vals2);
5224 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5227 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5229 if(PyString_Check(vals))
5231 Py_ssize_t sz=PyString_Size(vals);
5232 std::vector<char> vals2(sz);
5233 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5234 return self->locateValue(vals2);
5237 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5240 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5242 if(PyString_Check(tupl))
5244 Py_ssize_t sz=PyString_Size(tupl);
5245 std::vector<char> vals(sz);
5246 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5247 return self->locateTuple(vals);
5250 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5253 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5255 if(PyString_Check(strOrListOfInt))
5257 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5258 std::vector<char> vals(sz);
5259 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5260 return self->search(vals);
5263 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5266 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5268 int sz=self->getNumberOfComponents();
5269 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5270 self->getTuple(tupleId,tmp);
5271 return PyString_FromString(tmp);
5274 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5277 char tmp2[2]; tmp2[1]='\0';
5278 tmp2[0]=self->getMaxValue(tmp);
5279 PyObject *ret=PyTuple_New(2);
5280 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5281 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5285 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5288 char tmp2[2]; tmp2[1]='\0';
5289 tmp2[0]=self->getMinValue(tmp);
5290 PyObject *ret=PyTuple_New(2);
5291 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5292 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5296 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5298 int nbOfCompo=self->getNumberOfComponents();
5303 if(PyString_Check(obj))
5305 Py_ssize_t sz=PyString_Size(obj);
5306 char *pt=PyString_AsString(obj);
5308 return self->locateValue(pt[0]);
5310 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5313 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5316 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5320 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5322 int nbOfCompo=self->getNumberOfComponents();
5329 if(PyString_Check(obj))
5331 Py_ssize_t sz=PyString_Size(obj);
5332 char *pt=PyString_AsString(obj);
5334 return self->presenceOfValue(pt[0]);
5336 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5339 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5342 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5346 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5349 std::vector<int> stdvecTyyppArr;
5350 std::pair<int, std::pair<int,int> > sTyyppArr;
5351 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5352 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5356 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5358 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5360 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5362 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5364 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5368 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5370 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.";
5372 std::vector<int> stdvecTyyppArr;
5373 std::pair<int, std::pair<int,int> > sTyyppArr;
5374 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5375 int nbOfCompo=self->getNumberOfComponents();
5376 int nbOfTuples=self->getNumberOfTuples();
5377 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5379 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5380 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5389 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5395 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5396 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5399 //value vector<string>
5402 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5403 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5406 //value DataArrayChar
5409 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5413 throw INTERP_KERNEL::Exception(msg);
5417 {//obj list-tuple[int]
5423 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5429 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5430 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5433 //value vector<string>
5436 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5437 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5440 //value DataArrayChar
5443 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5447 throw INTERP_KERNEL::Exception(msg);
5458 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5464 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5465 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5468 //value vector<string>
5471 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5472 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5475 //value DataArrayChar
5478 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5482 throw INTERP_KERNEL::Exception(msg);
5493 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5499 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5500 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5503 //value vector<string>
5506 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5507 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5510 //value DataArrayChar
5513 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5517 throw INTERP_KERNEL::Exception(msg);
5522 throw INTERP_KERNEL::Exception(msg);
5528 class DataArrayAsciiCharTuple;
5530 class DataArrayAsciiCharIterator
5533 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5534 ~DataArrayAsciiCharIterator();
5539 DataArrayAsciiCharTuple *ret=self->nextt();
5541 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5544 PyErr_SetString(PyExc_StopIteration,"No more data.");
5551 class DataArrayAsciiCharTuple
5554 int getNumberOfCompo() const;
5555 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5558 std::string __str__() const
5560 return self->repr();
5563 DataArrayAsciiChar *buildDAAsciiChar()
5565 return self->buildDAAsciiChar(1,self->getNumberOfCompo());