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 throw(INTERP_KERNEL::Exception);
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 throw(INTERP_KERNEL::Exception);
305 double front() const throw(INTERP_KERNEL::Exception);
306 double back() const throw(INTERP_KERNEL::Exception);
307 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
308 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
309 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
310 double *getPointer() throw(INTERP_KERNEL::Exception);
311 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
312 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
313 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
314 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
315 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
316 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
317 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
318 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
319 double getAverageValue() const throw(INTERP_KERNEL::Exception);
320 double norm2() const throw(INTERP_KERNEL::Exception);
321 double normMax() const throw(INTERP_KERNEL::Exception);
322 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
323 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
324 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
325 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
326 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
327 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
328 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
329 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
330 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
331 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
332 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
333 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
334 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
335 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
336 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
337 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
338 void abs() throw(INTERP_KERNEL::Exception);
339 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
340 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
341 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
342 void applyPow(double val) throw(INTERP_KERNEL::Exception);
343 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
344 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
345 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
346 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
347 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
348 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
349 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
350 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
351 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
352 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
353 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
354 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
355 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
356 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
357 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
358 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
359 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
360 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
361 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
362 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
363 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
364 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
365 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
366 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
367 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
368 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
371 DataArrayDouble() throw(INTERP_KERNEL::Exception)
373 return DataArrayDouble::New();
376 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
378 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)";
379 std::string msg(msgBase);
381 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
384 if(PyList_Check(elt0) || PyTuple_Check(elt0))
388 if(PyInt_Check(nbOfTuples))
390 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
392 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
395 if(PyInt_Check(elt2))
396 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
397 int nbOfCompo=PyInt_AS_LONG(elt2);
399 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
400 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
401 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
402 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
406 throw INTERP_KERNEL::Exception(msg.c_str());
409 {//DataArrayDouble.New([1.,3.,4.],3)
410 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
412 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
413 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
418 throw INTERP_KERNEL::Exception(msg.c_str());
421 {// DataArrayDouble.New([1.,3.,4.])
422 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
423 int tmpp1=-1,tmpp2=-1;
424 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
425 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
429 else if(PyInt_Check(elt0))
431 int nbOfTuples1=PyInt_AS_LONG(elt0);
433 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
438 if(PyInt_Check(nbOfTuples))
439 {//DataArrayDouble.New(5,2)
440 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
442 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
443 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
444 ret->alloc(nbOfTuples1,nbOfCompo);
448 throw INTERP_KERNEL::Exception(msg.c_str());
451 throw INTERP_KERNEL::Exception(msg.c_str());
454 {//DataArrayDouble.New(5)
455 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
456 ret->alloc(nbOfTuples1,1);
461 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
462 {//DataArrayDouble.New(numpyArray)
463 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
467 throw INTERP_KERNEL::Exception(msg.c_str());
470 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
472 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
475 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
478 std::vector<double> bb;
480 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
481 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
482 self->pushBackValsSilent(tmp,tmp+nbTuples);
485 std::string __repr__() const throw(INTERP_KERNEL::Exception)
487 std::ostringstream oss;
488 self->reprQuickOverview(oss);
492 std::string __str__() const throw(INTERP_KERNEL::Exception)
497 double __float__() const throw(INTERP_KERNEL::Exception)
499 return self->doubleValue();
502 int __len__() const throw(INTERP_KERNEL::Exception)
504 if(self->isAllocated())
506 return self->getNumberOfTuples();
510 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
514 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
516 return self->iterator();
519 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
521 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 !";
522 if(PyList_Check(li) || PyTuple_Check(li))
526 if(PyInt_Check(nbOfTuples))
528 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
530 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
533 if(PyInt_Check(nbOfComp))
534 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
535 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
537 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
538 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
539 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
542 throw INTERP_KERNEL::Exception(msg);
545 {//DataArrayDouble.setValues([1.,3.,4.],3)
547 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
548 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
552 throw INTERP_KERNEL::Exception(msg);
555 {// DataArrayDouble.setValues([1.,3.,4.])
556 int tmpp1=-1,tmpp2=-1;
557 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
558 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
562 throw INTERP_KERNEL::Exception(msg);
565 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
567 const double *vals=self->getConstPointer();
568 return convertDblArrToPyList(vals,self->getNbOfElems());
572 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
574 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
578 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
581 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
582 PyObject *ret=PyTuple_New(2);
583 PyObject *ret0Py=ret0?Py_True:Py_False;
585 PyTuple_SetItem(ret,0,ret0Py);
586 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
590 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
592 const double *vals=self->getConstPointer();
593 int nbOfComp=self->getNumberOfComponents();
594 int nbOfTuples=self->getNumberOfTuples();
595 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
598 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
601 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
602 if (!SWIG_IsOK(res1))
605 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
606 if(size!=self->getNumberOfTuples())
608 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
610 return self->renumber(tmp);
614 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
616 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
617 da2->checkAllocated();
618 int size=self->getNumberOfTuples();
619 if(size!=self->getNumberOfTuples())
621 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
623 return self->renumber(da2->getConstPointer());
627 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
630 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
631 if (!SWIG_IsOK(res1))
634 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
635 if(size!=self->getNumberOfTuples())
637 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
639 return self->renumberR(tmp);
643 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
645 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
646 da2->checkAllocated();
647 int size=self->getNumberOfTuples();
648 if(size!=self->getNumberOfTuples())
650 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
652 return self->renumberR(da2->getConstPointer());
656 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
659 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
660 if (!SWIG_IsOK(res1))
663 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
664 if(size!=self->getNumberOfTuples())
666 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
668 return self->renumberAndReduce(tmp,newNbOfTuple);
672 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
674 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
675 da2->checkAllocated();
676 int size=self->getNumberOfTuples();
677 if(size!=self->getNumberOfTuples())
679 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
681 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
685 DataArrayDouble *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
688 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
689 if (!SWIG_IsOK(res1))
692 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
693 return self->selectByTupleId(tmp,tmp+size);
697 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
699 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
700 da2->checkAllocated();
701 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
705 DataArrayDouble *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
708 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
709 if (!SWIG_IsOK(res1))
712 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
713 return self->selectByTupleIdSafe(tmp,tmp+size);
717 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
719 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
720 da2->checkAllocated();
721 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
725 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
727 int thisTupleId,otherTupleId;
728 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
729 PyObject *ret=PyTuple_New(3);
730 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
731 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
732 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
736 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
739 double r1=self->getMaxValue(tmp);
740 PyObject *ret=PyTuple_New(2);
741 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
742 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
746 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
749 double r1=self->getMaxValue2(tmp);
750 PyObject *ret=PyTuple_New(2);
751 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
752 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
756 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
759 double r1=self->getMinValue(tmp);
760 PyObject *ret=PyTuple_New(2);
761 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
762 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
766 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
769 double r1=self->getMinValue2(tmp);
770 PyObject *ret=PyTuple_New(2);
771 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
772 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
776 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
778 int nbOfCompo=self->getNumberOfComponents();
779 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
780 self->getMinMaxPerComponent(tmp);
781 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
785 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
787 int sz=self->getNumberOfComponents();
788 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
789 self->accumulate(tmp);
790 return convertDblArrToPyList(tmp,sz);
793 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
796 std::vector<int> val2;
797 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
798 return self->accumulatePerChunck(bg,bg+sz);
801 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
803 DataArrayInt *comm, *commIndex;
804 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
805 PyObject *res = PyList_New(2);
806 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
807 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
811 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
815 DataArrayDoubleTuple *aa;
816 std::vector<double> bb;
818 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
819 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
821 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
822 PyObject *ret=PyTuple_New(2);
823 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
824 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
828 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
830 std::vector<int> tmp;
831 convertPyToNewIntArr3(li,tmp);
832 self->setSelectedComponents(a,tmp);
835 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
837 int sz=self->getNumberOfComponents();
838 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
839 self->getTuple(tupleId,tmp);
840 return convertDblArrToPyList(tmp,sz);
843 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
845 std::vector<const DataArrayDouble *> tmp;
846 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
847 return DataArrayDouble::Aggregate(tmp);
850 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
852 std::vector<const DataArrayDouble *> tmp;
853 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
854 return DataArrayDouble::Meld(tmp);
857 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
861 DataArrayDoubleTuple *aa;
862 std::vector<double> bb;
864 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
865 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
866 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
867 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
868 DataArrayInt *c=0,*cI=0;
869 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
870 PyObject *ret=PyTuple_New(2);
871 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
872 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
876 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
878 DataArrayInt *ret1=0;
879 bool ret0=self->areIncludedInMe(other,prec,ret1);
880 PyObject *ret=PyTuple_New(2);
881 PyObject *ret0Py=ret0?Py_True:Py_False;
883 PyTuple_SetItem(ret,0,ret0Py);
884 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
888 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
890 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
891 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
892 self->checkAllocated();
893 int nbOfTuples=self->getNumberOfTuples();
894 int nbOfComponents=self->getNumberOfComponents();
896 std::vector<int> vt1,vc1;
897 std::pair<int, std::pair<int,int> > pt1,pc1;
898 DataArrayInt *dt1=0,*dc1=0;
900 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
901 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
905 if(nbOfComponents==1)
906 return PyFloat_FromDouble(self->getIJSafe(it1,0));
907 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
909 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
911 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
913 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
915 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
918 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
919 std::vector<int> v2(1,ic1);
920 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
924 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
925 std::vector<int> v2(1,ic1);
926 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
930 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
931 std::vector<int> v2(1,ic1);
932 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
936 ret=self->selectByTupleIdSafe(&it1,&it1+1);
937 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
941 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
942 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
946 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
947 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
951 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
952 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
956 ret=self->selectByTupleIdSafe(&it1,&it1+1);
957 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
958 std::vector<int> v2(nbOfComp);
959 for(int i=0;i<nbOfComp;i++)
960 v2[i]=pc1.first+i*pc1.second.second;
961 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
965 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
966 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
967 std::vector<int> v2(nbOfComp);
968 for(int i=0;i<nbOfComp;i++)
969 v2[i]=pc1.first+i*pc1.second.second;
970 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
974 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
975 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
976 std::vector<int> v2(nbOfComp);
977 for(int i=0;i<nbOfComp;i++)
978 v2[i]=pc1.first+i*pc1.second.second;
979 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
983 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
984 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
985 std::vector<int> v2(nbOfComp);
986 for(int i=0;i<nbOfComp;i++)
987 v2[i]=pc1.first+i*pc1.second.second;
988 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
991 throw INTERP_KERNEL::Exception(msg);
995 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
997 self->checkAllocated();
998 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
999 int nbOfTuples=self->getNumberOfTuples();
1000 int nbOfComponents=self->getNumberOfComponents();
1003 std::vector<double> v1;
1004 DataArrayDouble *d1=0;
1005 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1007 std::vector<int> vt1,vc1;
1008 std::pair<int, std::pair<int,int> > pt1,pc1;
1009 DataArrayInt *dt1=0,*dc1=0;
1010 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1011 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1019 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1022 tmp=DataArrayDouble::New();
1023 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1024 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1027 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1030 throw INTERP_KERNEL::Exception(msg);
1039 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1042 tmp=DataArrayDouble::New();
1043 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1044 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1047 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1050 throw INTERP_KERNEL::Exception(msg);
1059 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1062 tmp=DataArrayDouble::New();
1063 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1064 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1067 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1070 throw INTERP_KERNEL::Exception(msg);
1079 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1082 tmp=DataArrayDouble::New();
1083 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1084 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1087 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1090 throw INTERP_KERNEL::Exception(msg);
1099 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1102 tmp=DataArrayDouble::New();
1103 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1104 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1107 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1110 throw INTERP_KERNEL::Exception(msg);
1119 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1122 tmp=DataArrayDouble::New();
1123 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1124 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1127 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1130 throw INTERP_KERNEL::Exception(msg);
1139 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1142 tmp=DataArrayDouble::New();
1143 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1144 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1147 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1150 throw INTERP_KERNEL::Exception(msg);
1159 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1162 tmp=DataArrayDouble::New();
1163 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1164 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1167 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1170 throw INTERP_KERNEL::Exception(msg);
1179 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1182 tmp=DataArrayDouble::New();
1183 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1184 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1187 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1190 throw INTERP_KERNEL::Exception(msg);
1199 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1202 tmp=DataArrayDouble::New();
1203 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1204 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1207 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1210 throw INTERP_KERNEL::Exception(msg);
1219 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1222 tmp=DataArrayDouble::New();
1223 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1224 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1227 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1230 throw INTERP_KERNEL::Exception(msg);
1239 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1242 tmp=DataArrayDouble::New();
1243 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1244 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1247 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1250 throw INTERP_KERNEL::Exception(msg);
1259 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1262 tmp=DataArrayDouble::New();
1263 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1264 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1267 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1270 throw INTERP_KERNEL::Exception(msg);
1279 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1282 tmp=DataArrayDouble::New();
1283 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1284 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1287 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1290 throw INTERP_KERNEL::Exception(msg);
1299 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1302 tmp=DataArrayDouble::New();
1303 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1304 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1307 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1310 throw INTERP_KERNEL::Exception(msg);
1319 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1322 tmp=DataArrayDouble::New();
1323 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1324 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1327 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1330 throw INTERP_KERNEL::Exception(msg);
1335 throw INTERP_KERNEL::Exception(msg);
1340 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1342 return self->negate();
1345 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1347 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1350 DataArrayDoubleTuple *aa;
1351 std::vector<double> bb;
1355 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1357 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1360 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1361 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1363 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1366 throw INTERP_KERNEL::Exception(msg);
1369 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1374 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1375 ret->applyLin(1.,val);
1376 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1380 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1384 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1385 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1389 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1390 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1393 throw INTERP_KERNEL::Exception(msg);
1397 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1399 const char msg[]="Unexpected situation in __radd__ !";
1402 DataArrayDoubleTuple *aa;
1403 std::vector<double> bb;
1405 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1410 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1411 ret->applyLin(1.,val);
1416 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1417 return DataArrayDouble::Add(self,aaa);
1421 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1422 return DataArrayDouble::Add(self,aaa);
1425 throw INTERP_KERNEL::Exception(msg);
1429 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1431 const char msg[]="Unexpected situation in __iadd__ !";
1434 DataArrayDoubleTuple *aa;
1435 std::vector<double> bb;
1437 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1442 self->applyLin(1.,val);
1443 Py_XINCREF(trueSelf);
1449 Py_XINCREF(trueSelf);
1454 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1455 self->addEqual(aaa);
1456 Py_XINCREF(trueSelf);
1461 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1462 self->addEqual(aaa);
1463 Py_XINCREF(trueSelf);
1467 throw INTERP_KERNEL::Exception(msg);
1471 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1473 const char msg[]="Unexpected situation in __sub__ !";
1476 DataArrayDoubleTuple *aa;
1477 std::vector<double> bb;
1481 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1483 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1486 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1487 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1489 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1492 throw INTERP_KERNEL::Exception(msg);
1495 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1500 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1501 ret->applyLin(1.,-val);
1502 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1506 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1510 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1511 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1515 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1516 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1519 throw INTERP_KERNEL::Exception(msg);
1523 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1525 const char msg[]="Unexpected situation in __rsub__ !";
1528 DataArrayDoubleTuple *aa;
1529 std::vector<double> bb;
1531 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1536 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1537 ret->applyLin(-1.,val);
1542 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1543 return DataArrayDouble::Substract(aaa,self);
1547 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1548 return DataArrayDouble::Substract(aaa,self);
1551 throw INTERP_KERNEL::Exception(msg);
1555 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1557 const char msg[]="Unexpected situation in __isub__ !";
1560 DataArrayDoubleTuple *aa;
1561 std::vector<double> bb;
1563 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1568 self->applyLin(1,-val);
1569 Py_XINCREF(trueSelf);
1574 self->substractEqual(a);
1575 Py_XINCREF(trueSelf);
1580 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1581 self->substractEqual(aaa);
1582 Py_XINCREF(trueSelf);
1587 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1588 self->substractEqual(aaa);
1589 Py_XINCREF(trueSelf);
1593 throw INTERP_KERNEL::Exception(msg);
1597 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1599 const char msg[]="Unexpected situation in __mul__ !";
1602 DataArrayDoubleTuple *aa;
1603 std::vector<double> bb;
1607 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1609 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1612 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1613 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1615 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1618 throw INTERP_KERNEL::Exception(msg);
1621 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1626 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1627 ret->applyLin(val,0.);
1628 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1632 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1636 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1637 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1641 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1642 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1645 throw INTERP_KERNEL::Exception(msg);
1649 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1651 const char msg[]="Unexpected situation in __rmul__ !";
1654 DataArrayDoubleTuple *aa;
1655 std::vector<double> bb;
1657 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1662 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1663 ret->applyLin(val,0.);
1668 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1669 return DataArrayDouble::Multiply(self,aaa);
1673 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1674 return DataArrayDouble::Multiply(self,aaa);
1677 throw INTERP_KERNEL::Exception(msg);
1681 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1683 const char msg[]="Unexpected situation in __imul__ !";
1686 DataArrayDoubleTuple *aa;
1687 std::vector<double> bb;
1689 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1694 self->applyLin(val,0.);
1695 Py_XINCREF(trueSelf);
1700 self->multiplyEqual(a);
1701 Py_XINCREF(trueSelf);
1706 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1707 self->multiplyEqual(aaa);
1708 Py_XINCREF(trueSelf);
1713 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1714 self->multiplyEqual(aaa);
1715 Py_XINCREF(trueSelf);
1719 throw INTERP_KERNEL::Exception(msg);
1723 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1725 const char msg[]="Unexpected situation in __div__ !";
1728 DataArrayDoubleTuple *aa;
1729 std::vector<double> bb;
1733 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1735 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1738 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1739 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1741 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1744 throw INTERP_KERNEL::Exception(msg);
1747 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1753 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1754 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1755 ret->applyLin(1/val,0.);
1756 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1760 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1764 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1765 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1769 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1770 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1773 throw INTERP_KERNEL::Exception(msg);
1777 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1779 const char msg[]="Unexpected situation in __rdiv__ !";
1782 DataArrayDoubleTuple *aa;
1783 std::vector<double> bb;
1785 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1790 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1796 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1797 return DataArrayDouble::Divide(aaa,self);
1801 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1802 return DataArrayDouble::Divide(aaa,self);
1805 throw INTERP_KERNEL::Exception(msg);
1809 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1811 const char msg[]="Unexpected situation in __idiv__ !";
1814 DataArrayDoubleTuple *aa;
1815 std::vector<double> bb;
1817 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1823 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1824 self->applyLin(1./val,0.);
1825 Py_XINCREF(trueSelf);
1830 self->divideEqual(a);
1831 Py_XINCREF(trueSelf);
1836 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1837 self->divideEqual(aaa);
1838 Py_XINCREF(trueSelf);
1843 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1844 self->divideEqual(aaa);
1845 Py_XINCREF(trueSelf);
1849 throw INTERP_KERNEL::Exception(msg);
1853 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1855 const char msg[]="Unexpected situation in __pow__ !";
1858 DataArrayDoubleTuple *aa;
1859 std::vector<double> bb;
1861 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1866 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1872 return DataArrayDouble::Pow(self,a);
1876 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1877 return DataArrayDouble::Pow(self,aaa);
1881 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1882 return DataArrayDouble::Pow(self,aaa);
1885 throw INTERP_KERNEL::Exception(msg);
1889 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1891 const char msg[]="Unexpected situation in __rpow__ !";
1894 DataArrayDoubleTuple *aa;
1895 std::vector<double> bb;
1897 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1902 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1903 ret->applyRPow(val);
1908 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1909 return DataArrayDouble::Pow(aaa,self);
1913 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1914 return DataArrayDouble::Pow(aaa,self);
1917 throw INTERP_KERNEL::Exception(msg);
1921 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1923 const char msg[]="Unexpected situation in __ipow__ !";
1926 DataArrayDoubleTuple *aa;
1927 std::vector<double> bb;
1929 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1934 self->applyPow(val);
1935 Py_XINCREF(trueSelf);
1941 Py_XINCREF(trueSelf);
1946 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1947 self->powEqual(aaa);
1948 Py_XINCREF(trueSelf);
1953 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1954 self->powEqual(aaa);
1955 Py_XINCREF(trueSelf);
1959 throw INTERP_KERNEL::Exception(msg);
1963 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1965 DataArrayInt *c=0,*cI=0;
1967 self->computeTupleIdsNearTuples(other,eps,c,cI);
1968 PyObject *ret=PyTuple_New(2);
1969 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1970 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1974 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1976 DataArrayInt *ret1=0;
1977 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1978 PyObject *ret=PyTuple_New(2);
1979 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1980 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1986 class DataArrayDoubleTuple;
1988 class DataArrayDoubleIterator
1991 DataArrayDoubleIterator(DataArrayDouble *da);
1992 ~DataArrayDoubleIterator();
1997 DataArrayDoubleTuple *ret=self->nextt();
1999 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2002 PyErr_SetString(PyExc_StopIteration,"No more data.");
2009 class DataArrayDoubleTuple
2012 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2013 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2016 std::string __str__() const throw(INTERP_KERNEL::Exception)
2018 return self->repr();
2021 double __float__() const throw(INTERP_KERNEL::Exception)
2023 return self->doubleValue();
2026 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2028 return self->buildDADouble(1,self->getNumberOfCompo());
2031 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2033 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2034 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2035 Py_XINCREF(trueSelf);
2039 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2041 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2042 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2043 Py_XINCREF(trueSelf);
2047 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2049 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2050 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2051 Py_XINCREF(trueSelf);
2055 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2057 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2058 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2059 Py_XINCREF(trueSelf);
2063 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2065 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2068 std::vector<int> multiVal;
2069 std::pair<int, std::pair<int,int> > slic;
2070 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2071 const double *pt=self->getConstPointer();
2072 int nbc=self->getNumberOfCompo();
2073 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2080 std::ostringstream oss;
2081 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2082 throw INTERP_KERNEL::Exception(oss.str().c_str());
2085 return PyFloat_FromDouble(pt[singleVal]);
2089 return PyFloat_FromDouble(pt[nbc+singleVal]);
2092 std::ostringstream oss;
2093 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2094 throw INTERP_KERNEL::Exception(oss.str().c_str());
2100 PyObject *t=PyTuple_New(multiVal.size());
2101 for(int j=0;j<(int)multiVal.size();j++)
2103 int cid=multiVal[j];
2106 std::ostringstream oss;
2107 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2108 throw INTERP_KERNEL::Exception(oss.str().c_str());
2110 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2116 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2117 PyObject *t=PyTuple_New(sz);
2118 for(int j=0;j<sz;j++)
2119 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2123 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2127 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2129 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2130 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2133 std::vector<double> multiValV;
2134 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2135 int nbc=self->getNumberOfCompo();
2136 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2138 std::vector<int> multiVal;
2139 std::pair<int, std::pair<int,int> > slic;
2140 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2141 double *pt=self->getPointer();
2142 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2149 std::ostringstream oss;
2150 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2151 throw INTERP_KERNEL::Exception(oss.str().c_str());
2157 pt[singleVal]=singleValV;
2162 if(multiValV.size()!=1)
2164 std::ostringstream oss;
2165 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2166 throw INTERP_KERNEL::Exception(oss.str().c_str());
2168 pt[singleVal]=multiValV[0];
2173 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2177 throw INTERP_KERNEL::Exception(msg);
2186 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2190 std::ostringstream oss;
2191 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2192 throw INTERP_KERNEL::Exception(oss.str().c_str());
2200 if(multiVal.size()!=multiValV.size())
2202 std::ostringstream oss;
2203 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2204 throw INTERP_KERNEL::Exception(oss.str().c_str());
2206 for(int i=0;i<(int)multiVal.size();i++)
2208 int pos=multiVal[i];
2211 std::ostringstream oss;
2212 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2213 throw INTERP_KERNEL::Exception(oss.str().c_str());
2215 pt[multiVal[i]]=multiValV[i];
2221 const double *ptV=daIntTyyppV->getConstPointer();
2222 if(nbc>daIntTyyppV->getNumberOfCompo())
2224 std::ostringstream oss;
2225 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2226 throw INTERP_KERNEL::Exception(oss.str().c_str());
2228 std::copy(ptV,ptV+nbc,pt);
2232 throw INTERP_KERNEL::Exception(msg);
2237 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2242 for(int j=0;j<sz;j++)
2243 pt[slic.first+j*slic.second.second]=singleValV;
2248 if(sz!=(int)multiValV.size())
2250 std::ostringstream oss;
2251 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2252 throw INTERP_KERNEL::Exception(oss.str().c_str());
2254 for(int j=0;j<sz;j++)
2255 pt[slic.first+j*slic.second.second]=multiValV[j];
2260 const double *ptV=daIntTyyppV->getConstPointer();
2261 if(sz>daIntTyyppV->getNumberOfCompo())
2263 std::ostringstream oss;
2264 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2265 throw INTERP_KERNEL::Exception(oss.str().c_str());
2267 for(int j=0;j<sz;j++)
2268 pt[slic.first+j*slic.second.second]=ptV[j];
2272 throw INTERP_KERNEL::Exception(msg);
2276 throw INTERP_KERNEL::Exception(msg);
2282 class DataArrayIntIterator;
2284 class DataArrayInt : public DataArray
2287 static DataArrayInt *New();
2288 int intValue() const throw(INTERP_KERNEL::Exception);
2289 int getHashCode() const throw(INTERP_KERNEL::Exception);
2290 bool empty() const throw(INTERP_KERNEL::Exception);
2291 DataArrayInt *deepCpy() const throw(INTERP_KERNEL::Exception);
2292 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2293 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2294 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2295 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2296 int popBackSilent() throw(INTERP_KERNEL::Exception);
2297 void pack() const throw(INTERP_KERNEL::Exception);
2298 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2299 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2300 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2301 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2302 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2303 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2304 void reverse() throw(INTERP_KERNEL::Exception);
2305 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2306 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2307 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2308 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2309 void fillWithZero() throw(INTERP_KERNEL::Exception);
2310 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2311 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2312 std::string repr() const throw(INTERP_KERNEL::Exception);
2313 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2317 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
2318 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2319 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2320 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2321 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2323 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2324 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2325 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2326 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2327 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
2328 void transpose() throw(INTERP_KERNEL::Exception);
2329 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2330 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2331 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2332 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2333 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2334 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2335 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2336 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2337 int front() const throw(INTERP_KERNEL::Exception);
2338 int back() const throw(INTERP_KERNEL::Exception);
2339 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2340 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2341 int *getPointer() throw(INTERP_KERNEL::Exception);
2342 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2343 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2344 const int *begin() const throw(INTERP_KERNEL::Exception);
2345 const int *end() const throw(INTERP_KERNEL::Exception);
2346 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2347 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2348 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2349 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2350 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2351 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2352 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2353 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2354 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2355 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2356 int count(int value) const throw(INTERP_KERNEL::Exception);
2357 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2358 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2359 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2360 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2361 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2362 void abs() throw(INTERP_KERNEL::Exception);
2363 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2364 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2365 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2367 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2368 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2369 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2370 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2371 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2373 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2375 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2377 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2378 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2383 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2384 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2385 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2386 void computeOffsets() throw(INTERP_KERNEL::Exception);
2387 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2388 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2391 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2392 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2393 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2394 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2395 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2396 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2397 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2398 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2399 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2400 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2401 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2402 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2403 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2404 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2406 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2409 DataArrayInt() throw(INTERP_KERNEL::Exception)
2411 return DataArrayInt::New();
2414 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2416 const char *msgBase="ParaMEDMEM::DataArrayInt::New : Available API are : \n-DataArrayInt.New()\n-DataArrayInt.New([1,3,4])\n-DataArrayInt.New([1,3,4],3)\n-DataArrayInt.New([1,3,4,5],2,2)\n-DataArrayInt.New([1,3,4,5,7,8],3,2)\n-DataArrayInt.New([(1,3),(4,5),(7,8)])\n-DataArrayInt.New(5)\n-DataArrayInt.New(5,2)";
2417 std::string msg(msgBase);
2419 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2422 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2426 if(PyInt_Check(nbOfTuples))
2428 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2430 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2433 if(PyInt_Check(nbOfComp))
2434 {//DataArrayInt.New([1,3,4,5],2,2)
2435 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2437 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2438 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2439 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2440 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2444 throw INTERP_KERNEL::Exception(msg.c_str());
2447 {//DataArrayInt.New([1,3,4],3)
2448 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2450 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2451 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2456 throw INTERP_KERNEL::Exception(msg.c_str());
2459 {// DataArrayInt.New([1,3,4])
2460 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2461 int tmpp1=-1,tmpp2=-1;
2462 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2463 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2467 else if(PyInt_Check(elt0))
2469 int nbOfTuples1=PyInt_AS_LONG(elt0);
2471 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2476 if(PyInt_Check(nbOfTuples))
2477 {//DataArrayInt.New(5,2)
2478 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2480 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2481 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2482 ret->alloc(nbOfTuples1,nbOfCompo);
2486 throw INTERP_KERNEL::Exception(msg.c_str());
2489 throw INTERP_KERNEL::Exception(msg.c_str());
2492 {//DataArrayInt.New(5)
2493 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2494 ret->alloc(nbOfTuples1,1);
2499 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2500 {//DataArrayInt.New(numpyArray)
2501 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT,&PyCallBackDataArrayInt_RefType,"INT32");
2505 throw INTERP_KERNEL::Exception(msg.c_str());
2508 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2510 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2513 std::string __str__() const throw(INTERP_KERNEL::Exception)
2515 return self->repr();
2518 int __len__() const throw(INTERP_KERNEL::Exception)
2520 if(self->isAllocated())
2522 return self->getNumberOfTuples();
2526 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2530 int __int__() const throw(INTERP_KERNEL::Exception)
2532 return self->intValue();
2535 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2537 return self->iterator();
2540 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2542 int sz=self->getNumberOfComponents();
2543 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2544 self->accumulate(tmp);
2545 return convertIntArrToPyList(tmp,sz);
2548 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2551 std::vector<int> val2;
2552 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2553 return self->accumulatePerChunck(bg,bg+sz);
2556 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2558 int newNbOfTuples=-1;
2559 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2560 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2561 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2562 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2563 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2564 PyObject *ret=PyTuple_New(2);
2565 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2566 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2570 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2572 const char *msg="ParaMEDMEM::DataArrayInt::setValues : Available API are : \n-DataArrayInt.setValues([1,3,4])\n-DataArrayInt.setValues([1,3,4],3)\n-DataArrayInt.setValues([1,3,4,5],2,2)\n-DataArrayInt.New(5)\n !";
2573 if(PyList_Check(li) || PyTuple_Check(li))
2577 if(PyInt_Check(nbOfTuples))
2579 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2581 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2584 if(PyInt_Check(nbOfComp))
2585 {//DataArrayInt.setValues([1,3,4,5],2,2)
2586 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2588 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2589 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2590 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2593 throw INTERP_KERNEL::Exception(msg);
2596 {//DataArrayInt.setValues([1,3,4],3)
2598 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2599 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2603 throw INTERP_KERNEL::Exception(msg);
2606 {// DataArrayInt.setValues([1,3,4])
2607 int tmpp1=-1,tmpp2=-1;
2608 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2609 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2613 throw INTERP_KERNEL::Exception(msg);
2616 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2618 const int *vals=self->getConstPointer();
2619 return convertIntArrToPyList(vals,self->getNbOfElems());
2623 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2625 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT,"DataArrayInt");
2629 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2632 bool ret0=self->isEqualIfNotWhy(other,ret1);
2633 PyObject *ret=PyTuple_New(2);
2634 PyObject *ret0Py=ret0?Py_True:Py_False;
2636 PyTuple_SetItem(ret,0,ret0Py);
2637 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2641 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2643 const int *vals=self->getConstPointer();
2644 int nbOfComp=self->getNumberOfComponents();
2645 int nbOfTuples=self->getNumberOfTuples();
2646 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2649 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2651 std::vector<const DataArrayInt *> groups;
2652 std::vector< std::vector<int> > fidsOfGroups;
2653 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2654 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2655 PyObject *ret = PyList_New(2);
2656 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2657 int sz=fidsOfGroups.size();
2658 PyObject *ret1 = PyList_New(sz);
2659 for(int i=0;i<sz;i++)
2660 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2661 PyList_SetItem(ret,1,ret1);
2665 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2668 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2669 if (!SWIG_IsOK(res1))
2672 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2673 self->transformWithIndArr(tmp,tmp+size);
2677 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2678 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2682 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2686 std::vector<int> multiVal;
2687 std::pair<int, std::pair<int,int> > slic;
2688 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2689 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2693 return self->getIdsEqualList(&singleVal,&singleVal+1);
2695 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2697 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2699 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2703 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2707 std::vector<int> multiVal;
2708 std::pair<int, std::pair<int,int> > slic;
2709 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2710 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2714 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2716 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2718 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2720 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2724 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2726 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2728 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2729 if (!SWIG_IsOK(res1))
2732 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2733 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2737 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2739 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2740 da2->checkAllocated();
2741 int size=self->getNumberOfTuples();
2742 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2744 PyObject *ret = PyList_New(3);
2745 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2746 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2747 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2751 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2754 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2755 if (!SWIG_IsOK(res1))
2758 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2759 return self->transformWithIndArrR(tmp,tmp+size);
2763 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2764 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2768 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2771 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2772 if (!SWIG_IsOK(res1))
2775 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2776 if(size!=self->getNumberOfTuples())
2778 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2780 return self->renumberAndReduce(tmp,newNbOfTuple);
2784 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2786 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2787 da2->checkAllocated();
2788 int size=self->getNumberOfTuples();
2789 if(size!=self->getNumberOfTuples())
2791 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2793 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2797 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2800 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2801 if (!SWIG_IsOK(res1))
2804 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2805 if(size!=self->getNumberOfTuples())
2807 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2809 return self->renumber(tmp);
2813 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2815 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2816 da2->checkAllocated();
2817 int size=self->getNumberOfTuples();
2818 if(size!=self->getNumberOfTuples())
2820 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2822 return self->renumber(da2->getConstPointer());
2826 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2829 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2830 if (!SWIG_IsOK(res1))
2833 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2834 if(size!=self->getNumberOfTuples())
2836 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2838 return self->renumberR(tmp);
2842 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2844 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2845 da2->checkAllocated();
2846 int size=self->getNumberOfTuples();
2847 if(size!=self->getNumberOfTuples())
2849 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2851 return self->renumberR(da2->getConstPointer());
2855 DataArrayInt *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
2858 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2859 if (!SWIG_IsOK(res1))
2862 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2863 return self->selectByTupleId(tmp,tmp+size);
2867 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2869 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2870 da2->checkAllocated();
2871 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2875 DataArrayInt *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
2878 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2879 if (!SWIG_IsOK(res1))
2882 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2883 return self->selectByTupleIdSafe(tmp,tmp+size);
2887 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2889 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2890 da2->checkAllocated();
2891 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2895 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2897 std::vector<int> tmp;
2898 convertPyToNewIntArr3(li,tmp);
2899 self->setSelectedComponents(a,tmp);
2902 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2904 int sz=self->getNumberOfComponents();
2905 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2906 self->getTuple(tupleId,tmp);
2907 return convertIntArrToPyList(tmp,sz);
2910 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2912 DataArrayInt *arr=0;
2913 DataArrayInt *arrI=0;
2914 self->changeSurjectiveFormat(targetNb,arr,arrI);
2915 PyObject *res = PyList_New(2);
2916 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2917 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2921 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2923 std::vector<const DataArrayInt *> tmp;
2924 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2925 return DataArrayInt::Meld(tmp);
2928 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2930 std::vector<const DataArrayInt *> tmp;
2931 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2932 return DataArrayInt::Aggregate(tmp);
2935 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2937 std::vector<const DataArrayInt *> tmp;
2938 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2939 return DataArrayInt::AggregateIndexes(tmp);
2942 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2944 std::vector<const DataArrayInt *> tmp;
2945 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2946 return DataArrayInt::BuildUnion(tmp);
2949 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2951 std::vector<const DataArrayInt *> tmp;
2952 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
2953 return DataArrayInt::BuildIntersection(tmp);
2956 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2959 int r1=self->getMaxValue(tmp);
2960 PyObject *ret=PyTuple_New(2);
2961 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2962 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2966 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2969 int r1=self->getMinValue(tmp);
2970 PyObject *ret=PyTuple_New(2);
2971 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2972 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2976 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2978 int nbOfCompo=self->getNumberOfComponents();
2983 if(PyInt_Check(obj))
2985 int val=(int)PyInt_AS_LONG(obj);
2986 return self->locateValue(val);
2989 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2993 std::vector<int> arr;
2994 convertPyToNewIntArr3(obj,arr);
2995 return self->locateTuple(arr);
3000 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3002 int nbOfCompo=self->getNumberOfComponents();
3009 if(PyInt_Check(obj))
3011 int val=(int)PyInt_AS_LONG(obj);
3012 return self->presenceOfValue(val);
3015 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3019 std::vector<int> arr;
3020 convertPyToNewIntArr3(obj,arr);
3021 return self->presenceOfTuple(arr);
3026 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3028 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3029 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3030 self->checkAllocated();
3031 int nbOfTuples=self->getNumberOfTuples();
3032 int nbOfComponents=self->getNumberOfComponents();
3034 std::vector<int> vt1,vc1;
3035 std::pair<int, std::pair<int,int> > pt1,pc1;
3036 DataArrayInt *dt1=0,*dc1=0;
3038 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3039 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3044 if(nbOfComponents==1)
3045 return PyInt_FromLong(self->getIJSafe(it1,0));
3046 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3049 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3051 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3053 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3055 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3058 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3059 std::vector<int> v2(1,ic1);
3060 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3064 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3065 std::vector<int> v2(1,ic1);
3066 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3070 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3071 std::vector<int> v2(1,ic1);
3072 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3076 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3077 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3081 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3082 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3086 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3087 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3091 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3092 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3096 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3097 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3098 std::vector<int> v2(nbOfComp);
3099 for(int i=0;i<nbOfComp;i++)
3100 v2[i]=pc1.first+i*pc1.second.second;
3101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3105 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3106 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3107 std::vector<int> v2(nbOfComp);
3108 for(int i=0;i<nbOfComp;i++)
3109 v2[i]=pc1.first+i*pc1.second.second;
3110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3114 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3115 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3116 std::vector<int> v2(nbOfComp);
3117 for(int i=0;i<nbOfComp;i++)
3118 v2[i]=pc1.first+i*pc1.second.second;
3119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3123 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3124 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3125 std::vector<int> v2(nbOfComp);
3126 for(int i=0;i<nbOfComp;i++)
3127 v2[i]=pc1.first+i*pc1.second.second;
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3131 throw INTERP_KERNEL::Exception(msg);
3135 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3137 self->checkAllocated();
3138 const char msg[]="Unexpected situation in __setitem__ !";
3139 int nbOfTuples=self->getNumberOfTuples();
3140 int nbOfComponents=self->getNumberOfComponents();
3143 std::vector<int> v1;
3145 DataArrayIntTuple *dd1=0;
3146 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3148 std::vector<int> vt1,vc1;
3149 std::pair<int, std::pair<int,int> > pt1,pc1;
3150 DataArrayInt *dt1=0,*dc1=0;
3151 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3152 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3160 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3163 tmp=DataArrayInt::New();
3164 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3165 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3168 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3171 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3172 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3175 throw INTERP_KERNEL::Exception(msg);
3184 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3187 tmp=DataArrayInt::New();
3188 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3189 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3192 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3195 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3196 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3199 throw INTERP_KERNEL::Exception(msg);
3208 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3211 tmp=DataArrayInt::New();
3212 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3213 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3216 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3219 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3220 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3223 throw INTERP_KERNEL::Exception(msg);
3232 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3235 tmp=DataArrayInt::New();
3236 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3237 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3240 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3243 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3244 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3247 throw INTERP_KERNEL::Exception(msg);
3256 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3259 tmp=DataArrayInt::New();
3260 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3261 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3264 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3267 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3268 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3271 throw INTERP_KERNEL::Exception(msg);
3280 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3283 tmp=DataArrayInt::New();
3284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3285 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3288 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3291 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3292 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3295 throw INTERP_KERNEL::Exception(msg);
3304 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3307 tmp=DataArrayInt::New();
3308 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3309 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3312 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3315 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3316 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3319 throw INTERP_KERNEL::Exception(msg);
3328 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3331 tmp=DataArrayInt::New();
3332 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3333 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3336 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3339 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3340 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3343 throw INTERP_KERNEL::Exception(msg);
3352 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3355 tmp=DataArrayInt::New();
3356 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3357 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3360 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3363 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3364 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3367 throw INTERP_KERNEL::Exception(msg);
3376 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3379 tmp=DataArrayInt::New();
3380 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3381 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3384 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3387 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3388 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3391 throw INTERP_KERNEL::Exception(msg);
3400 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3403 tmp=DataArrayInt::New();
3404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3405 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3408 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3411 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3412 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3415 throw INTERP_KERNEL::Exception(msg);
3424 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3427 tmp=DataArrayInt::New();
3428 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3429 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3432 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3435 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3436 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3439 throw INTERP_KERNEL::Exception(msg);
3448 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3451 tmp=DataArrayInt::New();
3452 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3453 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3456 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3459 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3460 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3463 throw INTERP_KERNEL::Exception(msg);
3472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3475 tmp=DataArrayInt::New();
3476 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3477 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3480 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3483 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3484 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3487 throw INTERP_KERNEL::Exception(msg);
3496 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3499 tmp=DataArrayInt::New();
3500 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3501 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3504 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3507 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3508 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3511 throw INTERP_KERNEL::Exception(msg);
3520 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3523 tmp=DataArrayInt::New();
3524 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3525 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3528 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3531 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3532 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3535 throw INTERP_KERNEL::Exception(msg);
3540 throw INTERP_KERNEL::Exception(msg);
3545 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3547 return self->negate();
3550 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3552 const char msg[]="Unexpected situation in __add__ !";
3555 std::vector<int> aa;
3556 DataArrayIntTuple *aaa;
3558 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3563 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3564 ret->applyLin(1,val);
3569 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3570 return DataArrayInt::Add(self,aaaa);
3574 return DataArrayInt::Add(self,a);
3578 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3579 return DataArrayInt::Add(self,aaaa);
3582 throw INTERP_KERNEL::Exception(msg);
3586 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3588 const char msg[]="Unexpected situation in __radd__ !";
3591 std::vector<int> aa;
3592 DataArrayIntTuple *aaa;
3594 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3599 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3600 ret->applyLin(1,val);
3605 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3606 return DataArrayInt::Add(self,aaaa);
3610 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3611 return DataArrayInt::Add(self,aaaa);
3614 throw INTERP_KERNEL::Exception(msg);
3618 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3620 const char msg[]="Unexpected situation in __iadd__ !";
3623 std::vector<int> aa;
3624 DataArrayIntTuple *aaa;
3626 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3631 self->applyLin(1,val);
3632 Py_XINCREF(trueSelf);
3637 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3639 Py_XINCREF(trueSelf);
3645 Py_XINCREF(trueSelf);
3650 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3651 self->addEqual(aaaa);
3652 Py_XINCREF(trueSelf);
3656 throw INTERP_KERNEL::Exception(msg);
3660 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3662 const char msg[]="Unexpected situation in __sub__ !";
3665 std::vector<int> aa;
3666 DataArrayIntTuple *aaa;
3668 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3673 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3674 ret->applyLin(1,-val);
3679 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3680 return DataArrayInt::Substract(self,aaaa);
3684 return DataArrayInt::Substract(self,a);
3688 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3689 return DataArrayInt::Substract(self,aaaa);
3692 throw INTERP_KERNEL::Exception(msg);
3696 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3698 const char msg[]="Unexpected situation in __rsub__ !";
3701 std::vector<int> aa;
3702 DataArrayIntTuple *aaa;
3704 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3709 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3710 ret->applyLin(-1,val);
3715 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3716 return DataArrayInt::Substract(aaaa,self);
3720 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3721 return DataArrayInt::Substract(aaaa,self);
3724 throw INTERP_KERNEL::Exception(msg);
3728 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3730 const char msg[]="Unexpected situation in __isub__ !";
3733 std::vector<int> aa;
3734 DataArrayIntTuple *aaa;
3736 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3741 self->applyLin(1,-val);
3742 Py_XINCREF(trueSelf);
3747 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3748 self->substractEqual(bb);
3749 Py_XINCREF(trueSelf);
3754 self->substractEqual(a);
3755 Py_XINCREF(trueSelf);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3761 self->substractEqual(aaaa);
3762 Py_XINCREF(trueSelf);
3766 throw INTERP_KERNEL::Exception(msg);
3770 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3772 const char msg[]="Unexpected situation in __mul__ !";
3775 std::vector<int> aa;
3776 DataArrayIntTuple *aaa;
3778 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3783 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3784 ret->applyLin(val,0);
3789 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3790 return DataArrayInt::Multiply(self,aaaa);
3794 return DataArrayInt::Multiply(self,a);
3798 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3799 return DataArrayInt::Multiply(self,aaaa);
3802 throw INTERP_KERNEL::Exception(msg);
3806 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3808 const char msg[]="Unexpected situation in __rmul__ !";
3811 std::vector<int> aa;
3812 DataArrayIntTuple *aaa;
3814 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3820 ret->applyLin(val,0);
3825 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3826 return DataArrayInt::Multiply(self,aaaa);
3830 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3831 return DataArrayInt::Multiply(self,aaaa);
3834 throw INTERP_KERNEL::Exception(msg);
3838 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3840 const char msg[]="Unexpected situation in __imul__ !";
3843 std::vector<int> aa;
3844 DataArrayIntTuple *aaa;
3846 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3851 self->applyLin(val,0);
3852 Py_XINCREF(trueSelf);
3857 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3858 self->multiplyEqual(bb);
3859 Py_XINCREF(trueSelf);
3864 self->multiplyEqual(a);
3865 Py_XINCREF(trueSelf);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3871 self->multiplyEqual(aaaa);
3872 Py_XINCREF(trueSelf);
3876 throw INTERP_KERNEL::Exception(msg);
3880 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3882 const char msg[]="Unexpected situation in __div__ !";
3885 std::vector<int> aa;
3886 DataArrayIntTuple *aaa;
3888 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3893 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3894 ret->applyDivideBy(val);
3899 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3900 return DataArrayInt::Divide(self,aaaa);
3904 return DataArrayInt::Divide(self,a);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3909 return DataArrayInt::Divide(self,aaaa);
3912 throw INTERP_KERNEL::Exception(msg);
3916 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 const char msg[]="Unexpected situation in __rdiv__ !";
3921 std::vector<int> aa;
3922 DataArrayIntTuple *aaa;
3924 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3929 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3935 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3936 return DataArrayInt::Divide(aaaa,self);
3940 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3941 return DataArrayInt::Divide(aaaa,self);
3944 throw INTERP_KERNEL::Exception(msg);
3948 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3950 const char msg[]="Unexpected situation in __idiv__ !";
3953 std::vector<int> aa;
3954 DataArrayIntTuple *aaa;
3956 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3961 self->applyDivideBy(val);
3962 Py_XINCREF(trueSelf);
3967 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3968 self->divideEqual(bb);
3969 Py_XINCREF(trueSelf);
3974 self->divideEqual(a);
3975 Py_XINCREF(trueSelf);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3981 self->divideEqual(aaaa);
3982 Py_XINCREF(trueSelf);
3986 throw INTERP_KERNEL::Exception(msg);
3990 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3992 const char msg[]="Unexpected situation in __mod__ !";
3995 std::vector<int> aa;
3996 DataArrayIntTuple *aaa;
3998 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4003 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4004 ret->applyModulus(val);
4009 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4010 return DataArrayInt::Modulus(self,aaaa);
4014 return DataArrayInt::Modulus(self,a);
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4019 return DataArrayInt::Modulus(self,aaaa);
4022 throw INTERP_KERNEL::Exception(msg);
4026 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4028 const char msg[]="Unexpected situation in __rmod__ !";
4031 std::vector<int> aa;
4032 DataArrayIntTuple *aaa;
4034 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4039 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4040 ret->applyRModulus(val);
4045 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4046 return DataArrayInt::Modulus(aaaa,self);
4050 return DataArrayInt::Modulus(a,self);
4054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4055 return DataArrayInt::Modulus(aaaa,self);
4058 throw INTERP_KERNEL::Exception(msg);
4062 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4064 const char msg[]="Unexpected situation in __imod__ !";
4067 std::vector<int> aa;
4068 DataArrayIntTuple *aaa;
4070 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4075 self->applyModulus(val);
4076 Py_XINCREF(trueSelf);
4081 self->modulusEqual(a);
4082 Py_XINCREF(trueSelf);
4087 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4088 self->modulusEqual(aaaa);
4089 Py_XINCREF(trueSelf);
4093 throw INTERP_KERNEL::Exception(msg);
4097 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4099 const char msg[]="Unexpected situation in __pow__ !";
4102 std::vector<int> aa;
4103 DataArrayIntTuple *aaa;
4105 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4110 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4116 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4117 return DataArrayInt::Pow(self,aaaa);
4121 return DataArrayInt::Pow(self,a);
4125 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4126 return DataArrayInt::Pow(self,aaaa);
4129 throw INTERP_KERNEL::Exception(msg);
4133 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4135 const char msg[]="Unexpected situation in __rpow__ !";
4138 std::vector<int> aa;
4139 DataArrayIntTuple *aaa;
4141 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4146 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4147 ret->applyRPow(val);
4152 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4153 return DataArrayInt::Pow(aaaa,self);
4157 return DataArrayInt::Pow(a,self);
4161 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4162 return DataArrayInt::Pow(aaaa,self);
4165 throw INTERP_KERNEL::Exception(msg);
4169 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4171 const char msg[]="Unexpected situation in __ipow__ !";
4174 std::vector<int> aa;
4175 DataArrayIntTuple *aaa;
4177 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4182 self->applyPow(val);
4183 Py_XINCREF(trueSelf);
4189 Py_XINCREF(trueSelf);
4194 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4195 self->powEqual(aaaa);
4196 Py_XINCREF(trueSelf);
4200 throw INTERP_KERNEL::Exception(msg);
4204 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4206 std::ostringstream oss;
4207 self->reprQuickOverview(oss);
4211 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4213 int szArr,sw,iTypppArr;
4214 std::vector<int> stdvecTyyppArr;
4215 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4216 self->pushBackValsSilent(tmp,tmp+szArr);
4219 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4221 std::vector<int> ret1;
4222 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4223 std::size_t sz=ret0.size();
4224 PyObject *pyRet=PyTuple_New(2);
4225 PyObject *pyRet0=PyList_New((int)sz);
4226 PyObject *pyRet1=PyList_New((int)sz);
4227 for(std::size_t i=0;i<sz;i++)
4229 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4230 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4232 PyTuple_SetItem(pyRet,0,pyRet0);
4233 PyTuple_SetItem(pyRet,1,pyRet1);
4237 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4239 DataArrayInt *ret0=0,*ret1=0;
4240 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4241 PyObject *pyRet=PyTuple_New(2);
4242 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4243 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4249 class DataArrayIntTuple;
4251 class DataArrayIntIterator
4254 DataArrayIntIterator(DataArrayInt *da);
4255 ~DataArrayIntIterator();
4260 DataArrayIntTuple *ret=self->nextt();
4262 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4265 PyErr_SetString(PyExc_StopIteration,"No more data.");
4272 class DataArrayIntTuple
4275 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4276 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4279 std::string __str__() const throw(INTERP_KERNEL::Exception)
4281 return self->repr();
4284 int __int__() const throw(INTERP_KERNEL::Exception)
4286 return self->intValue();
4289 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4291 return self->buildDAInt(1,self->getNumberOfCompo());
4294 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4296 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4297 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4298 Py_XINCREF(trueSelf);
4302 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4304 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4305 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4306 Py_XINCREF(trueSelf);
4310 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4312 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4313 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4314 Py_XINCREF(trueSelf);
4318 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4321 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4322 Py_XINCREF(trueSelf);
4326 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4328 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4329 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4330 Py_XINCREF(trueSelf);
4334 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4336 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4339 std::vector<int> multiVal;
4340 std::pair<int, std::pair<int,int> > slic;
4341 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4342 const int *pt=self->getConstPointer();
4343 int nbc=self->getNumberOfCompo();
4344 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4351 std::ostringstream oss;
4352 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4353 throw INTERP_KERNEL::Exception(oss.str().c_str());
4356 return PyInt_FromLong(pt[singleVal]);
4360 return PyInt_FromLong(pt[nbc+singleVal]);
4363 std::ostringstream oss;
4364 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4365 throw INTERP_KERNEL::Exception(oss.str().c_str());
4371 PyObject *t=PyTuple_New(multiVal.size());
4372 for(int j=0;j<(int)multiVal.size();j++)
4374 int cid=multiVal[j];
4377 std::ostringstream oss;
4378 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4379 throw INTERP_KERNEL::Exception(oss.str().c_str());
4381 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4387 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4388 PyObject *t=PyTuple_New(sz);
4389 for(int j=0;j<sz;j++)
4390 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4394 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4398 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4400 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4401 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4404 std::vector<int> multiValV;
4405 std::pair<int, std::pair<int,int> > slicV;
4406 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4407 int nbc=self->getNumberOfCompo();
4408 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4410 std::vector<int> multiVal;
4411 std::pair<int, std::pair<int,int> > slic;
4412 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4413 int *pt=self->getPointer();
4414 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4421 std::ostringstream oss;
4422 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4423 throw INTERP_KERNEL::Exception(oss.str().c_str());
4429 pt[singleVal]=singleValV;
4434 if(multiValV.size()!=1)
4436 std::ostringstream oss;
4437 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4438 throw INTERP_KERNEL::Exception(oss.str().c_str());
4440 pt[singleVal]=multiValV[0];
4445 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4449 throw INTERP_KERNEL::Exception(msg);
4458 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4462 std::ostringstream oss;
4463 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4464 throw INTERP_KERNEL::Exception(oss.str().c_str());
4472 if(multiVal.size()!=multiValV.size())
4474 std::ostringstream oss;
4475 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4476 throw INTERP_KERNEL::Exception(oss.str().c_str());
4478 for(int i=0;i<(int)multiVal.size();i++)
4480 int pos=multiVal[i];
4483 std::ostringstream oss;
4484 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4485 throw INTERP_KERNEL::Exception(oss.str().c_str());
4487 pt[multiVal[i]]=multiValV[i];
4493 const int *ptV=daIntTyyppV->getConstPointer();
4494 if(nbc>daIntTyyppV->getNumberOfCompo())
4496 std::ostringstream oss;
4497 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4498 throw INTERP_KERNEL::Exception(oss.str().c_str());
4500 std::copy(ptV,ptV+nbc,pt);
4504 throw INTERP_KERNEL::Exception(msg);
4509 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4514 for(int j=0;j<sz;j++)
4515 pt[slic.first+j*slic.second.second]=singleValV;
4520 if(sz!=(int)multiValV.size())
4522 std::ostringstream oss;
4523 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4524 throw INTERP_KERNEL::Exception(oss.str().c_str());
4526 for(int j=0;j<sz;j++)
4527 pt[slic.first+j*slic.second.second]=multiValV[j];
4532 const int *ptV=daIntTyyppV->getConstPointer();
4533 if(sz>daIntTyyppV->getNumberOfCompo())
4535 std::ostringstream oss;
4536 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4537 throw INTERP_KERNEL::Exception(oss.str().c_str());
4539 for(int j=0;j<sz;j++)
4540 pt[slic.first+j*slic.second.second]=ptV[j];
4544 throw INTERP_KERNEL::Exception(msg);
4548 throw INTERP_KERNEL::Exception(msg);
4554 class DataArrayChar : public DataArray
4557 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4558 virtual DataArrayChar *deepCpy() const throw(INTERP_KERNEL::Exception);
4559 int getHashCode() const throw(INTERP_KERNEL::Exception);
4560 bool empty() const throw(INTERP_KERNEL::Exception);
4561 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4562 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4563 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4564 void pushBackValsSilent(const char *valsBg, const char *valsEnd) throw(INTERP_KERNEL::Exception);
4565 char popBackSilent() throw(INTERP_KERNEL::Exception);
4566 void pack() const throw(INTERP_KERNEL::Exception);
4567 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4568 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4569 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4570 void reverse() throw(INTERP_KERNEL::Exception);
4571 void fillWithZero() throw(INTERP_KERNEL::Exception);
4572 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4573 std::string repr() const throw(INTERP_KERNEL::Exception);
4574 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4575 void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
4576 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4577 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4578 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4579 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4580 DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception);
4581 DataArrayChar *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
4582 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4583 void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
4584 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4585 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4586 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4587 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4588 char front() const throw(INTERP_KERNEL::Exception);
4589 char back() const throw(INTERP_KERNEL::Exception);
4590 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4591 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4592 char *getPointer() throw(INTERP_KERNEL::Exception);
4593 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4594 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4595 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4596 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4597 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4598 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4599 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4600 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4601 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4602 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4603 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4606 int __len__() const throw(INTERP_KERNEL::Exception)
4608 if(self->isAllocated())
4610 return self->getNumberOfTuples();
4614 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4618 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4621 bool ret0=self->isEqualIfNotWhy(other,ret1);
4622 PyObject *ret=PyTuple_New(2);
4623 PyObject *ret0Py=ret0?Py_True:Py_False;
4625 PyTuple_SetItem(ret,0,ret0Py);
4626 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4630 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4633 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4634 if (!SWIG_IsOK(res1))
4637 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4638 if(size!=self->getNumberOfTuples())
4640 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4642 return self->renumber(tmp);
4646 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4648 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4649 da2->checkAllocated();
4650 int size=self->getNumberOfTuples();
4651 if(size!=self->getNumberOfTuples())
4653 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4655 return self->renumber(da2->getConstPointer());
4659 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4662 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4663 if (!SWIG_IsOK(res1))
4666 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4667 if(size!=self->getNumberOfTuples())
4669 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4671 return self->renumberR(tmp);
4675 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4677 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4678 da2->checkAllocated();
4679 int size=self->getNumberOfTuples();
4680 if(size!=self->getNumberOfTuples())
4682 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4684 return self->renumberR(da2->getConstPointer());
4688 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4691 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4692 if (!SWIG_IsOK(res1))
4695 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4696 if(size!=self->getNumberOfTuples())
4698 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4700 return self->renumberAndReduce(tmp,newNbOfTuple);
4704 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4706 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4707 da2->checkAllocated();
4708 int size=self->getNumberOfTuples();
4709 if(size!=self->getNumberOfTuples())
4711 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4713 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4717 DataArrayChar *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
4720 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4721 if (!SWIG_IsOK(res1))
4724 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4725 return self->selectByTupleIdSafe(tmp,tmp+size);
4729 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4731 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4732 da2->checkAllocated();
4733 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
4737 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4739 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4740 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4741 return DataArrayChar::Aggregate(tmp);
4744 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4746 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4747 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4748 return DataArrayChar::Meld(tmp);
4753 class DataArrayByteIterator;
4755 class DataArrayByte : public DataArrayChar
4758 static DataArrayByte *New();
4759 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4760 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4761 char byteValue() const throw(INTERP_KERNEL::Exception);
4764 DataArrayByte() throw(INTERP_KERNEL::Exception)
4766 return DataArrayByte::New();
4769 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4771 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) !";
4772 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4776 if(PyInt_Check(nbOfTuples))
4778 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4780 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4783 if(PyInt_Check(nbOfComp))
4784 {//DataArrayByte.New([1,3,4,5],2,2)
4785 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4787 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4788 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4789 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4790 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4794 throw INTERP_KERNEL::Exception(msg);
4797 {//DataArrayByte.New([1,3,4],3)
4798 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4800 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4801 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4806 throw INTERP_KERNEL::Exception(msg);
4809 {// DataArrayByte.New([1,3,4])
4810 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4811 int tmpp1=-1,tmpp2=-1;
4812 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4813 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4817 else if(PyInt_Check(elt0))
4819 int nbOfTuples1=PyInt_AS_LONG(elt0);
4821 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4826 if(PyInt_Check(nbOfTuples))
4827 {//DataArrayByte.New(5,2)
4828 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4830 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4831 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4832 ret->alloc(nbOfTuples1,nbOfCompo);
4836 throw INTERP_KERNEL::Exception(msg);
4839 throw INTERP_KERNEL::Exception(msg);
4842 {//DataArrayByte.New(5)
4843 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4844 ret->alloc(nbOfTuples1,1);
4849 throw INTERP_KERNEL::Exception(msg);
4852 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4854 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4857 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4859 std::ostringstream oss;
4860 self->reprQuickOverview(oss);
4864 int __int__() const throw(INTERP_KERNEL::Exception)
4866 return (int) self->byteValue();
4869 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4871 return self->iterator();
4874 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4876 return (int)self->getIJ(tupleId,compoId);
4879 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4881 return (int)self->getIJSafe(tupleId,compoId);
4884 std::string __str__() const throw(INTERP_KERNEL::Exception)
4886 return self->repr();
4889 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4891 const char *vals=self->getConstPointer();
4892 int nbOfComp=self->getNumberOfComponents();
4893 int nbOfTuples=self->getNumberOfTuples();
4894 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4897 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4900 int ival=-1; std::vector<int> ivval;
4901 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4902 std::vector<char> vals(sz);
4903 std::copy(pt,pt+sz,vals.begin());
4904 return self->presenceOfTuple(vals);
4907 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4910 int ival=-1; std::vector<int> ivval;
4911 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4912 std::vector<char> vals2(sz);
4913 std::copy(pt,pt+sz,vals2.begin());
4914 return self->presenceOfValue(vals2);
4917 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4920 int ival=-1; std::vector<int> ivval;
4921 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
4922 std::vector<char> vals2(sz);
4923 std::copy(pt,pt+sz,vals2.begin());
4924 return self->locateValue(vals2);
4927 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4930 int ival=-1; std::vector<int> ivval;
4931 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
4932 std::vector<char> vals(sz);
4933 std::copy(pt,pt+sz,vals.begin());
4934 return self->locateTuple(vals);
4937 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4940 int ival=-1; std::vector<int> ivval;
4941 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
4942 std::vector<char> vals(sz);
4943 std::copy(pt,pt+sz,vals.begin());
4944 return self->search(vals);
4947 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4949 int sz=self->getNumberOfComponents();
4950 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4951 self->getTuple(tupleId,tmp);
4952 PyObject *ret=PyTuple_New(sz);
4953 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4957 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4960 int r1=(int)self->getMaxValue(tmp);
4961 PyObject *ret=PyTuple_New(2);
4962 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4963 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4967 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4970 int r1=(int)self->getMinValue(tmp);
4971 PyObject *ret=PyTuple_New(2);
4972 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4973 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4977 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4979 int nbOfCompo=self->getNumberOfComponents();
4984 if(PyInt_Check(obj))
4986 int val=(int)PyInt_AS_LONG(obj);
4987 return self->locateValue(val);
4990 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4993 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
4997 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4999 int nbOfCompo=self->getNumberOfComponents();
5006 if(PyInt_Check(obj))
5008 int val=(int)PyInt_AS_LONG(obj);
5009 return self->presenceOfValue(val);
5012 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5015 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5021 class DataArrayByteTuple;
5023 class DataArrayByteIterator
5026 DataArrayByteIterator(DataArrayByte *da);
5027 ~DataArrayByteIterator();
5030 class DataArrayByteTuple
5033 std::string repr() const throw(INTERP_KERNEL::Exception);
5034 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5037 std::string __str__() const throw(INTERP_KERNEL::Exception)
5039 return self->repr();
5042 char __int__() const throw(INTERP_KERNEL::Exception)
5044 return self->byteValue();
5047 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5049 return self->buildDAByte(1,self->getNumberOfCompo());
5054 class DataArrayAsciiCharIterator;
5056 class DataArrayAsciiChar : public DataArrayChar
5059 static DataArrayAsciiChar *New();
5060 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5061 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5062 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5065 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5067 return DataArrayAsciiChar::New();
5070 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5072 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) !";
5073 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5077 if(PyInt_Check(nbOfTuples))
5079 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5081 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5084 if(PyInt_Check(nbOfComp))
5085 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5086 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5088 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5089 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5090 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5091 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5095 throw INTERP_KERNEL::Exception(msg);
5098 {//DataArrayAsciiChar.New([1,3,4],3)
5099 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5101 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5102 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5106 else if(PyString_Check(nbOfTuples))
5108 if(PyString_Size(nbOfTuples)!=1)
5109 throw INTERP_KERNEL::Exception(msg);
5110 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5111 std::vector<std::string> tmp;
5112 if(fillStringVector(elt0,tmp))
5113 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5115 throw INTERP_KERNEL::Exception(msg);
5118 throw INTERP_KERNEL::Exception(msg);
5122 std::vector<std::string> tmmp;
5123 if(fillStringVector(elt0,tmmp))
5124 //DataArrayAsciiChar.New(["abc","de","fghi"])
5125 return DataArrayAsciiChar::New(tmmp,' ');
5128 // DataArrayAsciiChar.New([1,3,4])
5129 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5130 int tmpp1=-1,tmpp2=-1;
5131 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5132 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5137 else if(PyInt_Check(elt0))
5139 int nbOfTuples1=PyInt_AS_LONG(elt0);
5141 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5146 if(PyInt_Check(nbOfTuples))
5147 {//DataArrayAsciiChar.New(5,2)
5148 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5150 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5151 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5152 ret->alloc(nbOfTuples1,nbOfCompo);
5156 throw INTERP_KERNEL::Exception(msg);
5159 throw INTERP_KERNEL::Exception(msg);
5162 {//DataArrayAsciiChar.New(5)
5163 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5164 ret->alloc(nbOfTuples1,1);
5169 throw INTERP_KERNEL::Exception(msg);
5172 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5174 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5177 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5179 std::ostringstream oss;
5180 self->reprQuickOverview(oss);
5184 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5186 return self->iterator();
5189 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5191 char tmp[2]; tmp[1]='\0';
5192 tmp[0]=self->getIJ(tupleId,compoId);
5193 return std::string(tmp);
5196 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5198 char tmp[2]; tmp[1]='\0';
5199 tmp[0]=self->getIJSafe(tupleId,compoId);
5200 return std::string(tmp);
5203 std::string __str__() const throw(INTERP_KERNEL::Exception)
5205 return self->repr();
5208 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5210 const char *vals=self->getConstPointer();
5211 int nbOfComp=self->getNumberOfComponents();
5212 int nbOfTuples=self->getNumberOfTuples();
5213 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5216 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5218 if(PyString_Check(tupl))
5220 Py_ssize_t sz=PyString_Size(tupl);
5221 std::vector<char> vals(sz);
5222 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5223 return self->presenceOfTuple(vals);
5226 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5229 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5231 if(PyString_Check(vals))
5233 Py_ssize_t sz=PyString_Size(vals);
5234 std::vector<char> vals2(sz);
5235 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5236 return self->presenceOfValue(vals2);
5239 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5242 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5244 if(PyString_Check(vals))
5246 Py_ssize_t sz=PyString_Size(vals);
5247 std::vector<char> vals2(sz);
5248 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5249 return self->locateValue(vals2);
5252 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5255 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5257 if(PyString_Check(tupl))
5259 Py_ssize_t sz=PyString_Size(tupl);
5260 std::vector<char> vals(sz);
5261 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5262 return self->locateTuple(vals);
5265 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5268 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5270 if(PyString_Check(strOrListOfInt))
5272 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5273 std::vector<char> vals(sz);
5274 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5275 return self->search(vals);
5278 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5281 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5283 int sz=self->getNumberOfComponents();
5284 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5285 self->getTuple(tupleId,tmp);
5286 return PyString_FromString(tmp);
5289 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5292 char tmp2[2]; tmp2[1]='\0';
5293 tmp2[0]=self->getMaxValue(tmp);
5294 PyObject *ret=PyTuple_New(2);
5295 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5296 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5300 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5303 char tmp2[2]; tmp2[1]='\0';
5304 tmp2[0]=self->getMinValue(tmp);
5305 PyObject *ret=PyTuple_New(2);
5306 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5307 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5311 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5313 int nbOfCompo=self->getNumberOfComponents();
5318 if(PyString_Check(obj))
5320 Py_ssize_t sz=PyString_Size(obj);
5321 char *pt=PyString_AsString(obj);
5323 return self->locateValue(pt[0]);
5325 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5328 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5331 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5335 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5337 int nbOfCompo=self->getNumberOfComponents();
5344 if(PyString_Check(obj))
5346 Py_ssize_t sz=PyString_Size(obj);
5347 char *pt=PyString_AsString(obj);
5349 return self->presenceOfValue(pt[0]);
5351 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5354 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5357 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5361 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5364 std::vector<int> stdvecTyyppArr;
5365 std::pair<int, std::pair<int,int> > sTyyppArr;
5366 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5367 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5371 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5373 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5375 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5377 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5379 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5383 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5385 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.";
5387 std::vector<int> stdvecTyyppArr;
5388 std::pair<int, std::pair<int,int> > sTyyppArr;
5389 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5390 int nbOfCompo=self->getNumberOfComponents();
5391 int nbOfTuples=self->getNumberOfTuples();
5392 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5394 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5395 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5404 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5410 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5411 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5414 //value vector<string>
5417 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5418 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5421 //value DataArrayChar
5424 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5428 throw INTERP_KERNEL::Exception(msg);
5432 {//obj list-tuple[int]
5438 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5444 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5445 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5448 //value vector<string>
5451 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5452 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5455 //value DataArrayChar
5458 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5462 throw INTERP_KERNEL::Exception(msg);
5473 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5479 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5480 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5483 //value vector<string>
5486 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5487 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5490 //value DataArrayChar
5493 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5497 throw INTERP_KERNEL::Exception(msg);
5508 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5514 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5515 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5518 //value vector<string>
5521 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5522 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5525 //value DataArrayChar
5528 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5532 throw INTERP_KERNEL::Exception(msg);
5537 throw INTERP_KERNEL::Exception(msg);
5543 class DataArrayAsciiCharTuple;
5545 class DataArrayAsciiCharIterator
5548 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5549 ~DataArrayAsciiCharIterator();
5554 DataArrayAsciiCharTuple *ret=self->nextt();
5556 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5559 PyErr_SetString(PyExc_StopIteration,"No more data.");
5566 class DataArrayAsciiCharTuple
5569 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5570 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5573 std::string __str__() const throw(INTERP_KERNEL::Exception)
5575 return self->repr();
5578 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5580 return self->buildDAAsciiChar(1,self->getNumberOfCompo());