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 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2362 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2);
2363 static DataArrayInt *Aggregate(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2364 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2365 static DataArrayInt *Meld(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2366 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2367 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2368 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2371 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2373 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2374 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2375 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2376 void computeOffsets() throw(INTERP_KERNEL::Exception);
2377 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2383 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2384 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2385 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2386 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2388 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2389 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2390 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2391 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2392 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2393 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2394 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2396 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2399 DataArrayInt() throw(INTERP_KERNEL::Exception)
2401 return DataArrayInt::New();
2404 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2406 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)";
2407 std::string msg(msgBase);
2409 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2412 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2416 if(PyInt_Check(nbOfTuples))
2418 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2420 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2423 if(PyInt_Check(nbOfComp))
2424 {//DataArrayInt.New([1,3,4,5],2,2)
2425 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2427 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2428 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2429 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2430 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2434 throw INTERP_KERNEL::Exception(msg.c_str());
2437 {//DataArrayInt.New([1,3,4],3)
2438 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2440 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2441 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2446 throw INTERP_KERNEL::Exception(msg.c_str());
2449 {// DataArrayInt.New([1,3,4])
2450 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2451 int tmpp1=-1,tmpp2=-1;
2452 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2453 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2457 else if(PyInt_Check(elt0))
2459 int nbOfTuples1=PyInt_AS_LONG(elt0);
2461 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2466 if(PyInt_Check(nbOfTuples))
2467 {//DataArrayInt.New(5,2)
2468 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2470 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2471 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2472 ret->alloc(nbOfTuples1,nbOfCompo);
2476 throw INTERP_KERNEL::Exception(msg.c_str());
2479 throw INTERP_KERNEL::Exception(msg.c_str());
2482 {//DataArrayInt.New(5)
2483 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2484 ret->alloc(nbOfTuples1,1);
2489 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2490 {//DataArrayInt.New(numpyArray)
2491 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
2495 throw INTERP_KERNEL::Exception(msg.c_str());
2498 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2500 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2503 std::string __str__() const throw(INTERP_KERNEL::Exception)
2505 return self->repr();
2508 int __len__() const throw(INTERP_KERNEL::Exception)
2510 if(self->isAllocated())
2512 return self->getNumberOfTuples();
2516 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2520 int __int__() const throw(INTERP_KERNEL::Exception)
2522 return self->intValue();
2525 DataArrayIntIterator *__iter__()
2527 return self->iterator();
2530 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2532 int sz=self->getNumberOfComponents();
2533 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2534 self->accumulate(tmp);
2535 return convertIntArrToPyList(tmp,sz);
2538 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2541 std::vector<int> val2;
2542 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2543 return self->accumulatePerChunck(bg,bg+sz);
2546 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2548 int newNbOfTuples=-1;
2549 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2550 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2551 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2552 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2553 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2554 PyObject *ret=PyTuple_New(2);
2555 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2556 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2560 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2562 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 !";
2563 if(PyList_Check(li) || PyTuple_Check(li))
2567 if(PyInt_Check(nbOfTuples))
2569 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2571 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2574 if(PyInt_Check(nbOfComp))
2575 {//DataArrayInt.setValues([1,3,4,5],2,2)
2576 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2578 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2579 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2580 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2583 throw INTERP_KERNEL::Exception(msg);
2586 {//DataArrayInt.setValues([1,3,4],3)
2588 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2589 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2593 throw INTERP_KERNEL::Exception(msg);
2596 {// DataArrayInt.setValues([1,3,4])
2597 int tmpp1=-1,tmpp2=-1;
2598 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2599 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2603 throw INTERP_KERNEL::Exception(msg);
2606 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2608 const int *vals=self->getConstPointer();
2609 return convertIntArrToPyList(vals,self->getNbOfElems());
2613 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2615 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT,"DataArrayInt");
2619 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2622 bool ret0=self->isEqualIfNotWhy(other,ret1);
2623 PyObject *ret=PyTuple_New(2);
2624 PyObject *ret0Py=ret0?Py_True:Py_False;
2626 PyTuple_SetItem(ret,0,ret0Py);
2627 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2631 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2633 const int *vals=self->getConstPointer();
2634 int nbOfComp=self->getNumberOfComponents();
2635 int nbOfTuples=self->getNumberOfTuples();
2636 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2639 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2641 std::vector<const DataArrayInt *> groups;
2642 std::vector< std::vector<int> > fidsOfGroups;
2643 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2644 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2645 PyObject *ret = PyList_New(2);
2646 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2647 int sz=fidsOfGroups.size();
2648 PyObject *ret1 = PyList_New(sz);
2649 for(int i=0;i<sz;i++)
2650 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2651 PyList_SetItem(ret,1,ret1);
2655 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2658 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2659 if (!SWIG_IsOK(res1))
2662 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2663 self->transformWithIndArr(tmp,tmp+size);
2667 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2668 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2672 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2676 std::vector<int> multiVal;
2677 std::pair<int, std::pair<int,int> > slic;
2678 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2679 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2683 return self->getIdsEqualList(&singleVal,&singleVal+1);
2685 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2687 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2689 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2693 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2697 std::vector<int> multiVal;
2698 std::pair<int, std::pair<int,int> > slic;
2699 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2700 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2704 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2706 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2708 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2710 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2714 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2716 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2718 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2719 if (!SWIG_IsOK(res1))
2722 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2723 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2727 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2729 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2730 da2->checkAllocated();
2731 int size=self->getNumberOfTuples();
2732 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2734 PyObject *ret = PyList_New(3);
2735 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2736 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2737 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2741 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2744 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2745 if (!SWIG_IsOK(res1))
2748 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2749 return self->transformWithIndArrR(tmp,tmp+size);
2753 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2754 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2758 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2761 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2762 if (!SWIG_IsOK(res1))
2765 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2766 if(size!=self->getNumberOfTuples())
2768 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2770 return self->renumberAndReduce(tmp,newNbOfTuple);
2774 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2776 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2777 da2->checkAllocated();
2778 int size=self->getNumberOfTuples();
2779 if(size!=self->getNumberOfTuples())
2781 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2783 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2787 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2790 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2791 if (!SWIG_IsOK(res1))
2794 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2795 if(size!=self->getNumberOfTuples())
2797 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2799 return self->renumber(tmp);
2803 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2805 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2806 da2->checkAllocated();
2807 int size=self->getNumberOfTuples();
2808 if(size!=self->getNumberOfTuples())
2810 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2812 return self->renumber(da2->getConstPointer());
2816 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2819 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2820 if (!SWIG_IsOK(res1))
2823 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2824 if(size!=self->getNumberOfTuples())
2826 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2828 return self->renumberR(tmp);
2832 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2834 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2835 da2->checkAllocated();
2836 int size=self->getNumberOfTuples();
2837 if(size!=self->getNumberOfTuples())
2839 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2841 return self->renumberR(da2->getConstPointer());
2845 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2848 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2849 if (!SWIG_IsOK(res1))
2852 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2853 return self->selectByTupleId(tmp,tmp+size);
2857 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2859 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2860 da2->checkAllocated();
2861 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2865 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2868 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2869 if (!SWIG_IsOK(res1))
2872 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2873 return self->selectByTupleIdSafe(tmp,tmp+size);
2877 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2879 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2880 da2->checkAllocated();
2881 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2885 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2887 std::vector<int> tmp;
2888 convertPyToNewIntArr3(li,tmp);
2889 self->setSelectedComponents(a,tmp);
2892 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2894 int sz=self->getNumberOfComponents();
2895 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2896 self->getTuple(tupleId,tmp);
2897 return convertIntArrToPyList(tmp,sz);
2900 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2902 DataArrayInt *arr=0;
2903 DataArrayInt *arrI=0;
2904 self->changeSurjectiveFormat(targetNb,arr,arrI);
2905 PyObject *res = PyList_New(2);
2906 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2907 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2911 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2913 std::vector<const DataArrayInt *> tmp;
2914 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2915 return DataArrayInt::Meld(tmp);
2918 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2920 std::vector<const DataArrayInt *> tmp;
2921 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2922 return DataArrayInt::Aggregate(tmp);
2925 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2927 std::vector<const DataArrayInt *> tmp;
2928 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2929 return DataArrayInt::BuildUnion(tmp);
2932 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2934 std::vector<const DataArrayInt *> tmp;
2935 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2936 return DataArrayInt::BuildIntersection(tmp);
2939 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2942 int r1=self->getMaxValue(tmp);
2943 PyObject *ret=PyTuple_New(2);
2944 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2945 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2949 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2952 int r1=self->getMinValue(tmp);
2953 PyObject *ret=PyTuple_New(2);
2954 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2955 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2959 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2961 int nbOfCompo=self->getNumberOfComponents();
2966 if(PyInt_Check(obj))
2968 int val=(int)PyInt_AS_LONG(obj);
2969 return self->locateValue(val);
2972 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2976 std::vector<int> arr;
2977 convertPyToNewIntArr3(obj,arr);
2978 return self->locateTuple(arr);
2983 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2985 int nbOfCompo=self->getNumberOfComponents();
2992 if(PyInt_Check(obj))
2994 int val=(int)PyInt_AS_LONG(obj);
2995 return self->presenceOfValue(val);
2998 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3002 std::vector<int> arr;
3003 convertPyToNewIntArr3(obj,arr);
3004 return self->presenceOfTuple(arr);
3009 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3011 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3012 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3013 self->checkAllocated();
3014 int nbOfTuples=self->getNumberOfTuples();
3015 int nbOfComponents=self->getNumberOfComponents();
3017 std::vector<int> vt1,vc1;
3018 std::pair<int, std::pair<int,int> > pt1,pc1;
3019 DataArrayInt *dt1=0,*dc1=0;
3021 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3022 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3027 if(nbOfComponents==1)
3028 return PyInt_FromLong(self->getIJSafe(it1,0));
3029 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3032 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3034 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3036 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3038 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3041 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3042 std::vector<int> v2(1,ic1);
3043 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3047 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3048 std::vector<int> v2(1,ic1);
3049 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3053 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3054 std::vector<int> v2(1,ic1);
3055 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3059 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3060 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3064 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3065 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3069 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3070 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3074 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3075 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3079 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3080 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3081 std::vector<int> v2(nbOfComp);
3082 for(int i=0;i<nbOfComp;i++)
3083 v2[i]=pc1.first+i*pc1.second.second;
3084 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3088 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3089 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3090 std::vector<int> v2(nbOfComp);
3091 for(int i=0;i<nbOfComp;i++)
3092 v2[i]=pc1.first+i*pc1.second.second;
3093 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3097 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3098 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3099 std::vector<int> v2(nbOfComp);
3100 for(int i=0;i<nbOfComp;i++)
3101 v2[i]=pc1.first+i*pc1.second.second;
3102 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3106 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3107 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3108 std::vector<int> v2(nbOfComp);
3109 for(int i=0;i<nbOfComp;i++)
3110 v2[i]=pc1.first+i*pc1.second.second;
3111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3114 throw INTERP_KERNEL::Exception(msg);
3118 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3120 self->checkAllocated();
3121 const char msg[]="Unexpected situation in __setitem__ !";
3122 int nbOfTuples=self->getNumberOfTuples();
3123 int nbOfComponents=self->getNumberOfComponents();
3126 std::vector<int> v1;
3128 DataArrayIntTuple *dd1=0;
3129 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3131 std::vector<int> vt1,vc1;
3132 std::pair<int, std::pair<int,int> > pt1,pc1;
3133 DataArrayInt *dt1=0,*dc1=0;
3134 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3135 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3143 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3146 tmp=DataArrayInt::New();
3147 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3148 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3151 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3154 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3155 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3158 throw INTERP_KERNEL::Exception(msg);
3167 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3170 tmp=DataArrayInt::New();
3171 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3172 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3175 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3178 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3179 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3182 throw INTERP_KERNEL::Exception(msg);
3191 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3194 tmp=DataArrayInt::New();
3195 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3196 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3199 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3202 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3203 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3206 throw INTERP_KERNEL::Exception(msg);
3215 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3218 tmp=DataArrayInt::New();
3219 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3220 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3223 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3226 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3227 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3230 throw INTERP_KERNEL::Exception(msg);
3239 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3242 tmp=DataArrayInt::New();
3243 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3244 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3247 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3250 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3251 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3254 throw INTERP_KERNEL::Exception(msg);
3263 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3266 tmp=DataArrayInt::New();
3267 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3268 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3271 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3274 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3275 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3278 throw INTERP_KERNEL::Exception(msg);
3287 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3290 tmp=DataArrayInt::New();
3291 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3292 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3295 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3298 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3299 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3302 throw INTERP_KERNEL::Exception(msg);
3311 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3314 tmp=DataArrayInt::New();
3315 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3316 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3319 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3322 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3323 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3326 throw INTERP_KERNEL::Exception(msg);
3335 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3338 tmp=DataArrayInt::New();
3339 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3340 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3343 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3346 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3347 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3350 throw INTERP_KERNEL::Exception(msg);
3359 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3362 tmp=DataArrayInt::New();
3363 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3364 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3367 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3370 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3371 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3374 throw INTERP_KERNEL::Exception(msg);
3383 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3386 tmp=DataArrayInt::New();
3387 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3388 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3391 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3394 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3395 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3398 throw INTERP_KERNEL::Exception(msg);
3407 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3410 tmp=DataArrayInt::New();
3411 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3412 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3415 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3418 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3419 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3422 throw INTERP_KERNEL::Exception(msg);
3431 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3434 tmp=DataArrayInt::New();
3435 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3436 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3439 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3442 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3443 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3446 throw INTERP_KERNEL::Exception(msg);
3455 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3458 tmp=DataArrayInt::New();
3459 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3460 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3463 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3466 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3467 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3470 throw INTERP_KERNEL::Exception(msg);
3479 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3482 tmp=DataArrayInt::New();
3483 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3484 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3487 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3490 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3491 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3494 throw INTERP_KERNEL::Exception(msg);
3503 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3506 tmp=DataArrayInt::New();
3507 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3508 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3511 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3514 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3515 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3518 throw INTERP_KERNEL::Exception(msg);
3523 throw INTERP_KERNEL::Exception(msg);
3528 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3530 return self->negate();
3533 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3535 const char msg[]="Unexpected situation in __add__ !";
3538 std::vector<int> aa;
3539 DataArrayIntTuple *aaa;
3541 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3546 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3547 ret->applyLin(1,val);
3552 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3553 return DataArrayInt::Add(self,aaaa);
3557 return DataArrayInt::Add(self,a);
3561 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3562 return DataArrayInt::Add(self,aaaa);
3565 throw INTERP_KERNEL::Exception(msg);
3569 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3571 const char msg[]="Unexpected situation in __radd__ !";
3574 std::vector<int> aa;
3575 DataArrayIntTuple *aaa;
3577 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3582 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3583 ret->applyLin(1,val);
3588 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3589 return DataArrayInt::Add(self,aaaa);
3593 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3594 return DataArrayInt::Add(self,aaaa);
3597 throw INTERP_KERNEL::Exception(msg);
3601 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3603 const char msg[]="Unexpected situation in __iadd__ !";
3606 std::vector<int> aa;
3607 DataArrayIntTuple *aaa;
3609 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3614 self->applyLin(1,val);
3615 Py_XINCREF(trueSelf);
3620 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3622 Py_XINCREF(trueSelf);
3628 Py_XINCREF(trueSelf);
3633 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3634 self->addEqual(aaaa);
3635 Py_XINCREF(trueSelf);
3639 throw INTERP_KERNEL::Exception(msg);
3643 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3645 const char msg[]="Unexpected situation in __sub__ !";
3648 std::vector<int> aa;
3649 DataArrayIntTuple *aaa;
3651 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3656 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3657 ret->applyLin(1,-val);
3662 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3663 return DataArrayInt::Substract(self,aaaa);
3667 return DataArrayInt::Substract(self,a);
3671 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3672 return DataArrayInt::Substract(self,aaaa);
3675 throw INTERP_KERNEL::Exception(msg);
3679 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3681 const char msg[]="Unexpected situation in __rsub__ !";
3684 std::vector<int> aa;
3685 DataArrayIntTuple *aaa;
3687 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3692 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3693 ret->applyLin(-1,val);
3698 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3699 return DataArrayInt::Substract(aaaa,self);
3703 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3704 return DataArrayInt::Substract(aaaa,self);
3707 throw INTERP_KERNEL::Exception(msg);
3711 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3713 const char msg[]="Unexpected situation in __isub__ !";
3716 std::vector<int> aa;
3717 DataArrayIntTuple *aaa;
3719 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3724 self->applyLin(1,-val);
3725 Py_XINCREF(trueSelf);
3730 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3731 self->substractEqual(bb);
3732 Py_XINCREF(trueSelf);
3737 self->substractEqual(a);
3738 Py_XINCREF(trueSelf);
3743 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3744 self->substractEqual(aaaa);
3745 Py_XINCREF(trueSelf);
3749 throw INTERP_KERNEL::Exception(msg);
3753 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3755 const char msg[]="Unexpected situation in __mul__ !";
3758 std::vector<int> aa;
3759 DataArrayIntTuple *aaa;
3761 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3766 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3767 ret->applyLin(val,0);
3772 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3773 return DataArrayInt::Multiply(self,aaaa);
3777 return DataArrayInt::Multiply(self,a);
3781 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3782 return DataArrayInt::Multiply(self,aaaa);
3785 throw INTERP_KERNEL::Exception(msg);
3789 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3791 const char msg[]="Unexpected situation in __rmul__ !";
3794 std::vector<int> aa;
3795 DataArrayIntTuple *aaa;
3797 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3802 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3803 ret->applyLin(val,0);
3808 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3809 return DataArrayInt::Multiply(self,aaaa);
3813 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3814 return DataArrayInt::Multiply(self,aaaa);
3817 throw INTERP_KERNEL::Exception(msg);
3821 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3823 const char msg[]="Unexpected situation in __imul__ !";
3826 std::vector<int> aa;
3827 DataArrayIntTuple *aaa;
3829 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3834 self->applyLin(val,0);
3835 Py_XINCREF(trueSelf);
3840 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3841 self->multiplyEqual(bb);
3842 Py_XINCREF(trueSelf);
3847 self->multiplyEqual(a);
3848 Py_XINCREF(trueSelf);
3853 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3854 self->multiplyEqual(aaaa);
3855 Py_XINCREF(trueSelf);
3859 throw INTERP_KERNEL::Exception(msg);
3863 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3865 const char msg[]="Unexpected situation in __div__ !";
3868 std::vector<int> aa;
3869 DataArrayIntTuple *aaa;
3871 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3876 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3877 ret->applyDivideBy(val);
3882 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3883 return DataArrayInt::Divide(self,aaaa);
3887 return DataArrayInt::Divide(self,a);
3891 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3892 return DataArrayInt::Divide(self,aaaa);
3895 throw INTERP_KERNEL::Exception(msg);
3899 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3901 const char msg[]="Unexpected situation in __rdiv__ !";
3904 std::vector<int> aa;
3905 DataArrayIntTuple *aaa;
3907 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3912 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3918 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3919 return DataArrayInt::Divide(aaaa,self);
3923 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3924 return DataArrayInt::Divide(aaaa,self);
3927 throw INTERP_KERNEL::Exception(msg);
3931 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3933 const char msg[]="Unexpected situation in __idiv__ !";
3936 std::vector<int> aa;
3937 DataArrayIntTuple *aaa;
3939 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3944 self->applyDivideBy(val);
3945 Py_XINCREF(trueSelf);
3950 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3951 self->divideEqual(bb);
3952 Py_XINCREF(trueSelf);
3957 self->divideEqual(a);
3958 Py_XINCREF(trueSelf);
3963 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3964 self->divideEqual(aaaa);
3965 Py_XINCREF(trueSelf);
3969 throw INTERP_KERNEL::Exception(msg);
3973 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3975 const char msg[]="Unexpected situation in __mod__ !";
3978 std::vector<int> aa;
3979 DataArrayIntTuple *aaa;
3981 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3986 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3987 ret->applyModulus(val);
3992 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3993 return DataArrayInt::Modulus(self,aaaa);
3997 return DataArrayInt::Modulus(self,a);
4001 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4002 return DataArrayInt::Modulus(self,aaaa);
4005 throw INTERP_KERNEL::Exception(msg);
4009 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4011 const char msg[]="Unexpected situation in __rmod__ !";
4014 std::vector<int> aa;
4015 DataArrayIntTuple *aaa;
4017 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4022 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4023 ret->applyRModulus(val);
4028 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4029 return DataArrayInt::Modulus(aaaa,self);
4033 return DataArrayInt::Modulus(a,self);
4037 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4038 return DataArrayInt::Modulus(aaaa,self);
4041 throw INTERP_KERNEL::Exception(msg);
4045 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4047 const char msg[]="Unexpected situation in __imod__ !";
4050 std::vector<int> aa;
4051 DataArrayIntTuple *aaa;
4053 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4058 self->applyModulus(val);
4059 Py_XINCREF(trueSelf);
4064 self->modulusEqual(a);
4065 Py_XINCREF(trueSelf);
4070 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4071 self->modulusEqual(aaaa);
4072 Py_XINCREF(trueSelf);
4076 throw INTERP_KERNEL::Exception(msg);
4080 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4082 const char msg[]="Unexpected situation in __pow__ !";
4085 std::vector<int> aa;
4086 DataArrayIntTuple *aaa;
4088 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4093 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4099 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4100 return DataArrayInt::Pow(self,aaaa);
4104 return DataArrayInt::Pow(self,a);
4108 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4109 return DataArrayInt::Pow(self,aaaa);
4112 throw INTERP_KERNEL::Exception(msg);
4116 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4118 const char msg[]="Unexpected situation in __rpow__ !";
4121 std::vector<int> aa;
4122 DataArrayIntTuple *aaa;
4124 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4129 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4130 ret->applyRPow(val);
4135 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4136 return DataArrayInt::Pow(aaaa,self);
4140 return DataArrayInt::Pow(a,self);
4144 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4145 return DataArrayInt::Pow(aaaa,self);
4148 throw INTERP_KERNEL::Exception(msg);
4152 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4154 const char msg[]="Unexpected situation in __ipow__ !";
4157 std::vector<int> aa;
4158 DataArrayIntTuple *aaa;
4160 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4165 self->applyPow(val);
4166 Py_XINCREF(trueSelf);
4172 Py_XINCREF(trueSelf);
4177 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4178 self->powEqual(aaaa);
4179 Py_XINCREF(trueSelf);
4183 throw INTERP_KERNEL::Exception(msg);
4187 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4189 std::ostringstream oss;
4190 self->reprQuickOverview(oss);
4194 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4196 int szArr,sw,iTypppArr;
4197 std::vector<int> stdvecTyyppArr;
4198 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4199 self->pushBackValsSilent(tmp,tmp+szArr);
4202 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4204 std::vector<int> ret1;
4205 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4206 std::size_t sz=ret0.size();
4207 PyObject *pyRet=PyTuple_New(2);
4208 PyObject *pyRet0=PyList_New((int)sz);
4209 PyObject *pyRet1=PyList_New((int)sz);
4210 for(std::size_t i=0;i<sz;i++)
4212 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4213 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4215 PyTuple_SetItem(pyRet,0,pyRet0);
4216 PyTuple_SetItem(pyRet,1,pyRet1);
4220 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4222 DataArrayInt *ret0=0,*ret1=0;
4223 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4224 PyObject *pyRet=PyTuple_New(2);
4225 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4226 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4232 class DataArrayIntTuple;
4234 class DataArrayIntIterator
4237 DataArrayIntIterator(DataArrayInt *da);
4238 ~DataArrayIntIterator();
4243 DataArrayIntTuple *ret=self->nextt();
4245 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4248 PyErr_SetString(PyExc_StopIteration,"No more data.");
4255 class DataArrayIntTuple
4258 int getNumberOfCompo() const;
4259 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4262 std::string __str__() const throw(INTERP_KERNEL::Exception)
4264 return self->repr();
4267 int __int__() const throw(INTERP_KERNEL::Exception)
4269 return self->intValue();
4272 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4274 return self->buildDAInt(1,self->getNumberOfCompo());
4277 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4279 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4280 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4281 Py_XINCREF(trueSelf);
4285 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4287 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4288 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4289 Py_XINCREF(trueSelf);
4293 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4295 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4296 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4297 Py_XINCREF(trueSelf);
4301 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4303 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4304 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4305 Py_XINCREF(trueSelf);
4309 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4311 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4312 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4313 Py_XINCREF(trueSelf);
4317 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4319 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4322 std::vector<int> multiVal;
4323 std::pair<int, std::pair<int,int> > slic;
4324 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4325 const int *pt=self->getConstPointer();
4326 int nbc=self->getNumberOfCompo();
4327 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4334 std::ostringstream oss;
4335 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4336 throw INTERP_KERNEL::Exception(oss.str().c_str());
4339 return PyInt_FromLong(pt[singleVal]);
4343 return PyInt_FromLong(pt[nbc+singleVal]);
4346 std::ostringstream oss;
4347 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4348 throw INTERP_KERNEL::Exception(oss.str().c_str());
4354 PyObject *t=PyTuple_New(multiVal.size());
4355 for(int j=0;j<(int)multiVal.size();j++)
4357 int cid=multiVal[j];
4360 std::ostringstream oss;
4361 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4362 throw INTERP_KERNEL::Exception(oss.str().c_str());
4364 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4370 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4371 PyObject *t=PyTuple_New(sz);
4372 for(int j=0;j<sz;j++)
4373 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4377 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4381 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4383 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4384 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4387 std::vector<int> multiValV;
4388 std::pair<int, std::pair<int,int> > slicV;
4389 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4390 int nbc=self->getNumberOfCompo();
4391 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4393 std::vector<int> multiVal;
4394 std::pair<int, std::pair<int,int> > slic;
4395 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4396 int *pt=self->getPointer();
4397 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4404 std::ostringstream oss;
4405 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4406 throw INTERP_KERNEL::Exception(oss.str().c_str());
4412 pt[singleVal]=singleValV;
4417 if(multiValV.size()!=1)
4419 std::ostringstream oss;
4420 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4421 throw INTERP_KERNEL::Exception(oss.str().c_str());
4423 pt[singleVal]=multiValV[0];
4428 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4432 throw INTERP_KERNEL::Exception(msg);
4441 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4445 std::ostringstream oss;
4446 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4447 throw INTERP_KERNEL::Exception(oss.str().c_str());
4455 if(multiVal.size()!=multiValV.size())
4457 std::ostringstream oss;
4458 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4459 throw INTERP_KERNEL::Exception(oss.str().c_str());
4461 for(int i=0;i<(int)multiVal.size();i++)
4463 int pos=multiVal[i];
4466 std::ostringstream oss;
4467 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4468 throw INTERP_KERNEL::Exception(oss.str().c_str());
4470 pt[multiVal[i]]=multiValV[i];
4476 const int *ptV=daIntTyyppV->getConstPointer();
4477 if(nbc>daIntTyyppV->getNumberOfCompo())
4479 std::ostringstream oss;
4480 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4481 throw INTERP_KERNEL::Exception(oss.str().c_str());
4483 std::copy(ptV,ptV+nbc,pt);
4487 throw INTERP_KERNEL::Exception(msg);
4492 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4497 for(int j=0;j<sz;j++)
4498 pt[slic.first+j*slic.second.second]=singleValV;
4503 if(sz!=(int)multiValV.size())
4505 std::ostringstream oss;
4506 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4507 throw INTERP_KERNEL::Exception(oss.str().c_str());
4509 for(int j=0;j<sz;j++)
4510 pt[slic.first+j*slic.second.second]=multiValV[j];
4515 const int *ptV=daIntTyyppV->getConstPointer();
4516 if(sz>daIntTyyppV->getNumberOfCompo())
4518 std::ostringstream oss;
4519 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4520 throw INTERP_KERNEL::Exception(oss.str().c_str());
4522 for(int j=0;j<sz;j++)
4523 pt[slic.first+j*slic.second.second]=ptV[j];
4527 throw INTERP_KERNEL::Exception(msg);
4531 throw INTERP_KERNEL::Exception(msg);
4537 class DataArrayChar : public DataArray
4540 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception) = 0;
4541 virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
4542 int getHashCode() const throw(INTERP_KERNEL::Exception);
4543 bool empty() const throw(INTERP_KERNEL::Exception);
4544 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4545 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4546 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4547 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4548 char popBackSilent() throw(INTERP_KERNEL::Exception);
4549 void pack() const throw(INTERP_KERNEL::Exception);
4550 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4551 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4552 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4553 void reverse() throw(INTERP_KERNEL::Exception);
4554 void fillWithZero() throw(INTERP_KERNEL::Exception);
4555 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4556 std::string repr() const throw(INTERP_KERNEL::Exception);
4557 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4558 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
4559 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4560 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4561 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4562 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4563 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4564 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4565 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4566 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4567 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4568 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4569 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4570 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4571 char back() const throw(INTERP_KERNEL::Exception);
4572 void setIJ(int tupleId, int compoId, char newVal);
4573 void setIJSilent(int tupleId, int compoId, char newVal);
4575 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4576 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4577 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4578 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4579 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4580 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4581 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4582 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4583 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4584 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2);
4585 static DataArrayChar *Aggregate(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
4586 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4587 static DataArrayChar *Meld(const std::vector<const DataArrayChar *>& arr) throw(INTERP_KERNEL::Exception);
4590 int __len__() const throw(INTERP_KERNEL::Exception)
4592 if(self->isAllocated())
4594 return self->getNumberOfTuples();
4598 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4602 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4605 bool ret0=self->isEqualIfNotWhy(other,ret1);
4606 PyObject *ret=PyTuple_New(2);
4607 PyObject *ret0Py=ret0?Py_True:Py_False;
4609 PyTuple_SetItem(ret,0,ret0Py);
4610 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4614 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4617 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4618 if (!SWIG_IsOK(res1))
4621 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4622 if(size!=self->getNumberOfTuples())
4624 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4626 return self->renumber(tmp);
4630 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4632 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4633 da2->checkAllocated();
4634 int size=self->getNumberOfTuples();
4635 if(size!=self->getNumberOfTuples())
4637 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4639 return self->renumber(da2->getConstPointer());
4643 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4646 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4647 if (!SWIG_IsOK(res1))
4650 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4651 if(size!=self->getNumberOfTuples())
4653 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4655 return self->renumberR(tmp);
4659 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4661 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4662 da2->checkAllocated();
4663 int size=self->getNumberOfTuples();
4664 if(size!=self->getNumberOfTuples())
4666 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4668 return self->renumberR(da2->getConstPointer());
4672 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4675 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4676 if (!SWIG_IsOK(res1))
4679 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4680 if(size!=self->getNumberOfTuples())
4682 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4684 return self->renumberAndReduce(tmp,newNbOfTuple);
4688 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4690 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4691 da2->checkAllocated();
4692 int size=self->getNumberOfTuples();
4693 if(size!=self->getNumberOfTuples())
4695 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4697 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4701 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4704 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4705 if (!SWIG_IsOK(res1))
4708 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4709 return self->selectByTupleIdSafe(tmp,tmp+size);
4713 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4715 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4716 da2->checkAllocated();
4717 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4721 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4723 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4724 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4725 return DataArrayChar::Aggregate(tmp);
4728 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4730 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4731 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4732 return DataArrayChar::Meld(tmp);
4737 class DataArrayByteIterator;
4739 class DataArrayByte : public DataArrayChar
4742 static DataArrayByte *New();
4743 DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4744 DataArrayByteIterator *iterator();
4745 DataArrayByte *performCpy(bool deepCpy) const;
4746 char byteValue() const throw(INTERP_KERNEL::Exception);
4749 DataArrayByte() throw(INTERP_KERNEL::Exception)
4751 return DataArrayByte::New();
4754 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4756 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) !";
4757 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4761 if(PyInt_Check(nbOfTuples))
4763 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4765 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4768 if(PyInt_Check(nbOfComp))
4769 {//DataArrayByte.New([1,3,4,5],2,2)
4770 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4772 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4773 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4774 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4775 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4779 throw INTERP_KERNEL::Exception(msg);
4782 {//DataArrayByte.New([1,3,4],3)
4783 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4785 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4786 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4791 throw INTERP_KERNEL::Exception(msg);
4794 {// DataArrayByte.New([1,3,4])
4795 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4796 int tmpp1=-1,tmpp2=-1;
4797 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4798 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4802 else if(PyInt_Check(elt0))
4804 int nbOfTuples1=PyInt_AS_LONG(elt0);
4806 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4811 if(PyInt_Check(nbOfTuples))
4812 {//DataArrayByte.New(5,2)
4813 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4815 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4816 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4817 ret->alloc(nbOfTuples1,nbOfCompo);
4821 throw INTERP_KERNEL::Exception(msg);
4824 throw INTERP_KERNEL::Exception(msg);
4827 {//DataArrayByte.New(5)
4828 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4829 ret->alloc(nbOfTuples1,1);
4834 throw INTERP_KERNEL::Exception(msg);
4837 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4839 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4842 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4844 std::ostringstream oss;
4845 self->reprQuickOverview(oss);
4849 int __int__() const throw(INTERP_KERNEL::Exception)
4851 return (int) self->byteValue();
4854 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4856 return self->iterator();
4859 int getIJ(int tupleId, int compoId) const
4861 return (int)self->getIJ(tupleId,compoId);
4864 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4866 return (int)self->getIJSafe(tupleId,compoId);
4869 std::string __str__() const throw(INTERP_KERNEL::Exception)
4871 return self->repr();
4874 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4876 const char *vals=self->getConstPointer();
4877 int nbOfComp=self->getNumberOfComponents();
4878 int nbOfTuples=self->getNumberOfTuples();
4879 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4882 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4885 int ival=-1; std::vector<int> ivval;
4886 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4887 std::vector<char> vals(sz);
4888 std::copy(pt,pt+sz,vals.begin());
4889 return self->presenceOfTuple(vals);
4892 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4895 int ival=-1; std::vector<int> ivval;
4896 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4897 std::vector<char> vals2(sz);
4898 std::copy(pt,pt+sz,vals2.begin());
4899 return self->presenceOfValue(vals2);
4902 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4905 int ival=-1; std::vector<int> ivval;
4906 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4907 std::vector<char> vals2(sz);
4908 std::copy(pt,pt+sz,vals2.begin());
4909 return self->locateValue(vals2);
4912 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4915 int ival=-1; std::vector<int> ivval;
4916 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4917 std::vector<char> vals(sz);
4918 std::copy(pt,pt+sz,vals.begin());
4919 return self->locateTuple(vals);
4922 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4925 int ival=-1; std::vector<int> ivval;
4926 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4927 std::vector<char> vals(sz);
4928 std::copy(pt,pt+sz,vals.begin());
4929 return self->search(vals);
4932 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4934 int sz=self->getNumberOfComponents();
4935 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4936 self->getTuple(tupleId,tmp);
4937 PyObject *ret=PyTuple_New(sz);
4938 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4942 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4945 int r1=(int)self->getMaxValue(tmp);
4946 PyObject *ret=PyTuple_New(2);
4947 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4948 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4952 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4955 int r1=(int)self->getMinValue(tmp);
4956 PyObject *ret=PyTuple_New(2);
4957 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4958 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4962 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4964 int nbOfCompo=self->getNumberOfComponents();
4969 if(PyInt_Check(obj))
4971 int val=(int)PyInt_AS_LONG(obj);
4972 return self->locateValue(val);
4975 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4978 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4982 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4984 int nbOfCompo=self->getNumberOfComponents();
4991 if(PyInt_Check(obj))
4993 int val=(int)PyInt_AS_LONG(obj);
4994 return self->presenceOfValue(val);
4997 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5000 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5006 class DataArrayByteTuple;
5008 class DataArrayByteIterator
5011 DataArrayByteIterator(DataArrayByte *da);
5012 ~DataArrayByteIterator();
5015 class DataArrayByteTuple
5018 std::string repr() const throw(INTERP_KERNEL::Exception);
5019 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5022 std::string __str__() const
5024 return self->repr();
5027 char __int__() const throw(INTERP_KERNEL::Exception)
5029 return self->byteValue();
5032 DataArrayByte *buildDAByte()
5034 return self->buildDAByte(1,self->getNumberOfCompo());
5039 class DataArrayAsciiCharIterator;
5041 class DataArrayAsciiChar : public DataArrayChar
5044 static DataArrayAsciiChar *New();
5045 DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
5046 DataArrayAsciiCharIterator *iterator();
5047 DataArrayAsciiChar *performCpy(bool deepCpy) const;
5048 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5051 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5053 return DataArrayAsciiChar::New();
5056 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5058 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) !";
5059 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5063 if(PyInt_Check(nbOfTuples))
5065 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5067 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5070 if(PyInt_Check(nbOfComp))
5071 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5072 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5074 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5075 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5076 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5077 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5081 throw INTERP_KERNEL::Exception(msg);
5084 {//DataArrayAsciiChar.New([1,3,4],3)
5085 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5087 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5088 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5092 else if(PyString_Check(nbOfTuples))
5094 if(PyString_Size(nbOfTuples)!=1)
5095 throw INTERP_KERNEL::Exception(msg);
5096 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5097 std::vector<std::string> tmp;
5098 if(fillStringVector(elt0,tmp))
5099 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5101 throw INTERP_KERNEL::Exception(msg);
5104 throw INTERP_KERNEL::Exception(msg);
5108 std::vector<std::string> tmmp;
5109 if(fillStringVector(elt0,tmmp))
5110 //DataArrayAsciiChar.New(["abc","de","fghi"])
5111 return DataArrayAsciiChar::New(tmmp,' ');
5114 // DataArrayAsciiChar.New([1,3,4])
5115 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5116 int tmpp1=-1,tmpp2=-1;
5117 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5118 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5123 else if(PyInt_Check(elt0))
5125 int nbOfTuples1=PyInt_AS_LONG(elt0);
5127 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5132 if(PyInt_Check(nbOfTuples))
5133 {//DataArrayAsciiChar.New(5,2)
5134 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5136 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5137 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5138 ret->alloc(nbOfTuples1,nbOfCompo);
5142 throw INTERP_KERNEL::Exception(msg);
5145 throw INTERP_KERNEL::Exception(msg);
5148 {//DataArrayAsciiChar.New(5)
5149 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5150 ret->alloc(nbOfTuples1,1);
5155 throw INTERP_KERNEL::Exception(msg);
5158 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5160 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5163 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5165 std::ostringstream oss;
5166 self->reprQuickOverview(oss);
5170 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5172 return self->iterator();
5175 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5177 char tmp[2]; tmp[1]='\0';
5178 tmp[0]=self->getIJ(tupleId,compoId);
5179 return std::string(tmp);
5182 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5184 char tmp[2]; tmp[1]='\0';
5185 tmp[0]=self->getIJSafe(tupleId,compoId);
5186 return std::string(tmp);
5189 std::string __str__() const throw(INTERP_KERNEL::Exception)
5191 return self->repr();
5194 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5196 const char *vals=self->getConstPointer();
5197 int nbOfComp=self->getNumberOfComponents();
5198 int nbOfTuples=self->getNumberOfTuples();
5199 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5202 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5204 if(PyString_Check(tupl))
5206 Py_ssize_t sz=PyString_Size(tupl);
5207 std::vector<char> vals(sz);
5208 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5209 return self->presenceOfTuple(vals);
5212 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5215 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5217 if(PyString_Check(vals))
5219 Py_ssize_t sz=PyString_Size(vals);
5220 std::vector<char> vals2(sz);
5221 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5222 return self->presenceOfValue(vals2);
5225 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5228 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5230 if(PyString_Check(vals))
5232 Py_ssize_t sz=PyString_Size(vals);
5233 std::vector<char> vals2(sz);
5234 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5235 return self->locateValue(vals2);
5238 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5241 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5243 if(PyString_Check(tupl))
5245 Py_ssize_t sz=PyString_Size(tupl);
5246 std::vector<char> vals(sz);
5247 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5248 return self->locateTuple(vals);
5251 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5254 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5256 if(PyString_Check(strOrListOfInt))
5258 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5259 std::vector<char> vals(sz);
5260 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5261 return self->search(vals);
5264 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5267 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5269 int sz=self->getNumberOfComponents();
5270 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5271 self->getTuple(tupleId,tmp);
5272 return PyString_FromString(tmp);
5275 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5278 char tmp2[2]; tmp2[1]='\0';
5279 tmp2[0]=self->getMaxValue(tmp);
5280 PyObject *ret=PyTuple_New(2);
5281 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5282 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5286 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5289 char tmp2[2]; tmp2[1]='\0';
5290 tmp2[0]=self->getMinValue(tmp);
5291 PyObject *ret=PyTuple_New(2);
5292 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5293 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5297 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5299 int nbOfCompo=self->getNumberOfComponents();
5304 if(PyString_Check(obj))
5306 Py_ssize_t sz=PyString_Size(obj);
5307 char *pt=PyString_AsString(obj);
5309 return self->locateValue(pt[0]);
5311 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5314 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5317 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5321 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5323 int nbOfCompo=self->getNumberOfComponents();
5330 if(PyString_Check(obj))
5332 Py_ssize_t sz=PyString_Size(obj);
5333 char *pt=PyString_AsString(obj);
5335 return self->presenceOfValue(pt[0]);
5337 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5340 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5343 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5347 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5350 std::vector<int> stdvecTyyppArr;
5351 std::pair<int, std::pair<int,int> > sTyyppArr;
5352 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5353 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5357 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5359 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5361 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5363 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5365 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5369 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5371 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.";
5373 std::vector<int> stdvecTyyppArr;
5374 std::pair<int, std::pair<int,int> > sTyyppArr;
5375 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5376 int nbOfCompo=self->getNumberOfComponents();
5377 int nbOfTuples=self->getNumberOfTuples();
5378 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5380 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5381 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5390 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5396 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5397 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5400 //value vector<string>
5403 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5404 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5407 //value DataArrayChar
5410 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5414 throw INTERP_KERNEL::Exception(msg);
5418 {//obj list-tuple[int]
5424 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5430 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5431 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5434 //value vector<string>
5437 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5438 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5441 //value DataArrayChar
5444 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5448 throw INTERP_KERNEL::Exception(msg);
5459 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5465 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5466 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5469 //value vector<string>
5472 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5473 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5476 //value DataArrayChar
5479 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5483 throw INTERP_KERNEL::Exception(msg);
5494 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5500 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5501 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5504 //value vector<string>
5507 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5508 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5511 //value DataArrayChar
5514 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5518 throw INTERP_KERNEL::Exception(msg);
5523 throw INTERP_KERNEL::Exception(msg);
5529 class DataArrayAsciiCharTuple;
5531 class DataArrayAsciiCharIterator
5534 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5535 ~DataArrayAsciiCharIterator();
5540 DataArrayAsciiCharTuple *ret=self->nextt();
5542 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5545 PyErr_SetString(PyExc_StopIteration,"No more data.");
5552 class DataArrayAsciiCharTuple
5555 int getNumberOfCompo() const;
5556 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5559 std::string __str__() const
5561 return self->repr();
5564 DataArrayAsciiChar *buildDAAsciiChar()
5566 return self->buildDAAsciiChar(1,self->getNumberOfCompo());