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)
22 %typemap(out) ParaMEDMEM::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) ParaMEDMEM::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
45 %newobject ParaMEDMEM::DataArray::deepCpy;
46 %newobject ParaMEDMEM::DataArray::selectByTupleRanges;
47 %newobject ParaMEDMEM::DataArray::selectByTupleId;
48 %newobject ParaMEDMEM::DataArray::selectByTupleIdSafe;
49 %newobject ParaMEDMEM::DataArray::selectByTupleId2;
50 %newobject ParaMEDMEM::DataArray::Aggregate;
51 %newobject ParaMEDMEM::DataArrayInt::New;
52 %newobject ParaMEDMEM::DataArrayInt::__iter__;
53 %newobject ParaMEDMEM::DataArrayInt::convertToDblArr;
54 %newobject ParaMEDMEM::DataArrayInt::performCpy;
55 %newobject ParaMEDMEM::DataArrayInt::substr;
56 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
57 %newobject ParaMEDMEM::DataArrayInt::accumulatePerChunck;
58 %newobject ParaMEDMEM::DataArrayInt::checkAndPreparePermutation;
59 %newobject ParaMEDMEM::DataArrayInt::transformWithIndArrR;
60 %newobject ParaMEDMEM::DataArrayInt::renumber;
61 %newobject ParaMEDMEM::DataArrayInt::renumberR;
62 %newobject ParaMEDMEM::DataArrayInt::renumberAndReduce;
63 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2O;
64 %newobject ParaMEDMEM::DataArrayInt::invertArrayN2O2O2N;
65 %newobject ParaMEDMEM::DataArrayInt::invertArrayO2N2N2OBis;
66 %newobject ParaMEDMEM::DataArrayInt::getIdsEqual;
67 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqual;
68 %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList;
69 %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList;
70 %newobject ParaMEDMEM::DataArrayInt::negate;
71 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
72 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
73 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
74 %newobject ParaMEDMEM::DataArrayInt::Meld;
75 %newobject ParaMEDMEM::DataArrayInt::Add;
76 %newobject ParaMEDMEM::DataArrayInt::Substract;
77 %newobject ParaMEDMEM::DataArrayInt::Multiply;
78 %newobject ParaMEDMEM::DataArrayInt::Divide;
79 %newobject ParaMEDMEM::DataArrayInt::Pow;
80 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
81 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
82 %newobject ParaMEDMEM::DataArrayInt::Range;
83 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
84 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
85 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
86 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
87 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
88 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
89 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
90 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
91 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
92 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
93 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
94 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
95 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
96 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
97 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
98 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
99 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
100 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
101 %newobject ParaMEDMEM::DataArrayInt::__neg__;
102 %newobject ParaMEDMEM::DataArrayInt::__add__;
103 %newobject ParaMEDMEM::DataArrayInt::__radd__;
104 %newobject ParaMEDMEM::DataArrayInt::__sub__;
105 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
106 %newobject ParaMEDMEM::DataArrayInt::__mul__;
107 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
108 %newobject ParaMEDMEM::DataArrayInt::__div__;
109 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
110 %newobject ParaMEDMEM::DataArrayInt::__mod__;
111 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
112 %newobject ParaMEDMEM::DataArrayInt::__pow__;
113 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
114 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
115 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
116 %newobject ParaMEDMEM::DataArrayChar::renumber;
117 %newobject ParaMEDMEM::DataArrayChar::renumberR;
118 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
119 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
120 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
121 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
122 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
123 %newobject ParaMEDMEM::DataArrayChar::Meld;
124 %newobject ParaMEDMEM::DataArrayByte::New;
125 %newobject ParaMEDMEM::DataArrayByte::__iter__;
126 %newobject ParaMEDMEM::DataArrayByte::performCpy;
127 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
128 %newobject ParaMEDMEM::DataArrayChar::substr;
129 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
130 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
131 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
132 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
133 %newobject ParaMEDMEM::DataArrayDouble::New;
134 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
135 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
136 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
137 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
138 %newobject ParaMEDMEM::DataArrayDouble::Meld;
139 %newobject ParaMEDMEM::DataArrayDouble::Dot;
140 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
141 %newobject ParaMEDMEM::DataArrayDouble::Add;
142 %newobject ParaMEDMEM::DataArrayDouble::Substract;
143 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
144 %newobject ParaMEDMEM::DataArrayDouble::Divide;
145 %newobject ParaMEDMEM::DataArrayDouble::Pow;
146 %newobject ParaMEDMEM::DataArrayDouble::substr;
147 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
148 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
149 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
150 %newobject ParaMEDMEM::DataArrayDouble::negate;
151 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
152 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
153 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
154 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
155 %newobject ParaMEDMEM::DataArrayDouble::determinant;
156 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
157 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
158 %newobject ParaMEDMEM::DataArrayDouble::inverse;
159 %newobject ParaMEDMEM::DataArrayDouble::trace;
160 %newobject ParaMEDMEM::DataArrayDouble::deviator;
161 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
162 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
163 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
164 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
165 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
166 %newobject ParaMEDMEM::DataArrayDouble::renumber;
167 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
168 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
169 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
170 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
171 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
172 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
173 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
174 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
175 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
176 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
177 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
178 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
179 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
180 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
181 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
182 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
183 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
184 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
185 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
187 %feature("unref") DataArray "$this->decrRef();"
188 %feature("unref") DataArrayDouble "$this->decrRef();"
189 %feature("unref") DataArrayInt "$this->decrRef();"
190 %feature("unref") DataArrayChar "$this->decrRef();"
191 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
192 %feature("unref") DataArrayByte "$this->decrRef();"
196 class DataArray : public RefCountObject, public TimeLabel
199 void setName(const char *name);
200 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
201 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
202 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
203 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
204 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
205 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
206 std::string getName() const;
207 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
208 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
209 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
210 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
211 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
212 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
213 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
214 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
215 int getNumberOfComponents() const;
216 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
217 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
218 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
219 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
220 virtual void desallocate() throw(INTERP_KERNEL::Exception);
221 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
222 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
223 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
224 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
225 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
226 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
227 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
228 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
229 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
230 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
231 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
232 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
233 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
234 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
235 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
236 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
237 void updateTime() const;
240 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
242 const std::vector<std::string>& comps=self->getInfoOnComponents();
243 PyObject *ret=PyList_New((int)comps.size());
244 for(int i=0;i<(int)comps.size();i++)
245 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
249 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
251 std::vector<int> tmp;
252 convertPyToNewIntArr3(li,tmp);
253 self->copyPartOfStringInfoFrom(other,tmp);
256 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
258 std::vector<int> tmp;
259 convertPyToNewIntArr3(li,tmp);
260 self->copyPartOfStringInfoFrom2(tmp,other);
263 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
266 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
267 if (!SWIG_IsOK(res1))
270 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
271 if(size!=self->getNumberOfTuples())
273 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
275 self->renumberInPlace(tmp);
279 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
281 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
282 da2->checkAllocated();
283 int size=self->getNumberOfTuples();
284 if(size!=self->getNumberOfTuples())
286 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
288 self->renumberInPlace(da2->getConstPointer());
292 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
295 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
296 if (!SWIG_IsOK(res1))
299 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
300 if(size!=self->getNumberOfTuples())
302 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
304 self->renumberInPlaceR(tmp);
308 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
310 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
311 da2->checkAllocated();
312 int size=self->getNumberOfTuples();
313 if(size!=self->getNumberOfTuples())
315 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
317 self->renumberInPlaceR(da2->getConstPointer());
321 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
322 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
324 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
325 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
326 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
327 DataArrayInt *tuplesSelecPtr2=0;
330 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
332 throw INTERP_KERNEL::Exception(msg);
334 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
337 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
339 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
340 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
343 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
345 std::vector<std::pair<int,int> > ranges;
346 convertPyToVectorPairInt(li,ranges);
347 return self->selectByTupleRanges(ranges);
350 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
353 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
354 if (!SWIG_IsOK(res1))
357 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
358 return self->selectByTupleId(tmp,tmp+size);
362 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
364 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
365 da2->checkAllocated();
366 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
370 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
373 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
374 if (!SWIG_IsOK(res1))
377 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
378 return self->selectByTupleIdSafe(tmp,tmp+size);
382 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
384 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
385 da2->checkAllocated();
386 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
390 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
392 std::vector<int> tmp;
393 convertPyToNewIntArr3(li,tmp);
394 DataArray *ret=self->keepSelectedComponents(tmp);
395 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
398 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
400 if(!PySlice_Check(slic))
401 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
402 Py_ssize_t strt=2,stp=2,step=2;
403 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
404 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
405 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
406 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
407 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 !");
409 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
410 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
413 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
415 if(!PySlice_Check(slic))
416 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
417 Py_ssize_t strt=2,stp=2,step=2;
418 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
419 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
420 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
422 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
423 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
426 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
428 if(!PySlice_Check(slic))
429 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
430 Py_ssize_t strt=2,stp=2,step=2;
431 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
432 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
433 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
434 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
435 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
436 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
439 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
441 if(!PySlice_Check(slic))
442 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
443 Py_ssize_t strt=2,stp=2,step=2;
444 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
445 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
446 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
447 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
448 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
449 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
452 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
454 std::vector<const DataArray *> tmp;
455 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
456 return DataArray::Aggregate(tmp);
459 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
461 if(!PySlice_Check(slic))
462 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
463 Py_ssize_t strt=2,stp=2,step=2;
464 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
465 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
466 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
467 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
470 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
472 if(!PySlice_Check(slic))
473 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
474 Py_ssize_t strt=2,stp=2,step=2;
475 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
476 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
477 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
478 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
484 class DataArrayDoubleIterator;
486 class DataArrayDouble : public DataArray
489 static DataArrayDouble *New();
490 double doubleValue() const throw(INTERP_KERNEL::Exception);
491 bool empty() const throw(INTERP_KERNEL::Exception);
492 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
493 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
494 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
495 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
496 double popBackSilent() throw(INTERP_KERNEL::Exception);
497 void pack() const throw(INTERP_KERNEL::Exception);
498 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
499 void fillWithZero() throw(INTERP_KERNEL::Exception);
500 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
501 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
502 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
503 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
504 void reverse() throw(INTERP_KERNEL::Exception);
505 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
506 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
507 std::string repr() const throw(INTERP_KERNEL::Exception);
508 std::string reprZip() const throw(INTERP_KERNEL::Exception);
509 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
510 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
511 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
512 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
513 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
514 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
515 void transpose() throw(INTERP_KERNEL::Exception);
516 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
517 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
518 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
519 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
520 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
521 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
522 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
523 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
524 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
525 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
526 double front() const throw(INTERP_KERNEL::Exception);
527 double back() const throw(INTERP_KERNEL::Exception);
528 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
529 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
530 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
531 double *getPointer() throw(INTERP_KERNEL::Exception);
532 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
533 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
534 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
535 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
536 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
537 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
538 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
539 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
540 double getAverageValue() const throw(INTERP_KERNEL::Exception);
541 double norm2() const throw(INTERP_KERNEL::Exception);
542 double normMax() const throw(INTERP_KERNEL::Exception);
543 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
544 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
545 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
546 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
547 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
548 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
549 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
550 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
558 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
559 void abs() throw(INTERP_KERNEL::Exception);
560 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
561 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
562 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
563 void applyPow(double val) throw(INTERP_KERNEL::Exception);
564 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
566 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
567 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
569 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
570 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
571 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
572 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
573 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
574 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
575 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
576 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
577 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
578 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
579 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
580 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
581 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
582 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
583 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
584 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
585 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
586 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
587 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
588 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
589 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
592 DataArrayDouble() throw(INTERP_KERNEL::Exception)
594 return DataArrayDouble::New();
597 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
599 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)";
600 std::string msg(msgBase);
602 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
605 if(PyList_Check(elt0) || PyTuple_Check(elt0))
609 if(PyInt_Check(nbOfTuples))
611 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
613 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
616 if(PyInt_Check(elt2))
617 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
618 int nbOfCompo=PyInt_AS_LONG(elt2);
620 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
621 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
622 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
623 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
627 throw INTERP_KERNEL::Exception(msg.c_str());
630 {//DataArrayDouble.New([1.,3.,4.],3)
631 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
633 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
634 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
639 throw INTERP_KERNEL::Exception(msg.c_str());
642 {// DataArrayDouble.New([1.,3.,4.])
643 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
644 int tmpp1=-1,tmpp2=-1;
645 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
646 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
650 else if(PyInt_Check(elt0))
652 int nbOfTuples1=PyInt_AS_LONG(elt0);
654 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
659 if(PyInt_Check(nbOfTuples))
660 {//DataArrayDouble.New(5,2)
661 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
663 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
664 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
665 ret->alloc(nbOfTuples1,nbOfCompo);
669 throw INTERP_KERNEL::Exception(msg.c_str());
672 throw INTERP_KERNEL::Exception(msg.c_str());
675 {//DataArrayDouble.New(5)
676 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
677 ret->alloc(nbOfTuples1,1);
682 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
683 {//DataArrayDouble.New(numpyArray)
684 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
688 throw INTERP_KERNEL::Exception(msg.c_str());
691 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
693 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
696 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
699 std::vector<double> bb;
701 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
702 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
703 self->pushBackValsSilent(tmp,tmp+nbTuples);
706 std::string __repr__() const throw(INTERP_KERNEL::Exception)
708 std::ostringstream oss;
709 self->reprQuickOverview(oss);
713 std::string __str__() const throw(INTERP_KERNEL::Exception)
718 double __float__() const throw(INTERP_KERNEL::Exception)
720 return self->doubleValue();
723 int __len__() const throw(INTERP_KERNEL::Exception)
725 if(self->isAllocated())
727 return self->getNumberOfTuples();
731 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
735 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
737 return self->iterator();
740 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
742 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 !";
743 if(PyList_Check(li) || PyTuple_Check(li))
747 if(PyInt_Check(nbOfTuples))
749 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
751 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
754 if(PyInt_Check(nbOfComp))
755 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
756 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
758 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
759 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
760 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
763 throw INTERP_KERNEL::Exception(msg);
766 {//DataArrayDouble.setValues([1.,3.,4.],3)
768 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
769 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
773 throw INTERP_KERNEL::Exception(msg);
776 {// DataArrayDouble.setValues([1.,3.,4.])
777 int tmpp1=-1,tmpp2=-1;
778 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
779 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
783 throw INTERP_KERNEL::Exception(msg);
786 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
788 const double *vals=self->getConstPointer();
789 return convertDblArrToPyList(vals,self->getNbOfElems());
793 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
795 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
799 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
802 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
803 PyObject *ret=PyTuple_New(2);
804 PyObject *ret0Py=ret0?Py_True:Py_False;
806 PyTuple_SetItem(ret,0,ret0Py);
807 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
811 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
813 const double *vals=self->getConstPointer();
814 int nbOfComp=self->getNumberOfComponents();
815 int nbOfTuples=self->getNumberOfTuples();
816 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
819 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
822 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
823 if (!SWIG_IsOK(res1))
826 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
827 if(size!=self->getNumberOfTuples())
829 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
831 return self->renumber(tmp);
835 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
837 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
838 da2->checkAllocated();
839 int size=self->getNumberOfTuples();
840 if(size!=self->getNumberOfTuples())
842 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
844 return self->renumber(da2->getConstPointer());
848 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
851 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
852 if (!SWIG_IsOK(res1))
855 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
856 if(size!=self->getNumberOfTuples())
858 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
860 return self->renumberR(tmp);
864 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
866 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
867 da2->checkAllocated();
868 int size=self->getNumberOfTuples();
869 if(size!=self->getNumberOfTuples())
871 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
873 return self->renumberR(da2->getConstPointer());
877 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
880 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
881 if (!SWIG_IsOK(res1))
884 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
885 if(size!=self->getNumberOfTuples())
887 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
889 return self->renumberAndReduce(tmp,newNbOfTuple);
893 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
895 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
896 da2->checkAllocated();
897 int size=self->getNumberOfTuples();
898 if(size!=self->getNumberOfTuples())
900 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
902 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
906 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
908 int thisTupleId,otherTupleId;
909 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
910 PyObject *ret=PyTuple_New(3);
911 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
912 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
913 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
917 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
920 double r1=self->getMaxValue(tmp);
921 PyObject *ret=PyTuple_New(2);
922 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
923 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
927 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
930 double r1=self->getMaxValue2(tmp);
931 PyObject *ret=PyTuple_New(2);
932 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
933 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
937 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
940 double r1=self->getMinValue(tmp);
941 PyObject *ret=PyTuple_New(2);
942 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
943 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
947 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
950 double r1=self->getMinValue2(tmp);
951 PyObject *ret=PyTuple_New(2);
952 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
953 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
957 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
959 int nbOfCompo=self->getNumberOfComponents();
960 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
961 self->getMinMaxPerComponent(tmp);
962 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
966 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
968 int sz=self->getNumberOfComponents();
969 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
970 self->accumulate(tmp);
971 return convertDblArrToPyList(tmp,sz);
974 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
977 std::vector<int> val2;
978 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
979 return self->accumulatePerChunck(bg,bg+sz);
982 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
984 DataArrayInt *comm, *commIndex;
985 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
986 PyObject *res = PyList_New(2);
987 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
988 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
992 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
996 DataArrayDoubleTuple *aa;
997 std::vector<double> bb;
999 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1000 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1002 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1003 PyObject *ret=PyTuple_New(2);
1004 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1005 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1009 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1011 std::vector<int> tmp;
1012 convertPyToNewIntArr3(li,tmp);
1013 self->setSelectedComponents(a,tmp);
1016 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1018 int sz=self->getNumberOfComponents();
1019 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1020 self->getTuple(tupleId,tmp);
1021 return convertDblArrToPyList(tmp,sz);
1024 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1026 std::vector<const DataArrayDouble *> tmp;
1027 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1028 return DataArrayDouble::Aggregate(tmp);
1031 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1033 std::vector<const DataArrayDouble *> tmp;
1034 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1035 return DataArrayDouble::Meld(tmp);
1038 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1042 DataArrayDoubleTuple *aa;
1043 std::vector<double> bb;
1045 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1046 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1047 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1048 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1049 DataArrayInt *c=0,*cI=0;
1050 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1051 PyObject *ret=PyTuple_New(2);
1052 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1053 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1057 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1059 DataArrayInt *ret1=0;
1060 bool ret0=self->areIncludedInMe(other,prec,ret1);
1061 PyObject *ret=PyTuple_New(2);
1062 PyObject *ret0Py=ret0?Py_True:Py_False;
1064 PyTuple_SetItem(ret,0,ret0Py);
1065 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1069 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1071 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1072 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1073 self->checkAllocated();
1074 int nbOfTuples=self->getNumberOfTuples();
1075 int nbOfComponents=self->getNumberOfComponents();
1077 std::vector<int> vt1,vc1;
1078 std::pair<int, std::pair<int,int> > pt1,pc1;
1079 DataArrayInt *dt1=0,*dc1=0;
1081 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1082 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1086 if(nbOfComponents==1)
1087 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1088 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1090 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1092 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1094 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1096 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1099 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1100 std::vector<int> v2(1,ic1);
1101 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1105 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1106 std::vector<int> v2(1,ic1);
1107 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1111 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1112 std::vector<int> v2(1,ic1);
1113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1117 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1122 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1123 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1127 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1132 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1133 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1137 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1138 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1139 std::vector<int> v2(nbOfComp);
1140 for(int i=0;i<nbOfComp;i++)
1141 v2[i]=pc1.first+i*pc1.second.second;
1142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1146 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1147 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1148 std::vector<int> v2(nbOfComp);
1149 for(int i=0;i<nbOfComp;i++)
1150 v2[i]=pc1.first+i*pc1.second.second;
1151 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1155 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1156 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1157 std::vector<int> v2(nbOfComp);
1158 for(int i=0;i<nbOfComp;i++)
1159 v2[i]=pc1.first+i*pc1.second.second;
1160 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1164 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1165 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1166 std::vector<int> v2(nbOfComp);
1167 for(int i=0;i<nbOfComp;i++)
1168 v2[i]=pc1.first+i*pc1.second.second;
1169 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1172 throw INTERP_KERNEL::Exception(msg);
1176 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1178 self->checkAllocated();
1179 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1180 int nbOfTuples=self->getNumberOfTuples();
1181 int nbOfComponents=self->getNumberOfComponents();
1184 std::vector<double> v1;
1185 DataArrayDouble *d1=0;
1186 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1188 std::vector<int> vt1,vc1;
1189 std::pair<int, std::pair<int,int> > pt1,pc1;
1190 DataArrayInt *dt1=0,*dc1=0;
1191 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1192 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1200 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1203 tmp=DataArrayDouble::New();
1204 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1205 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1208 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1211 throw INTERP_KERNEL::Exception(msg);
1220 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1223 tmp=DataArrayDouble::New();
1224 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1225 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1228 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1231 throw INTERP_KERNEL::Exception(msg);
1240 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1243 tmp=DataArrayDouble::New();
1244 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1245 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1248 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1251 throw INTERP_KERNEL::Exception(msg);
1260 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1263 tmp=DataArrayDouble::New();
1264 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1265 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1268 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1271 throw INTERP_KERNEL::Exception(msg);
1280 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1283 tmp=DataArrayDouble::New();
1284 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1285 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1288 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1291 throw INTERP_KERNEL::Exception(msg);
1300 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1303 tmp=DataArrayDouble::New();
1304 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1305 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1308 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1311 throw INTERP_KERNEL::Exception(msg);
1320 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1323 tmp=DataArrayDouble::New();
1324 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1325 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1328 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1331 throw INTERP_KERNEL::Exception(msg);
1340 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1343 tmp=DataArrayDouble::New();
1344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1345 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1348 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1351 throw INTERP_KERNEL::Exception(msg);
1360 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1363 tmp=DataArrayDouble::New();
1364 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1365 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1368 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1371 throw INTERP_KERNEL::Exception(msg);
1380 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1383 tmp=DataArrayDouble::New();
1384 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1385 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1388 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1391 throw INTERP_KERNEL::Exception(msg);
1400 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1403 tmp=DataArrayDouble::New();
1404 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1405 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1408 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1411 throw INTERP_KERNEL::Exception(msg);
1420 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1423 tmp=DataArrayDouble::New();
1424 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1425 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1428 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1431 throw INTERP_KERNEL::Exception(msg);
1440 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1443 tmp=DataArrayDouble::New();
1444 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1445 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1448 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1451 throw INTERP_KERNEL::Exception(msg);
1460 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1463 tmp=DataArrayDouble::New();
1464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1465 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1468 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1471 throw INTERP_KERNEL::Exception(msg);
1480 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1483 tmp=DataArrayDouble::New();
1484 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1485 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1488 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1491 throw INTERP_KERNEL::Exception(msg);
1500 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1503 tmp=DataArrayDouble::New();
1504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1505 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1508 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1511 throw INTERP_KERNEL::Exception(msg);
1516 throw INTERP_KERNEL::Exception(msg);
1521 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1523 return self->negate();
1526 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1528 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1531 DataArrayDoubleTuple *aa;
1532 std::vector<double> bb;
1536 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1538 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1541 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1542 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1544 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1547 throw INTERP_KERNEL::Exception(msg);
1550 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1555 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1556 ret->applyLin(1.,val);
1557 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1561 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1565 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1566 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1570 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1571 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1574 throw INTERP_KERNEL::Exception(msg);
1578 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1580 const char msg[]="Unexpected situation in __radd__ !";
1583 DataArrayDoubleTuple *aa;
1584 std::vector<double> bb;
1586 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1591 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1592 ret->applyLin(1.,val);
1597 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1598 return DataArrayDouble::Add(self,aaa);
1602 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1603 return DataArrayDouble::Add(self,aaa);
1606 throw INTERP_KERNEL::Exception(msg);
1610 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1612 const char msg[]="Unexpected situation in __iadd__ !";
1615 DataArrayDoubleTuple *aa;
1616 std::vector<double> bb;
1618 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1623 self->applyLin(1.,val);
1624 Py_XINCREF(trueSelf);
1630 Py_XINCREF(trueSelf);
1635 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1636 self->addEqual(aaa);
1637 Py_XINCREF(trueSelf);
1642 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1643 self->addEqual(aaa);
1644 Py_XINCREF(trueSelf);
1648 throw INTERP_KERNEL::Exception(msg);
1652 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1654 const char msg[]="Unexpected situation in __sub__ !";
1657 DataArrayDoubleTuple *aa;
1658 std::vector<double> bb;
1662 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1664 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1667 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1668 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1670 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1673 throw INTERP_KERNEL::Exception(msg);
1676 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1681 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1682 ret->applyLin(1.,-val);
1683 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1687 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1691 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1692 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1696 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1697 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1700 throw INTERP_KERNEL::Exception(msg);
1704 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1706 const char msg[]="Unexpected situation in __rsub__ !";
1709 DataArrayDoubleTuple *aa;
1710 std::vector<double> bb;
1712 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1717 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1718 ret->applyLin(-1.,val);
1723 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1724 return DataArrayDouble::Substract(aaa,self);
1728 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1729 return DataArrayDouble::Substract(aaa,self);
1732 throw INTERP_KERNEL::Exception(msg);
1736 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1738 const char msg[]="Unexpected situation in __isub__ !";
1741 DataArrayDoubleTuple *aa;
1742 std::vector<double> bb;
1744 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1749 self->applyLin(1,-val);
1750 Py_XINCREF(trueSelf);
1755 self->substractEqual(a);
1756 Py_XINCREF(trueSelf);
1761 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1762 self->substractEqual(aaa);
1763 Py_XINCREF(trueSelf);
1768 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1769 self->substractEqual(aaa);
1770 Py_XINCREF(trueSelf);
1774 throw INTERP_KERNEL::Exception(msg);
1778 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1780 const char msg[]="Unexpected situation in __mul__ !";
1783 DataArrayDoubleTuple *aa;
1784 std::vector<double> bb;
1788 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1790 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1793 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1794 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1796 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1799 throw INTERP_KERNEL::Exception(msg);
1802 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1807 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1808 ret->applyLin(val,0.);
1809 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1813 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1817 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1818 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1822 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1823 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1826 throw INTERP_KERNEL::Exception(msg);
1830 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1832 const char msg[]="Unexpected situation in __rmul__ !";
1835 DataArrayDoubleTuple *aa;
1836 std::vector<double> bb;
1838 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1843 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1844 ret->applyLin(val,0.);
1849 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1850 return DataArrayDouble::Multiply(self,aaa);
1854 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1855 return DataArrayDouble::Multiply(self,aaa);
1858 throw INTERP_KERNEL::Exception(msg);
1862 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1864 const char msg[]="Unexpected situation in __imul__ !";
1867 DataArrayDoubleTuple *aa;
1868 std::vector<double> bb;
1870 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1875 self->applyLin(val,0.);
1876 Py_XINCREF(trueSelf);
1881 self->multiplyEqual(a);
1882 Py_XINCREF(trueSelf);
1887 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1888 self->multiplyEqual(aaa);
1889 Py_XINCREF(trueSelf);
1894 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1895 self->multiplyEqual(aaa);
1896 Py_XINCREF(trueSelf);
1900 throw INTERP_KERNEL::Exception(msg);
1904 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1906 const char msg[]="Unexpected situation in __div__ !";
1909 DataArrayDoubleTuple *aa;
1910 std::vector<double> bb;
1914 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1916 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1919 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1920 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1922 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1925 throw INTERP_KERNEL::Exception(msg);
1928 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1934 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1935 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1936 ret->applyLin(1/val,0.);
1937 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1941 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1945 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1946 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1950 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1951 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1954 throw INTERP_KERNEL::Exception(msg);
1958 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1960 const char msg[]="Unexpected situation in __rdiv__ !";
1963 DataArrayDoubleTuple *aa;
1964 std::vector<double> bb;
1966 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1971 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1977 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1978 return DataArrayDouble::Divide(aaa,self);
1982 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1983 return DataArrayDouble::Divide(aaa,self);
1986 throw INTERP_KERNEL::Exception(msg);
1990 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1992 const char msg[]="Unexpected situation in __idiv__ !";
1995 DataArrayDoubleTuple *aa;
1996 std::vector<double> bb;
1998 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2004 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2005 self->applyLin(1./val,0.);
2006 Py_XINCREF(trueSelf);
2011 self->divideEqual(a);
2012 Py_XINCREF(trueSelf);
2017 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2018 self->divideEqual(aaa);
2019 Py_XINCREF(trueSelf);
2024 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2025 self->divideEqual(aaa);
2026 Py_XINCREF(trueSelf);
2030 throw INTERP_KERNEL::Exception(msg);
2034 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2036 const char msg[]="Unexpected situation in __pow__ !";
2039 DataArrayDoubleTuple *aa;
2040 std::vector<double> bb;
2042 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2047 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2053 return DataArrayDouble::Pow(self,a);
2057 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2058 return DataArrayDouble::Pow(self,aaa);
2062 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2063 return DataArrayDouble::Pow(self,aaa);
2066 throw INTERP_KERNEL::Exception(msg);
2070 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2072 const char msg[]="Unexpected situation in __rpow__ !";
2075 DataArrayDoubleTuple *aa;
2076 std::vector<double> bb;
2078 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2083 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2084 ret->applyRPow(val);
2089 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2090 return DataArrayDouble::Pow(aaa,self);
2094 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2095 return DataArrayDouble::Pow(aaa,self);
2098 throw INTERP_KERNEL::Exception(msg);
2102 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2104 const char msg[]="Unexpected situation in __ipow__ !";
2107 DataArrayDoubleTuple *aa;
2108 std::vector<double> bb;
2110 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2115 self->applyPow(val);
2116 Py_XINCREF(trueSelf);
2122 Py_XINCREF(trueSelf);
2127 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2128 self->powEqual(aaa);
2129 Py_XINCREF(trueSelf);
2134 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2135 self->powEqual(aaa);
2136 Py_XINCREF(trueSelf);
2140 throw INTERP_KERNEL::Exception(msg);
2144 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2146 DataArrayInt *c=0,*cI=0;
2148 self->computeTupleIdsNearTuples(other,eps,c,cI);
2149 PyObject *ret=PyTuple_New(2);
2150 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2151 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2155 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2157 DataArrayInt *ret1=0;
2158 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2159 PyObject *ret=PyTuple_New(2);
2160 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2161 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2167 class DataArrayDoubleTuple;
2169 class DataArrayDoubleIterator
2172 DataArrayDoubleIterator(DataArrayDouble *da);
2173 ~DataArrayDoubleIterator();
2178 DataArrayDoubleTuple *ret=self->nextt();
2180 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2183 PyErr_SetString(PyExc_StopIteration,"No more data.");
2190 class DataArrayDoubleTuple
2193 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2194 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2197 std::string __str__() const throw(INTERP_KERNEL::Exception)
2199 return self->repr();
2202 double __float__() const throw(INTERP_KERNEL::Exception)
2204 return self->doubleValue();
2207 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2209 return self->buildDADouble(1,self->getNumberOfCompo());
2212 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2214 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2215 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2216 Py_XINCREF(trueSelf);
2220 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2222 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2223 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2224 Py_XINCREF(trueSelf);
2228 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2230 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2231 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2232 Py_XINCREF(trueSelf);
2236 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2238 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2239 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2240 Py_XINCREF(trueSelf);
2244 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2246 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2249 std::vector<int> multiVal;
2250 std::pair<int, std::pair<int,int> > slic;
2251 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2252 const double *pt=self->getConstPointer();
2253 int nbc=self->getNumberOfCompo();
2254 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2261 std::ostringstream oss;
2262 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2263 throw INTERP_KERNEL::Exception(oss.str().c_str());
2266 return PyFloat_FromDouble(pt[singleVal]);
2270 return PyFloat_FromDouble(pt[nbc+singleVal]);
2273 std::ostringstream oss;
2274 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2275 throw INTERP_KERNEL::Exception(oss.str().c_str());
2281 PyObject *t=PyTuple_New(multiVal.size());
2282 for(int j=0;j<(int)multiVal.size();j++)
2284 int cid=multiVal[j];
2287 std::ostringstream oss;
2288 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2289 throw INTERP_KERNEL::Exception(oss.str().c_str());
2291 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2297 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2298 PyObject *t=PyTuple_New(sz);
2299 for(int j=0;j<sz;j++)
2300 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2304 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2308 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2310 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2311 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2314 std::vector<double> multiValV;
2315 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2316 int nbc=self->getNumberOfCompo();
2317 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2319 std::vector<int> multiVal;
2320 std::pair<int, std::pair<int,int> > slic;
2321 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2322 double *pt=self->getPointer();
2323 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2330 std::ostringstream oss;
2331 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2332 throw INTERP_KERNEL::Exception(oss.str().c_str());
2338 pt[singleVal]=singleValV;
2343 if(multiValV.size()!=1)
2345 std::ostringstream oss;
2346 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2347 throw INTERP_KERNEL::Exception(oss.str().c_str());
2349 pt[singleVal]=multiValV[0];
2354 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2358 throw INTERP_KERNEL::Exception(msg);
2367 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2371 std::ostringstream oss;
2372 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2373 throw INTERP_KERNEL::Exception(oss.str().c_str());
2381 if(multiVal.size()!=multiValV.size())
2383 std::ostringstream oss;
2384 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2385 throw INTERP_KERNEL::Exception(oss.str().c_str());
2387 for(int i=0;i<(int)multiVal.size();i++)
2389 int pos=multiVal[i];
2392 std::ostringstream oss;
2393 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2394 throw INTERP_KERNEL::Exception(oss.str().c_str());
2396 pt[multiVal[i]]=multiValV[i];
2402 const double *ptV=daIntTyyppV->getConstPointer();
2403 if(nbc>daIntTyyppV->getNumberOfCompo())
2405 std::ostringstream oss;
2406 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2407 throw INTERP_KERNEL::Exception(oss.str().c_str());
2409 std::copy(ptV,ptV+nbc,pt);
2413 throw INTERP_KERNEL::Exception(msg);
2418 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2423 for(int j=0;j<sz;j++)
2424 pt[slic.first+j*slic.second.second]=singleValV;
2429 if(sz!=(int)multiValV.size())
2431 std::ostringstream oss;
2432 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2433 throw INTERP_KERNEL::Exception(oss.str().c_str());
2435 for(int j=0;j<sz;j++)
2436 pt[slic.first+j*slic.second.second]=multiValV[j];
2441 const double *ptV=daIntTyyppV->getConstPointer();
2442 if(sz>daIntTyyppV->getNumberOfCompo())
2444 std::ostringstream oss;
2445 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2446 throw INTERP_KERNEL::Exception(oss.str().c_str());
2448 for(int j=0;j<sz;j++)
2449 pt[slic.first+j*slic.second.second]=ptV[j];
2453 throw INTERP_KERNEL::Exception(msg);
2457 throw INTERP_KERNEL::Exception(msg);
2463 class DataArrayIntIterator;
2465 class DataArrayInt : public DataArray
2468 static DataArrayInt *New();
2469 int intValue() const throw(INTERP_KERNEL::Exception);
2470 int getHashCode() const throw(INTERP_KERNEL::Exception);
2471 bool empty() const throw(INTERP_KERNEL::Exception);
2472 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2473 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2474 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2475 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2476 int popBackSilent() throw(INTERP_KERNEL::Exception);
2477 void pack() const throw(INTERP_KERNEL::Exception);
2478 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2479 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2480 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2481 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2482 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2483 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2484 void reverse() throw(INTERP_KERNEL::Exception);
2485 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2486 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2487 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2488 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2489 void fillWithZero() throw(INTERP_KERNEL::Exception);
2490 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2491 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2492 std::string repr() const throw(INTERP_KERNEL::Exception);
2493 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2494 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2495 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2496 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2497 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2498 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2499 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2500 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2501 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2502 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2503 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2504 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2505 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2506 void transpose() throw(INTERP_KERNEL::Exception);
2507 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2508 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2509 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2510 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2511 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2512 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2513 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2514 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2515 int front() const throw(INTERP_KERNEL::Exception);
2516 int back() const throw(INTERP_KERNEL::Exception);
2517 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2518 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2519 int *getPointer() throw(INTERP_KERNEL::Exception);
2520 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2521 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2522 const int *begin() const throw(INTERP_KERNEL::Exception);
2523 const int *end() const throw(INTERP_KERNEL::Exception);
2524 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2525 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2526 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2527 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2528 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2529 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2530 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2531 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2532 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2533 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2534 int count(int value) const throw(INTERP_KERNEL::Exception);
2535 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2536 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2537 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2538 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2539 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2540 void abs() throw(INTERP_KERNEL::Exception);
2541 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2542 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2543 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2544 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2545 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2546 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2547 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2548 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2549 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2550 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2551 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2552 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2553 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2554 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2555 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2556 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2557 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2558 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2559 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2560 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2561 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2562 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2563 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2564 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2565 void computeOffsets() throw(INTERP_KERNEL::Exception);
2566 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2567 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2568 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2569 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2570 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2572 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2573 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2574 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2575 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2576 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2577 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2578 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2579 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2580 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2581 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2582 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2583 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2585 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2588 DataArrayInt() throw(INTERP_KERNEL::Exception)
2590 return DataArrayInt::New();
2593 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2595 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)";
2596 std::string msg(msgBase);
2598 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2601 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2605 if(PyInt_Check(nbOfTuples))
2607 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2609 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2612 if(PyInt_Check(nbOfComp))
2613 {//DataArrayInt.New([1,3,4,5],2,2)
2614 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2616 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2617 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2618 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2619 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2623 throw INTERP_KERNEL::Exception(msg.c_str());
2626 {//DataArrayInt.New([1,3,4],3)
2627 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2629 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2630 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2635 throw INTERP_KERNEL::Exception(msg.c_str());
2638 {// DataArrayInt.New([1,3,4])
2639 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2640 int tmpp1=-1,tmpp2=-1;
2641 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2642 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2646 else if(PyInt_Check(elt0))
2648 int nbOfTuples1=PyInt_AS_LONG(elt0);
2650 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2655 if(PyInt_Check(nbOfTuples))
2656 {//DataArrayInt.New(5,2)
2657 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2659 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2660 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2661 ret->alloc(nbOfTuples1,nbOfCompo);
2665 throw INTERP_KERNEL::Exception(msg.c_str());
2668 throw INTERP_KERNEL::Exception(msg.c_str());
2671 {//DataArrayInt.New(5)
2672 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2673 ret->alloc(nbOfTuples1,1);
2678 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2679 {//DataArrayInt.New(numpyArray)
2680 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2684 throw INTERP_KERNEL::Exception(msg.c_str());
2687 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2689 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2692 std::string __str__() const throw(INTERP_KERNEL::Exception)
2694 return self->repr();
2697 int __len__() const throw(INTERP_KERNEL::Exception)
2699 if(self->isAllocated())
2701 return self->getNumberOfTuples();
2705 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2709 int __int__() const throw(INTERP_KERNEL::Exception)
2711 return self->intValue();
2714 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2716 return self->iterator();
2719 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2721 int sz=self->getNumberOfComponents();
2722 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2723 self->accumulate(tmp);
2724 return convertIntArrToPyList(tmp,sz);
2727 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2730 std::vector<int> val2;
2731 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2732 return self->accumulatePerChunck(bg,bg+sz);
2735 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2737 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2738 PyObject *ret=PyList_New(slcs.size());
2739 for(std::size_t i=0;i<slcs.size();i++)
2740 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2744 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2746 if(!PySlice_Check(slic))
2747 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2748 Py_ssize_t strt=2,stp=2,step=2;
2749 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2750 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2751 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2752 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2753 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice contains some unknowns that can't be determined in static method ! Call DataArray::getSlice (non static) instead !");
2754 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2757 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2759 int newNbOfTuples=-1;
2760 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2761 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2762 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2763 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2764 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2765 PyObject *ret=PyTuple_New(2);
2766 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2767 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2771 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2773 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 !";
2774 if(PyList_Check(li) || PyTuple_Check(li))
2778 if(PyInt_Check(nbOfTuples))
2780 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2782 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2785 if(PyInt_Check(nbOfComp))
2786 {//DataArrayInt.setValues([1,3,4,5],2,2)
2787 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2789 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2790 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2791 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2794 throw INTERP_KERNEL::Exception(msg);
2797 {//DataArrayInt.setValues([1,3,4],3)
2799 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2800 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2804 throw INTERP_KERNEL::Exception(msg);
2807 {// DataArrayInt.setValues([1,3,4])
2808 int tmpp1=-1,tmpp2=-1;
2809 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2810 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2814 throw INTERP_KERNEL::Exception(msg);
2817 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2819 const int *vals=self->getConstPointer();
2820 return convertIntArrToPyList(vals,self->getNbOfElems());
2824 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2826 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2830 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2833 bool ret0=self->isEqualIfNotWhy(other,ret1);
2834 PyObject *ret=PyTuple_New(2);
2835 PyObject *ret0Py=ret0?Py_True:Py_False;
2837 PyTuple_SetItem(ret,0,ret0Py);
2838 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2842 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2844 const int *vals=self->getConstPointer();
2845 int nbOfComp=self->getNumberOfComponents();
2846 int nbOfTuples=self->getNumberOfTuples();
2847 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2850 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2852 std::vector<const DataArrayInt *> groups;
2853 std::vector< std::vector<int> > fidsOfGroups;
2854 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2855 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2856 PyObject *ret = PyList_New(2);
2857 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2858 int sz=fidsOfGroups.size();
2859 PyObject *ret1 = PyList_New(sz);
2860 for(int i=0;i<sz;i++)
2861 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2862 PyList_SetItem(ret,1,ret1);
2866 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2869 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2870 if (!SWIG_IsOK(res1))
2873 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2874 self->transformWithIndArr(tmp,tmp+size);
2878 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2879 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2883 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2887 std::vector<int> multiVal;
2888 std::pair<int, std::pair<int,int> > slic;
2889 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2890 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2894 return self->getIdsEqualList(&singleVal,&singleVal+1);
2896 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2898 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2900 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2904 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2908 std::vector<int> multiVal;
2909 std::pair<int, std::pair<int,int> > slic;
2910 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2911 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2915 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2917 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2919 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2921 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2925 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2927 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2929 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2930 if (!SWIG_IsOK(res1))
2933 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2934 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2938 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2940 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2941 da2->checkAllocated();
2942 int size=self->getNumberOfTuples();
2943 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2945 PyObject *ret = PyList_New(3);
2946 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2947 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2948 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2952 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2955 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2956 if (!SWIG_IsOK(res1))
2959 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2960 return self->transformWithIndArrR(tmp,tmp+size);
2964 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2965 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2969 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2972 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2973 if (!SWIG_IsOK(res1))
2976 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2977 if(size!=self->getNumberOfTuples())
2979 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2981 return self->renumberAndReduce(tmp,newNbOfTuple);
2985 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2987 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2988 da2->checkAllocated();
2989 int size=self->getNumberOfTuples();
2990 if(size!=self->getNumberOfTuples())
2992 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2994 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2998 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3001 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3002 if (!SWIG_IsOK(res1))
3005 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3006 if(size!=self->getNumberOfTuples())
3008 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3010 return self->renumber(tmp);
3014 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3016 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3017 da2->checkAllocated();
3018 int size=self->getNumberOfTuples();
3019 if(size!=self->getNumberOfTuples())
3021 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3023 return self->renumber(da2->getConstPointer());
3027 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3030 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3031 if (!SWIG_IsOK(res1))
3034 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3035 if(size!=self->getNumberOfTuples())
3037 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3039 return self->renumberR(tmp);
3043 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3045 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3046 da2->checkAllocated();
3047 int size=self->getNumberOfTuples();
3048 if(size!=self->getNumberOfTuples())
3050 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3052 return self->renumberR(da2->getConstPointer());
3056 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3058 std::vector<int> tmp;
3059 convertPyToNewIntArr3(li,tmp);
3060 self->setSelectedComponents(a,tmp);
3063 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3065 int sz=self->getNumberOfComponents();
3066 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3067 self->getTuple(tupleId,tmp);
3068 return convertIntArrToPyList(tmp,sz);
3071 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3073 DataArrayInt *arr=0;
3074 DataArrayInt *arrI=0;
3075 self->changeSurjectiveFormat(targetNb,arr,arrI);
3076 PyObject *res = PyList_New(2);
3077 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3078 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3082 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3084 std::vector<const DataArrayInt *> tmp;
3085 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3086 return DataArrayInt::Meld(tmp);
3089 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3091 std::vector<const DataArrayInt *> tmp;
3092 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3093 return DataArrayInt::Aggregate(tmp);
3096 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3098 std::vector<const DataArrayInt *> tmp;
3099 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3100 return DataArrayInt::AggregateIndexes(tmp);
3103 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3105 std::vector<const DataArrayInt *> tmp;
3106 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3107 return DataArrayInt::BuildUnion(tmp);
3110 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3112 std::vector<const DataArrayInt *> tmp;
3113 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3114 return DataArrayInt::BuildIntersection(tmp);
3117 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3120 int r1=self->getMaxValue(tmp);
3121 PyObject *ret=PyTuple_New(2);
3122 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3123 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3127 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3130 int r1=self->getMinValue(tmp);
3131 PyObject *ret=PyTuple_New(2);
3132 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3133 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3137 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3139 int nbOfCompo=self->getNumberOfComponents();
3144 if(PyInt_Check(obj))
3146 int val=(int)PyInt_AS_LONG(obj);
3147 return self->locateValue(val);
3150 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3154 std::vector<int> arr;
3155 convertPyToNewIntArr3(obj,arr);
3156 return self->locateTuple(arr);
3161 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3163 int nbOfCompo=self->getNumberOfComponents();
3170 if(PyInt_Check(obj))
3172 int val=(int)PyInt_AS_LONG(obj);
3173 return self->presenceOfValue(val);
3176 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3180 std::vector<int> arr;
3181 convertPyToNewIntArr3(obj,arr);
3182 return self->presenceOfTuple(arr);
3187 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3189 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3190 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3191 self->checkAllocated();
3192 int nbOfTuples=self->getNumberOfTuples();
3193 int nbOfComponents=self->getNumberOfComponents();
3195 std::vector<int> vt1,vc1;
3196 std::pair<int, std::pair<int,int> > pt1,pc1;
3197 DataArrayInt *dt1=0,*dc1=0;
3199 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3200 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3205 if(nbOfComponents==1)
3206 return PyInt_FromLong(self->getIJSafe(it1,0));
3207 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3210 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3212 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3214 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3216 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3219 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3220 std::vector<int> v2(1,ic1);
3221 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3225 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3226 std::vector<int> v2(1,ic1);
3227 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3231 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3232 std::vector<int> v2(1,ic1);
3233 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3237 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3238 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3242 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3243 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3247 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3248 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3252 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3253 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3257 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3258 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3259 std::vector<int> v2(nbOfComp);
3260 for(int i=0;i<nbOfComp;i++)
3261 v2[i]=pc1.first+i*pc1.second.second;
3262 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3266 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3267 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3268 std::vector<int> v2(nbOfComp);
3269 for(int i=0;i<nbOfComp;i++)
3270 v2[i]=pc1.first+i*pc1.second.second;
3271 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3275 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3276 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3277 std::vector<int> v2(nbOfComp);
3278 for(int i=0;i<nbOfComp;i++)
3279 v2[i]=pc1.first+i*pc1.second.second;
3280 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3284 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3285 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3286 std::vector<int> v2(nbOfComp);
3287 for(int i=0;i<nbOfComp;i++)
3288 v2[i]=pc1.first+i*pc1.second.second;
3289 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3292 throw INTERP_KERNEL::Exception(msg);
3296 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3298 self->checkAllocated();
3299 const char msg[]="Unexpected situation in __setitem__ !";
3300 int nbOfTuples=self->getNumberOfTuples();
3301 int nbOfComponents=self->getNumberOfComponents();
3304 std::vector<int> v1;
3306 DataArrayIntTuple *dd1=0;
3307 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3309 std::vector<int> vt1,vc1;
3310 std::pair<int, std::pair<int,int> > pt1,pc1;
3311 DataArrayInt *dt1=0,*dc1=0;
3312 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3313 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3321 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3324 tmp=DataArrayInt::New();
3325 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3326 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3329 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3332 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3333 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3336 throw INTERP_KERNEL::Exception(msg);
3345 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3348 tmp=DataArrayInt::New();
3349 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3350 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3353 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3356 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3357 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3360 throw INTERP_KERNEL::Exception(msg);
3369 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3372 tmp=DataArrayInt::New();
3373 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3374 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3377 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3380 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3381 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3384 throw INTERP_KERNEL::Exception(msg);
3393 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3396 tmp=DataArrayInt::New();
3397 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3398 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3401 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3404 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3405 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3408 throw INTERP_KERNEL::Exception(msg);
3417 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3420 tmp=DataArrayInt::New();
3421 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3422 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3425 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3428 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3429 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3432 throw INTERP_KERNEL::Exception(msg);
3441 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3444 tmp=DataArrayInt::New();
3445 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3446 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3449 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3452 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3453 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3456 throw INTERP_KERNEL::Exception(msg);
3465 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3468 tmp=DataArrayInt::New();
3469 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3470 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3473 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3476 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3477 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3480 throw INTERP_KERNEL::Exception(msg);
3489 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3492 tmp=DataArrayInt::New();
3493 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3494 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3497 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3500 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3501 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3504 throw INTERP_KERNEL::Exception(msg);
3513 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3516 tmp=DataArrayInt::New();
3517 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3518 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3521 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3524 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3525 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3528 throw INTERP_KERNEL::Exception(msg);
3537 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3540 tmp=DataArrayInt::New();
3541 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3542 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3545 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3548 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3549 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3552 throw INTERP_KERNEL::Exception(msg);
3561 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3564 tmp=DataArrayInt::New();
3565 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3566 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3569 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3572 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3573 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3576 throw INTERP_KERNEL::Exception(msg);
3585 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3588 tmp=DataArrayInt::New();
3589 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3590 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3593 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3596 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3597 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3600 throw INTERP_KERNEL::Exception(msg);
3609 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3612 tmp=DataArrayInt::New();
3613 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3614 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3617 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3620 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3621 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3624 throw INTERP_KERNEL::Exception(msg);
3633 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3636 tmp=DataArrayInt::New();
3637 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3638 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3641 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3644 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3645 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3648 throw INTERP_KERNEL::Exception(msg);
3657 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3660 tmp=DataArrayInt::New();
3661 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3662 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3665 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3668 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3669 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3672 throw INTERP_KERNEL::Exception(msg);
3681 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3684 tmp=DataArrayInt::New();
3685 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3686 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3689 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3692 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3693 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3696 throw INTERP_KERNEL::Exception(msg);
3701 throw INTERP_KERNEL::Exception(msg);
3706 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3708 return self->negate();
3711 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3713 const char msg[]="Unexpected situation in __add__ !";
3716 std::vector<int> aa;
3717 DataArrayIntTuple *aaa;
3719 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3724 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3725 ret->applyLin(1,val);
3730 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3731 return DataArrayInt::Add(self,aaaa);
3735 return DataArrayInt::Add(self,a);
3739 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3740 return DataArrayInt::Add(self,aaaa);
3743 throw INTERP_KERNEL::Exception(msg);
3747 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3749 const char msg[]="Unexpected situation in __radd__ !";
3752 std::vector<int> aa;
3753 DataArrayIntTuple *aaa;
3755 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3761 ret->applyLin(1,val);
3766 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3767 return DataArrayInt::Add(self,aaaa);
3771 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3772 return DataArrayInt::Add(self,aaaa);
3775 throw INTERP_KERNEL::Exception(msg);
3779 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3781 const char msg[]="Unexpected situation in __iadd__ !";
3784 std::vector<int> aa;
3785 DataArrayIntTuple *aaa;
3787 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3792 self->applyLin(1,val);
3793 Py_XINCREF(trueSelf);
3798 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3800 Py_XINCREF(trueSelf);
3806 Py_XINCREF(trueSelf);
3811 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3812 self->addEqual(aaaa);
3813 Py_XINCREF(trueSelf);
3817 throw INTERP_KERNEL::Exception(msg);
3821 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3823 const char msg[]="Unexpected situation in __sub__ !";
3826 std::vector<int> aa;
3827 DataArrayIntTuple *aaa;
3829 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3834 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3835 ret->applyLin(1,-val);
3840 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3841 return DataArrayInt::Substract(self,aaaa);
3845 return DataArrayInt::Substract(self,a);
3849 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3850 return DataArrayInt::Substract(self,aaaa);
3853 throw INTERP_KERNEL::Exception(msg);
3857 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3859 const char msg[]="Unexpected situation in __rsub__ !";
3862 std::vector<int> aa;
3863 DataArrayIntTuple *aaa;
3865 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3871 ret->applyLin(-1,val);
3876 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3877 return DataArrayInt::Substract(aaaa,self);
3881 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3882 return DataArrayInt::Substract(aaaa,self);
3885 throw INTERP_KERNEL::Exception(msg);
3889 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3891 const char msg[]="Unexpected situation in __isub__ !";
3894 std::vector<int> aa;
3895 DataArrayIntTuple *aaa;
3897 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3902 self->applyLin(1,-val);
3903 Py_XINCREF(trueSelf);
3908 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3909 self->substractEqual(bb);
3910 Py_XINCREF(trueSelf);
3915 self->substractEqual(a);
3916 Py_XINCREF(trueSelf);
3921 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3922 self->substractEqual(aaaa);
3923 Py_XINCREF(trueSelf);
3927 throw INTERP_KERNEL::Exception(msg);
3931 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3933 const char msg[]="Unexpected situation in __mul__ !";
3936 std::vector<int> aa;
3937 DataArrayIntTuple *aaa;
3939 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3944 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3945 ret->applyLin(val,0);
3950 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3951 return DataArrayInt::Multiply(self,aaaa);
3955 return DataArrayInt::Multiply(self,a);
3959 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3960 return DataArrayInt::Multiply(self,aaaa);
3963 throw INTERP_KERNEL::Exception(msg);
3967 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3969 const char msg[]="Unexpected situation in __rmul__ !";
3972 std::vector<int> aa;
3973 DataArrayIntTuple *aaa;
3975 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3981 ret->applyLin(val,0);
3986 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3987 return DataArrayInt::Multiply(self,aaaa);
3991 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3992 return DataArrayInt::Multiply(self,aaaa);
3995 throw INTERP_KERNEL::Exception(msg);
3999 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4001 const char msg[]="Unexpected situation in __imul__ !";
4004 std::vector<int> aa;
4005 DataArrayIntTuple *aaa;
4007 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4012 self->applyLin(val,0);
4013 Py_XINCREF(trueSelf);
4018 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4019 self->multiplyEqual(bb);
4020 Py_XINCREF(trueSelf);
4025 self->multiplyEqual(a);
4026 Py_XINCREF(trueSelf);
4031 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4032 self->multiplyEqual(aaaa);
4033 Py_XINCREF(trueSelf);
4037 throw INTERP_KERNEL::Exception(msg);
4041 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4043 const char msg[]="Unexpected situation in __div__ !";
4046 std::vector<int> aa;
4047 DataArrayIntTuple *aaa;
4049 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4054 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4055 ret->applyDivideBy(val);
4060 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4061 return DataArrayInt::Divide(self,aaaa);
4065 return DataArrayInt::Divide(self,a);
4069 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4070 return DataArrayInt::Divide(self,aaaa);
4073 throw INTERP_KERNEL::Exception(msg);
4077 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4079 const char msg[]="Unexpected situation in __rdiv__ !";
4082 std::vector<int> aa;
4083 DataArrayIntTuple *aaa;
4085 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4090 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4096 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4097 return DataArrayInt::Divide(aaaa,self);
4101 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4102 return DataArrayInt::Divide(aaaa,self);
4105 throw INTERP_KERNEL::Exception(msg);
4109 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4111 const char msg[]="Unexpected situation in __idiv__ !";
4114 std::vector<int> aa;
4115 DataArrayIntTuple *aaa;
4117 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4122 self->applyDivideBy(val);
4123 Py_XINCREF(trueSelf);
4128 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4129 self->divideEqual(bb);
4130 Py_XINCREF(trueSelf);
4135 self->divideEqual(a);
4136 Py_XINCREF(trueSelf);
4141 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4142 self->divideEqual(aaaa);
4143 Py_XINCREF(trueSelf);
4147 throw INTERP_KERNEL::Exception(msg);
4151 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4153 const char msg[]="Unexpected situation in __mod__ !";
4156 std::vector<int> aa;
4157 DataArrayIntTuple *aaa;
4159 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4164 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4165 ret->applyModulus(val);
4170 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4171 return DataArrayInt::Modulus(self,aaaa);
4175 return DataArrayInt::Modulus(self,a);
4179 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4180 return DataArrayInt::Modulus(self,aaaa);
4183 throw INTERP_KERNEL::Exception(msg);
4187 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4189 const char msg[]="Unexpected situation in __rmod__ !";
4192 std::vector<int> aa;
4193 DataArrayIntTuple *aaa;
4195 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4200 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4201 ret->applyRModulus(val);
4206 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4207 return DataArrayInt::Modulus(aaaa,self);
4211 return DataArrayInt::Modulus(a,self);
4215 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4216 return DataArrayInt::Modulus(aaaa,self);
4219 throw INTERP_KERNEL::Exception(msg);
4223 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4225 const char msg[]="Unexpected situation in __imod__ !";
4228 std::vector<int> aa;
4229 DataArrayIntTuple *aaa;
4231 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4236 self->applyModulus(val);
4237 Py_XINCREF(trueSelf);
4242 self->modulusEqual(a);
4243 Py_XINCREF(trueSelf);
4248 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4249 self->modulusEqual(aaaa);
4250 Py_XINCREF(trueSelf);
4254 throw INTERP_KERNEL::Exception(msg);
4258 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4260 const char msg[]="Unexpected situation in __pow__ !";
4263 std::vector<int> aa;
4264 DataArrayIntTuple *aaa;
4266 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4271 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4277 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4278 return DataArrayInt::Pow(self,aaaa);
4282 return DataArrayInt::Pow(self,a);
4286 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4287 return DataArrayInt::Pow(self,aaaa);
4290 throw INTERP_KERNEL::Exception(msg);
4294 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4296 const char msg[]="Unexpected situation in __rpow__ !";
4299 std::vector<int> aa;
4300 DataArrayIntTuple *aaa;
4302 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4307 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4308 ret->applyRPow(val);
4313 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4314 return DataArrayInt::Pow(aaaa,self);
4318 return DataArrayInt::Pow(a,self);
4322 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4323 return DataArrayInt::Pow(aaaa,self);
4326 throw INTERP_KERNEL::Exception(msg);
4330 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4332 const char msg[]="Unexpected situation in __ipow__ !";
4335 std::vector<int> aa;
4336 DataArrayIntTuple *aaa;
4338 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4343 self->applyPow(val);
4344 Py_XINCREF(trueSelf);
4350 Py_XINCREF(trueSelf);
4355 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4356 self->powEqual(aaaa);
4357 Py_XINCREF(trueSelf);
4361 throw INTERP_KERNEL::Exception(msg);
4365 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4367 std::ostringstream oss;
4368 self->reprQuickOverview(oss);
4372 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4374 int szArr,sw,iTypppArr;
4375 std::vector<int> stdvecTyyppArr;
4376 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4377 self->pushBackValsSilent(tmp,tmp+szArr);
4380 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4382 std::vector<int> ret1;
4383 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4384 std::size_t sz=ret0.size();
4385 PyObject *pyRet=PyTuple_New(2);
4386 PyObject *pyRet0=PyList_New((int)sz);
4387 PyObject *pyRet1=PyList_New((int)sz);
4388 for(std::size_t i=0;i<sz;i++)
4390 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4391 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4393 PyTuple_SetItem(pyRet,0,pyRet0);
4394 PyTuple_SetItem(pyRet,1,pyRet1);
4398 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4400 DataArrayInt *ret0=0,*ret1=0;
4401 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4402 PyObject *pyRet=PyTuple_New(2);
4403 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4404 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4410 class DataArrayIntTuple;
4412 class DataArrayIntIterator
4415 DataArrayIntIterator(DataArrayInt *da);
4416 ~DataArrayIntIterator();
4421 DataArrayIntTuple *ret=self->nextt();
4423 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4426 PyErr_SetString(PyExc_StopIteration,"No more data.");
4433 class DataArrayIntTuple
4436 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4437 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4440 std::string __str__() const throw(INTERP_KERNEL::Exception)
4442 return self->repr();
4445 int __int__() const throw(INTERP_KERNEL::Exception)
4447 return self->intValue();
4450 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4452 return self->buildDAInt(1,self->getNumberOfCompo());
4455 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4457 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4458 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4459 Py_XINCREF(trueSelf);
4463 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4465 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4466 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4467 Py_XINCREF(trueSelf);
4471 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4473 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4474 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4475 Py_XINCREF(trueSelf);
4479 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4481 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4482 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4483 Py_XINCREF(trueSelf);
4487 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4489 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4490 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4491 Py_XINCREF(trueSelf);
4495 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4497 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4500 std::vector<int> multiVal;
4501 std::pair<int, std::pair<int,int> > slic;
4502 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4503 const int *pt=self->getConstPointer();
4504 int nbc=self->getNumberOfCompo();
4505 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4512 std::ostringstream oss;
4513 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4514 throw INTERP_KERNEL::Exception(oss.str().c_str());
4517 return PyInt_FromLong(pt[singleVal]);
4521 return PyInt_FromLong(pt[nbc+singleVal]);
4524 std::ostringstream oss;
4525 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4526 throw INTERP_KERNEL::Exception(oss.str().c_str());
4532 PyObject *t=PyTuple_New(multiVal.size());
4533 for(int j=0;j<(int)multiVal.size();j++)
4535 int cid=multiVal[j];
4538 std::ostringstream oss;
4539 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4540 throw INTERP_KERNEL::Exception(oss.str().c_str());
4542 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4548 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4549 PyObject *t=PyTuple_New(sz);
4550 for(int j=0;j<sz;j++)
4551 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4555 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4559 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4561 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4562 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4565 std::vector<int> multiValV;
4566 std::pair<int, std::pair<int,int> > slicV;
4567 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4568 int nbc=self->getNumberOfCompo();
4569 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4571 std::vector<int> multiVal;
4572 std::pair<int, std::pair<int,int> > slic;
4573 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4574 int *pt=self->getPointer();
4575 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4582 std::ostringstream oss;
4583 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4584 throw INTERP_KERNEL::Exception(oss.str().c_str());
4590 pt[singleVal]=singleValV;
4595 if(multiValV.size()!=1)
4597 std::ostringstream oss;
4598 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4599 throw INTERP_KERNEL::Exception(oss.str().c_str());
4601 pt[singleVal]=multiValV[0];
4606 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4610 throw INTERP_KERNEL::Exception(msg);
4619 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4623 std::ostringstream oss;
4624 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4625 throw INTERP_KERNEL::Exception(oss.str().c_str());
4633 if(multiVal.size()!=multiValV.size())
4635 std::ostringstream oss;
4636 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4637 throw INTERP_KERNEL::Exception(oss.str().c_str());
4639 for(int i=0;i<(int)multiVal.size();i++)
4641 int pos=multiVal[i];
4644 std::ostringstream oss;
4645 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4646 throw INTERP_KERNEL::Exception(oss.str().c_str());
4648 pt[multiVal[i]]=multiValV[i];
4654 const int *ptV=daIntTyyppV->getConstPointer();
4655 if(nbc>daIntTyyppV->getNumberOfCompo())
4657 std::ostringstream oss;
4658 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4659 throw INTERP_KERNEL::Exception(oss.str().c_str());
4661 std::copy(ptV,ptV+nbc,pt);
4665 throw INTERP_KERNEL::Exception(msg);
4670 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4675 for(int j=0;j<sz;j++)
4676 pt[slic.first+j*slic.second.second]=singleValV;
4681 if(sz!=(int)multiValV.size())
4683 std::ostringstream oss;
4684 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4685 throw INTERP_KERNEL::Exception(oss.str().c_str());
4687 for(int j=0;j<sz;j++)
4688 pt[slic.first+j*slic.second.second]=multiValV[j];
4693 const int *ptV=daIntTyyppV->getConstPointer();
4694 if(sz>daIntTyyppV->getNumberOfCompo())
4696 std::ostringstream oss;
4697 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4698 throw INTERP_KERNEL::Exception(oss.str().c_str());
4700 for(int j=0;j<sz;j++)
4701 pt[slic.first+j*slic.second.second]=ptV[j];
4705 throw INTERP_KERNEL::Exception(msg);
4709 throw INTERP_KERNEL::Exception(msg);
4715 class DataArrayChar : public DataArray
4718 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4719 int getHashCode() const throw(INTERP_KERNEL::Exception);
4720 bool empty() const throw(INTERP_KERNEL::Exception);
4721 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4722 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4723 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4724 char popBackSilent() throw(INTERP_KERNEL::Exception);
4725 void pack() const throw(INTERP_KERNEL::Exception);
4726 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4727 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4728 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4729 void reverse() throw(INTERP_KERNEL::Exception);
4730 void fillWithZero() throw(INTERP_KERNEL::Exception);
4731 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4732 std::string repr() const throw(INTERP_KERNEL::Exception);
4733 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4734 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4735 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4736 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4737 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4738 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4739 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4740 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4741 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4742 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4743 char front() const throw(INTERP_KERNEL::Exception);
4744 char back() const throw(INTERP_KERNEL::Exception);
4745 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4746 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4747 char *getPointer() throw(INTERP_KERNEL::Exception);
4748 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4749 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4750 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4751 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4752 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4753 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4754 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4755 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4756 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4757 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4758 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4761 int __len__() const throw(INTERP_KERNEL::Exception)
4763 if(self->isAllocated())
4765 return self->getNumberOfTuples();
4769 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4773 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4776 bool ret0=self->isEqualIfNotWhy(other,ret1);
4777 PyObject *ret=PyTuple_New(2);
4778 PyObject *ret0Py=ret0?Py_True:Py_False;
4780 PyTuple_SetItem(ret,0,ret0Py);
4781 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4785 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4788 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4789 if (!SWIG_IsOK(res1))
4792 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4793 if(size!=self->getNumberOfTuples())
4795 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4797 return self->renumber(tmp);
4801 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4803 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4804 da2->checkAllocated();
4805 int size=self->getNumberOfTuples();
4806 if(size!=self->getNumberOfTuples())
4808 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4810 return self->renumber(da2->getConstPointer());
4814 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4817 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4818 if (!SWIG_IsOK(res1))
4821 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4822 if(size!=self->getNumberOfTuples())
4824 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4826 return self->renumberR(tmp);
4830 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4832 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4833 da2->checkAllocated();
4834 int size=self->getNumberOfTuples();
4835 if(size!=self->getNumberOfTuples())
4837 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4839 return self->renumberR(da2->getConstPointer());
4843 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4846 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4847 if (!SWIG_IsOK(res1))
4850 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4851 if(size!=self->getNumberOfTuples())
4853 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4855 return self->renumberAndReduce(tmp,newNbOfTuple);
4859 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4861 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4862 da2->checkAllocated();
4863 int size=self->getNumberOfTuples();
4864 if(size!=self->getNumberOfTuples())
4866 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4868 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4872 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4874 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4875 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4876 return DataArrayChar::Aggregate(tmp);
4879 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4881 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4882 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4883 return DataArrayChar::Meld(tmp);
4888 class DataArrayByteIterator;
4890 class DataArrayByte : public DataArrayChar
4893 static DataArrayByte *New();
4894 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4895 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4896 char byteValue() const throw(INTERP_KERNEL::Exception);
4899 DataArrayByte() throw(INTERP_KERNEL::Exception)
4901 return DataArrayByte::New();
4904 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4906 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) !";
4907 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4911 if(PyInt_Check(nbOfTuples))
4913 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4915 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4918 if(PyInt_Check(nbOfComp))
4919 {//DataArrayByte.New([1,3,4,5],2,2)
4920 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4922 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4923 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4924 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4925 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4929 throw INTERP_KERNEL::Exception(msg);
4932 {//DataArrayByte.New([1,3,4],3)
4933 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4935 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4936 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4941 throw INTERP_KERNEL::Exception(msg);
4944 {// DataArrayByte.New([1,3,4])
4945 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4946 int tmpp1=-1,tmpp2=-1;
4947 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4948 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4952 else if(PyInt_Check(elt0))
4954 int nbOfTuples1=PyInt_AS_LONG(elt0);
4956 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4961 if(PyInt_Check(nbOfTuples))
4962 {//DataArrayByte.New(5,2)
4963 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4965 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4966 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4967 ret->alloc(nbOfTuples1,nbOfCompo);
4971 throw INTERP_KERNEL::Exception(msg);
4974 throw INTERP_KERNEL::Exception(msg);
4977 {//DataArrayByte.New(5)
4978 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4979 ret->alloc(nbOfTuples1,1);
4984 throw INTERP_KERNEL::Exception(msg);
4987 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4989 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4992 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4994 std::ostringstream oss;
4995 self->reprQuickOverview(oss);
4999 int __int__() const throw(INTERP_KERNEL::Exception)
5001 return (int) self->byteValue();
5004 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5006 return self->iterator();
5009 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5011 return (int)self->getIJ(tupleId,compoId);
5014 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5016 return (int)self->getIJSafe(tupleId,compoId);
5019 std::string __str__() const throw(INTERP_KERNEL::Exception)
5021 return self->repr();
5024 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5026 const char *vals=self->getConstPointer();
5027 int nbOfComp=self->getNumberOfComponents();
5028 int nbOfTuples=self->getNumberOfTuples();
5029 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5032 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5035 int ival=-1; std::vector<int> ivval;
5036 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5037 std::vector<char> vals(sz);
5038 std::copy(pt,pt+sz,vals.begin());
5039 return self->presenceOfTuple(vals);
5042 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5045 int ival=-1; std::vector<int> ivval;
5046 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5047 std::vector<char> vals2(sz);
5048 std::copy(pt,pt+sz,vals2.begin());
5049 return self->presenceOfValue(vals2);
5052 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5055 int ival=-1; std::vector<int> ivval;
5056 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5057 std::vector<char> vals2(sz);
5058 std::copy(pt,pt+sz,vals2.begin());
5059 return self->locateValue(vals2);
5062 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5065 int ival=-1; std::vector<int> ivval;
5066 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5067 std::vector<char> vals(sz);
5068 std::copy(pt,pt+sz,vals.begin());
5069 return self->locateTuple(vals);
5072 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5075 int ival=-1; std::vector<int> ivval;
5076 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5077 std::vector<char> vals(sz);
5078 std::copy(pt,pt+sz,vals.begin());
5079 return self->search(vals);
5082 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5084 int sz=self->getNumberOfComponents();
5085 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5086 self->getTuple(tupleId,tmp);
5087 PyObject *ret=PyTuple_New(sz);
5088 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5092 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5095 int r1=(int)self->getMaxValue(tmp);
5096 PyObject *ret=PyTuple_New(2);
5097 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5098 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5102 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5105 int r1=(int)self->getMinValue(tmp);
5106 PyObject *ret=PyTuple_New(2);
5107 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5108 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5112 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5114 int nbOfCompo=self->getNumberOfComponents();
5119 if(PyInt_Check(obj))
5121 int val=(int)PyInt_AS_LONG(obj);
5122 return self->locateValue(val);
5125 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5128 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5132 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5134 int nbOfCompo=self->getNumberOfComponents();
5141 if(PyInt_Check(obj))
5143 int val=(int)PyInt_AS_LONG(obj);
5144 return self->presenceOfValue(val);
5147 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5150 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5156 class DataArrayByteTuple;
5158 class DataArrayByteIterator
5161 DataArrayByteIterator(DataArrayByte *da);
5162 ~DataArrayByteIterator();
5165 class DataArrayByteTuple
5168 std::string repr() const throw(INTERP_KERNEL::Exception);
5169 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5172 std::string __str__() const throw(INTERP_KERNEL::Exception)
5174 return self->repr();
5177 char __int__() const throw(INTERP_KERNEL::Exception)
5179 return self->byteValue();
5182 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5184 return self->buildDAByte(1,self->getNumberOfCompo());
5189 class DataArrayAsciiCharIterator;
5191 class DataArrayAsciiChar : public DataArrayChar
5194 static DataArrayAsciiChar *New();
5195 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5196 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5197 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5200 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5202 return DataArrayAsciiChar::New();
5205 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5207 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) !";
5208 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5212 if(PyInt_Check(nbOfTuples))
5214 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5216 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5219 if(PyInt_Check(nbOfComp))
5220 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5221 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5223 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5224 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5225 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5226 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5230 throw INTERP_KERNEL::Exception(msg);
5233 {//DataArrayAsciiChar.New([1,3,4],3)
5234 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5236 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5237 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5241 else if(PyString_Check(nbOfTuples))
5243 if(PyString_Size(nbOfTuples)!=1)
5244 throw INTERP_KERNEL::Exception(msg);
5245 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5246 std::vector<std::string> tmp;
5247 if(fillStringVector(elt0,tmp))
5248 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5250 throw INTERP_KERNEL::Exception(msg);
5253 throw INTERP_KERNEL::Exception(msg);
5257 std::vector<std::string> tmmp;
5258 if(fillStringVector(elt0,tmmp))
5259 //DataArrayAsciiChar.New(["abc","de","fghi"])
5260 return DataArrayAsciiChar::New(tmmp,' ');
5263 // DataArrayAsciiChar.New([1,3,4])
5264 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5265 int tmpp1=-1,tmpp2=-1;
5266 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5267 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5272 else if(PyInt_Check(elt0))
5274 int nbOfTuples1=PyInt_AS_LONG(elt0);
5276 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5281 if(PyInt_Check(nbOfTuples))
5282 {//DataArrayAsciiChar.New(5,2)
5283 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5285 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5286 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5287 ret->alloc(nbOfTuples1,nbOfCompo);
5291 throw INTERP_KERNEL::Exception(msg);
5294 throw INTERP_KERNEL::Exception(msg);
5297 {//DataArrayAsciiChar.New(5)
5298 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5299 ret->alloc(nbOfTuples1,1);
5304 throw INTERP_KERNEL::Exception(msg);
5307 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5309 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5312 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5314 std::ostringstream oss;
5315 self->reprQuickOverview(oss);
5319 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5321 return self->iterator();
5324 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5326 char tmp[2]; tmp[1]='\0';
5327 tmp[0]=self->getIJ(tupleId,compoId);
5328 return std::string(tmp);
5331 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5333 char tmp[2]; tmp[1]='\0';
5334 tmp[0]=self->getIJSafe(tupleId,compoId);
5335 return std::string(tmp);
5338 std::string __str__() const throw(INTERP_KERNEL::Exception)
5340 return self->repr();
5343 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5345 const char *vals=self->getConstPointer();
5346 int nbOfComp=self->getNumberOfComponents();
5347 int nbOfTuples=self->getNumberOfTuples();
5348 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5351 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5353 if(PyString_Check(tupl))
5355 Py_ssize_t sz=PyString_Size(tupl);
5356 std::vector<char> vals(sz);
5357 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5358 return self->presenceOfTuple(vals);
5361 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5364 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5366 if(PyString_Check(vals))
5368 Py_ssize_t sz=PyString_Size(vals);
5369 std::vector<char> vals2(sz);
5370 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5371 return self->presenceOfValue(vals2);
5374 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5377 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5379 if(PyString_Check(vals))
5381 Py_ssize_t sz=PyString_Size(vals);
5382 std::vector<char> vals2(sz);
5383 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5384 return self->locateValue(vals2);
5387 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5390 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5392 if(PyString_Check(tupl))
5394 Py_ssize_t sz=PyString_Size(tupl);
5395 std::vector<char> vals(sz);
5396 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5397 return self->locateTuple(vals);
5400 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5403 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5405 if(PyString_Check(strOrListOfInt))
5407 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5408 std::vector<char> vals(sz);
5409 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5410 return self->search(vals);
5413 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5416 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5418 int sz=self->getNumberOfComponents();
5419 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5420 self->getTuple(tupleId,tmp);
5421 return PyString_FromString(tmp);
5424 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5427 char tmp2[2]; tmp2[1]='\0';
5428 tmp2[0]=self->getMaxValue(tmp);
5429 PyObject *ret=PyTuple_New(2);
5430 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5431 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5435 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5438 char tmp2[2]; tmp2[1]='\0';
5439 tmp2[0]=self->getMinValue(tmp);
5440 PyObject *ret=PyTuple_New(2);
5441 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5442 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5446 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5448 int nbOfCompo=self->getNumberOfComponents();
5453 if(PyString_Check(obj))
5455 Py_ssize_t sz=PyString_Size(obj);
5456 char *pt=PyString_AsString(obj);
5458 return self->locateValue(pt[0]);
5460 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5463 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5466 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5470 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5472 int nbOfCompo=self->getNumberOfComponents();
5479 if(PyString_Check(obj))
5481 Py_ssize_t sz=PyString_Size(obj);
5482 char *pt=PyString_AsString(obj);
5484 return self->presenceOfValue(pt[0]);
5486 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5489 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5492 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5496 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5499 std::vector<int> stdvecTyyppArr;
5500 std::pair<int, std::pair<int,int> > sTyyppArr;
5501 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5502 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5506 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5508 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5510 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5512 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5514 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5518 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5520 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.";
5522 std::vector<int> stdvecTyyppArr;
5523 std::pair<int, std::pair<int,int> > sTyyppArr;
5524 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5525 int nbOfCompo=self->getNumberOfComponents();
5526 int nbOfTuples=self->getNumberOfTuples();
5527 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5529 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5530 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5539 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5545 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5546 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5549 //value vector<string>
5552 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5553 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5556 //value DataArrayChar
5559 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5563 throw INTERP_KERNEL::Exception(msg);
5567 {//obj list-tuple[int]
5573 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5579 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5580 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5583 //value vector<string>
5586 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5587 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5590 //value DataArrayChar
5593 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5597 throw INTERP_KERNEL::Exception(msg);
5608 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5614 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5615 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5618 //value vector<string>
5621 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5622 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5625 //value DataArrayChar
5628 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5632 throw INTERP_KERNEL::Exception(msg);
5643 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5649 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5650 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5653 //value vector<string>
5656 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5657 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5660 //value DataArrayChar
5663 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5667 throw INTERP_KERNEL::Exception(msg);
5672 throw INTERP_KERNEL::Exception(msg);
5678 class DataArrayAsciiCharTuple;
5680 class DataArrayAsciiCharIterator
5683 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5684 ~DataArrayAsciiCharIterator();
5689 DataArrayAsciiCharTuple *ret=self->nextt();
5691 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5694 PyErr_SetString(PyExc_StopIteration,"No more data.");
5701 class DataArrayAsciiCharTuple
5704 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5705 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5708 std::string __str__() const throw(INTERP_KERNEL::Exception)
5710 return self->repr();
5713 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5715 return self->buildDAAsciiChar(1,self->getNumberOfCompo());