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;
1535 #ifndef WITHOUT_AUTOFIELD
1537 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1539 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1542 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1543 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1545 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1548 throw INTERP_KERNEL::Exception(msg);
1552 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1557 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1558 ret->applyLin(1.,val);
1559 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1563 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1567 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1568 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1572 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1573 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1576 throw INTERP_KERNEL::Exception(msg);
1580 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1582 const char msg[]="Unexpected situation in __radd__ !";
1585 DataArrayDoubleTuple *aa;
1586 std::vector<double> bb;
1588 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1593 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1594 ret->applyLin(1.,val);
1599 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1600 return DataArrayDouble::Add(self,aaa);
1604 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1605 return DataArrayDouble::Add(self,aaa);
1608 throw INTERP_KERNEL::Exception(msg);
1612 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1614 const char msg[]="Unexpected situation in __iadd__ !";
1617 DataArrayDoubleTuple *aa;
1618 std::vector<double> bb;
1620 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1625 self->applyLin(1.,val);
1626 Py_XINCREF(trueSelf);
1632 Py_XINCREF(trueSelf);
1637 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1638 self->addEqual(aaa);
1639 Py_XINCREF(trueSelf);
1644 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1645 self->addEqual(aaa);
1646 Py_XINCREF(trueSelf);
1650 throw INTERP_KERNEL::Exception(msg);
1654 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1656 const char msg[]="Unexpected situation in __sub__ !";
1659 DataArrayDoubleTuple *aa;
1660 std::vector<double> bb;
1663 #ifndef WITHOUT_AUTOFIELD
1665 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1667 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1670 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1671 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1673 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1676 throw INTERP_KERNEL::Exception(msg);
1680 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1685 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1686 ret->applyLin(1.,-val);
1687 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1691 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1695 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1696 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1700 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1701 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1704 throw INTERP_KERNEL::Exception(msg);
1708 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1710 const char msg[]="Unexpected situation in __rsub__ !";
1713 DataArrayDoubleTuple *aa;
1714 std::vector<double> bb;
1716 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1721 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1722 ret->applyLin(-1.,val);
1727 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1728 return DataArrayDouble::Substract(aaa,self);
1732 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1733 return DataArrayDouble::Substract(aaa,self);
1736 throw INTERP_KERNEL::Exception(msg);
1740 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1742 const char msg[]="Unexpected situation in __isub__ !";
1745 DataArrayDoubleTuple *aa;
1746 std::vector<double> bb;
1748 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1753 self->applyLin(1,-val);
1754 Py_XINCREF(trueSelf);
1759 self->substractEqual(a);
1760 Py_XINCREF(trueSelf);
1765 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1766 self->substractEqual(aaa);
1767 Py_XINCREF(trueSelf);
1772 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1773 self->substractEqual(aaa);
1774 Py_XINCREF(trueSelf);
1778 throw INTERP_KERNEL::Exception(msg);
1782 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1784 const char msg[]="Unexpected situation in __mul__ !";
1787 DataArrayDoubleTuple *aa;
1788 std::vector<double> bb;
1791 #ifndef WITHOUT_AUTOFIELD
1793 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1795 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1798 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1799 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1801 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1804 throw INTERP_KERNEL::Exception(msg);
1808 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1813 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1814 ret->applyLin(val,0.);
1815 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1819 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1824 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1828 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1829 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1832 throw INTERP_KERNEL::Exception(msg);
1836 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1838 const char msg[]="Unexpected situation in __rmul__ !";
1841 DataArrayDoubleTuple *aa;
1842 std::vector<double> bb;
1844 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1849 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1850 ret->applyLin(val,0.);
1855 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1856 return DataArrayDouble::Multiply(self,aaa);
1860 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1861 return DataArrayDouble::Multiply(self,aaa);
1864 throw INTERP_KERNEL::Exception(msg);
1868 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1870 const char msg[]="Unexpected situation in __imul__ !";
1873 DataArrayDoubleTuple *aa;
1874 std::vector<double> bb;
1876 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1881 self->applyLin(val,0.);
1882 Py_XINCREF(trueSelf);
1887 self->multiplyEqual(a);
1888 Py_XINCREF(trueSelf);
1893 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1894 self->multiplyEqual(aaa);
1895 Py_XINCREF(trueSelf);
1900 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1901 self->multiplyEqual(aaa);
1902 Py_XINCREF(trueSelf);
1906 throw INTERP_KERNEL::Exception(msg);
1910 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1912 const char msg[]="Unexpected situation in __div__ !";
1915 DataArrayDoubleTuple *aa;
1916 std::vector<double> bb;
1919 #ifndef WITHOUT_AUTOFIELD
1921 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1923 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1926 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1927 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1929 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1932 throw INTERP_KERNEL::Exception(msg);
1936 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1942 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1943 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1944 ret->applyLin(1/val,0.);
1945 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1949 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1953 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1954 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1958 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1959 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1962 throw INTERP_KERNEL::Exception(msg);
1966 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1968 const char msg[]="Unexpected situation in __rdiv__ !";
1971 DataArrayDoubleTuple *aa;
1972 std::vector<double> bb;
1974 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1979 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1985 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1986 return DataArrayDouble::Divide(aaa,self);
1990 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1991 return DataArrayDouble::Divide(aaa,self);
1994 throw INTERP_KERNEL::Exception(msg);
1998 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2000 const char msg[]="Unexpected situation in __idiv__ !";
2003 DataArrayDoubleTuple *aa;
2004 std::vector<double> bb;
2006 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2012 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2013 self->applyLin(1./val,0.);
2014 Py_XINCREF(trueSelf);
2019 self->divideEqual(a);
2020 Py_XINCREF(trueSelf);
2025 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2026 self->divideEqual(aaa);
2027 Py_XINCREF(trueSelf);
2032 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2033 self->divideEqual(aaa);
2034 Py_XINCREF(trueSelf);
2038 throw INTERP_KERNEL::Exception(msg);
2042 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2044 const char msg[]="Unexpected situation in __pow__ !";
2047 DataArrayDoubleTuple *aa;
2048 std::vector<double> bb;
2050 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2055 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2061 return DataArrayDouble::Pow(self,a);
2065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2066 return DataArrayDouble::Pow(self,aaa);
2070 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2071 return DataArrayDouble::Pow(self,aaa);
2074 throw INTERP_KERNEL::Exception(msg);
2078 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2080 const char msg[]="Unexpected situation in __rpow__ !";
2083 DataArrayDoubleTuple *aa;
2084 std::vector<double> bb;
2086 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2091 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2092 ret->applyRPow(val);
2097 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2098 return DataArrayDouble::Pow(aaa,self);
2102 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2103 return DataArrayDouble::Pow(aaa,self);
2106 throw INTERP_KERNEL::Exception(msg);
2110 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2112 const char msg[]="Unexpected situation in __ipow__ !";
2115 DataArrayDoubleTuple *aa;
2116 std::vector<double> bb;
2118 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2123 self->applyPow(val);
2124 Py_XINCREF(trueSelf);
2130 Py_XINCREF(trueSelf);
2135 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2136 self->powEqual(aaa);
2137 Py_XINCREF(trueSelf);
2142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2143 self->powEqual(aaa);
2144 Py_XINCREF(trueSelf);
2148 throw INTERP_KERNEL::Exception(msg);
2152 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2154 DataArrayInt *c=0,*cI=0;
2156 self->computeTupleIdsNearTuples(other,eps,c,cI);
2157 PyObject *ret=PyTuple_New(2);
2158 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2159 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2163 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2165 DataArrayInt *ret1=0;
2166 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2167 PyObject *ret=PyTuple_New(2);
2168 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2169 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2175 class DataArrayDoubleTuple;
2177 class DataArrayDoubleIterator
2180 DataArrayDoubleIterator(DataArrayDouble *da);
2181 ~DataArrayDoubleIterator();
2186 DataArrayDoubleTuple *ret=self->nextt();
2188 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2191 PyErr_SetString(PyExc_StopIteration,"No more data.");
2198 class DataArrayDoubleTuple
2201 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2202 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2205 std::string __str__() const throw(INTERP_KERNEL::Exception)
2207 return self->repr();
2210 double __float__() const throw(INTERP_KERNEL::Exception)
2212 return self->doubleValue();
2215 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2217 return self->buildDADouble(1,self->getNumberOfCompo());
2220 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2222 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2223 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2224 Py_XINCREF(trueSelf);
2228 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2230 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2231 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2232 Py_XINCREF(trueSelf);
2236 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2238 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2239 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2240 Py_XINCREF(trueSelf);
2244 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2246 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2247 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2248 Py_XINCREF(trueSelf);
2252 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2254 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2257 std::vector<int> multiVal;
2258 std::pair<int, std::pair<int,int> > slic;
2259 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2260 const double *pt=self->getConstPointer();
2261 int nbc=self->getNumberOfCompo();
2262 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2269 std::ostringstream oss;
2270 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2271 throw INTERP_KERNEL::Exception(oss.str().c_str());
2274 return PyFloat_FromDouble(pt[singleVal]);
2278 return PyFloat_FromDouble(pt[nbc+singleVal]);
2281 std::ostringstream oss;
2282 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2283 throw INTERP_KERNEL::Exception(oss.str().c_str());
2289 PyObject *t=PyTuple_New(multiVal.size());
2290 for(int j=0;j<(int)multiVal.size();j++)
2292 int cid=multiVal[j];
2295 std::ostringstream oss;
2296 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2297 throw INTERP_KERNEL::Exception(oss.str().c_str());
2299 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2305 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2306 PyObject *t=PyTuple_New(sz);
2307 for(int j=0;j<sz;j++)
2308 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2312 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2316 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2318 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2319 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2322 std::vector<double> multiValV;
2323 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2324 int nbc=self->getNumberOfCompo();
2325 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2327 std::vector<int> multiVal;
2328 std::pair<int, std::pair<int,int> > slic;
2329 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2330 double *pt=self->getPointer();
2331 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2338 std::ostringstream oss;
2339 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2340 throw INTERP_KERNEL::Exception(oss.str().c_str());
2346 pt[singleVal]=singleValV;
2351 if(multiValV.size()!=1)
2353 std::ostringstream oss;
2354 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2355 throw INTERP_KERNEL::Exception(oss.str().c_str());
2357 pt[singleVal]=multiValV[0];
2362 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2366 throw INTERP_KERNEL::Exception(msg);
2375 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2379 std::ostringstream oss;
2380 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2381 throw INTERP_KERNEL::Exception(oss.str().c_str());
2389 if(multiVal.size()!=multiValV.size())
2391 std::ostringstream oss;
2392 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2393 throw INTERP_KERNEL::Exception(oss.str().c_str());
2395 for(int i=0;i<(int)multiVal.size();i++)
2397 int pos=multiVal[i];
2400 std::ostringstream oss;
2401 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2402 throw INTERP_KERNEL::Exception(oss.str().c_str());
2404 pt[multiVal[i]]=multiValV[i];
2410 const double *ptV=daIntTyyppV->getConstPointer();
2411 if(nbc>daIntTyyppV->getNumberOfCompo())
2413 std::ostringstream oss;
2414 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2415 throw INTERP_KERNEL::Exception(oss.str().c_str());
2417 std::copy(ptV,ptV+nbc,pt);
2421 throw INTERP_KERNEL::Exception(msg);
2426 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2431 for(int j=0;j<sz;j++)
2432 pt[slic.first+j*slic.second.second]=singleValV;
2437 if(sz!=(int)multiValV.size())
2439 std::ostringstream oss;
2440 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2441 throw INTERP_KERNEL::Exception(oss.str().c_str());
2443 for(int j=0;j<sz;j++)
2444 pt[slic.first+j*slic.second.second]=multiValV[j];
2449 const double *ptV=daIntTyyppV->getConstPointer();
2450 if(sz>daIntTyyppV->getNumberOfCompo())
2452 std::ostringstream oss;
2453 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2454 throw INTERP_KERNEL::Exception(oss.str().c_str());
2456 for(int j=0;j<sz;j++)
2457 pt[slic.first+j*slic.second.second]=ptV[j];
2461 throw INTERP_KERNEL::Exception(msg);
2465 throw INTERP_KERNEL::Exception(msg);
2471 class DataArrayIntIterator;
2473 class DataArrayInt : public DataArray
2476 static DataArrayInt *New();
2477 int intValue() const throw(INTERP_KERNEL::Exception);
2478 int getHashCode() const throw(INTERP_KERNEL::Exception);
2479 bool empty() const throw(INTERP_KERNEL::Exception);
2480 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2481 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2482 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2483 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2484 int popBackSilent() throw(INTERP_KERNEL::Exception);
2485 void pack() const throw(INTERP_KERNEL::Exception);
2486 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2487 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2488 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2489 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2490 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2491 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2492 void reverse() throw(INTERP_KERNEL::Exception);
2493 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2494 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2495 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2496 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2497 void fillWithZero() throw(INTERP_KERNEL::Exception);
2498 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2499 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2500 std::string repr() const throw(INTERP_KERNEL::Exception);
2501 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2502 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2503 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2504 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2505 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2506 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2507 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2508 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2509 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2510 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2511 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2512 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2513 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2514 void transpose() throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2516 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2517 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2518 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2519 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2520 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2521 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2522 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2523 int front() const throw(INTERP_KERNEL::Exception);
2524 int back() const throw(INTERP_KERNEL::Exception);
2525 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2526 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2527 int *getPointer() throw(INTERP_KERNEL::Exception);
2528 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2529 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2530 const int *begin() const throw(INTERP_KERNEL::Exception);
2531 const int *end() const throw(INTERP_KERNEL::Exception);
2532 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2533 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2534 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2535 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2536 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2537 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2538 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2539 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2540 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2541 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2542 int count(int value) const throw(INTERP_KERNEL::Exception);
2543 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2544 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2545 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2546 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2547 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2548 void abs() throw(INTERP_KERNEL::Exception);
2549 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2550 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2551 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2552 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2553 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2554 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2555 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2556 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2557 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2558 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2559 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2560 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2561 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2562 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2563 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2564 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2565 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2566 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2567 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2568 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2569 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2570 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2572 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2573 void computeOffsets() throw(INTERP_KERNEL::Exception);
2574 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2575 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2576 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2577 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2578 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2580 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2581 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2582 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2583 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2584 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2585 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2586 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2587 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2588 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2589 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2590 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2591 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2593 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2596 DataArrayInt() throw(INTERP_KERNEL::Exception)
2598 return DataArrayInt::New();
2601 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2603 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)";
2604 std::string msg(msgBase);
2606 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2609 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2613 if(PyInt_Check(nbOfTuples))
2615 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2617 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2620 if(PyInt_Check(nbOfComp))
2621 {//DataArrayInt.New([1,3,4,5],2,2)
2622 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2624 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2625 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2626 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2627 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2631 throw INTERP_KERNEL::Exception(msg.c_str());
2634 {//DataArrayInt.New([1,3,4],3)
2635 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2637 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2638 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2643 throw INTERP_KERNEL::Exception(msg.c_str());
2646 {// DataArrayInt.New([1,3,4])
2647 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2648 int tmpp1=-1,tmpp2=-1;
2649 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2650 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2654 else if(PyInt_Check(elt0))
2656 int nbOfTuples1=PyInt_AS_LONG(elt0);
2658 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2663 if(PyInt_Check(nbOfTuples))
2664 {//DataArrayInt.New(5,2)
2665 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2667 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2668 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2669 ret->alloc(nbOfTuples1,nbOfCompo);
2673 throw INTERP_KERNEL::Exception(msg.c_str());
2676 throw INTERP_KERNEL::Exception(msg.c_str());
2679 {//DataArrayInt.New(5)
2680 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2681 ret->alloc(nbOfTuples1,1);
2686 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2687 {//DataArrayInt.New(numpyArray)
2688 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2692 throw INTERP_KERNEL::Exception(msg.c_str());
2695 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2697 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2700 std::string __str__() const throw(INTERP_KERNEL::Exception)
2702 return self->repr();
2705 int __len__() const throw(INTERP_KERNEL::Exception)
2707 if(self->isAllocated())
2709 return self->getNumberOfTuples();
2713 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2717 int __int__() const throw(INTERP_KERNEL::Exception)
2719 return self->intValue();
2722 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2724 return self->iterator();
2727 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2729 int sz=self->getNumberOfComponents();
2730 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2731 self->accumulate(tmp);
2732 return convertIntArrToPyList(tmp,sz);
2735 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2738 std::vector<int> val2;
2739 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2740 return self->accumulatePerChunck(bg,bg+sz);
2743 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2745 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2746 PyObject *ret=PyList_New(slcs.size());
2747 for(std::size_t i=0;i<slcs.size();i++)
2748 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2752 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2754 if(!PySlice_Check(slic))
2755 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2756 Py_ssize_t strt=2,stp=2,step=2;
2757 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2758 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2759 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2760 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2761 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 !");
2762 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2765 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2767 int newNbOfTuples=-1;
2768 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2769 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2770 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2771 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2772 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2773 PyObject *ret=PyTuple_New(2);
2774 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2775 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2779 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2781 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 !";
2782 if(PyList_Check(li) || PyTuple_Check(li))
2786 if(PyInt_Check(nbOfTuples))
2788 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2790 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2793 if(PyInt_Check(nbOfComp))
2794 {//DataArrayInt.setValues([1,3,4,5],2,2)
2795 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2797 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2798 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2799 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2802 throw INTERP_KERNEL::Exception(msg);
2805 {//DataArrayInt.setValues([1,3,4],3)
2807 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2808 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2812 throw INTERP_KERNEL::Exception(msg);
2815 {// DataArrayInt.setValues([1,3,4])
2816 int tmpp1=-1,tmpp2=-1;
2817 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2818 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2822 throw INTERP_KERNEL::Exception(msg);
2825 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2827 const int *vals=self->getConstPointer();
2828 return convertIntArrToPyList(vals,self->getNbOfElems());
2832 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2834 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2838 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2841 bool ret0=self->isEqualIfNotWhy(other,ret1);
2842 PyObject *ret=PyTuple_New(2);
2843 PyObject *ret0Py=ret0?Py_True:Py_False;
2845 PyTuple_SetItem(ret,0,ret0Py);
2846 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2850 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2852 const int *vals=self->getConstPointer();
2853 int nbOfComp=self->getNumberOfComponents();
2854 int nbOfTuples=self->getNumberOfTuples();
2855 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2858 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2860 std::vector<const DataArrayInt *> groups;
2861 std::vector< std::vector<int> > fidsOfGroups;
2862 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2863 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2864 PyObject *ret = PyList_New(2);
2865 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2866 int sz=fidsOfGroups.size();
2867 PyObject *ret1 = PyList_New(sz);
2868 for(int i=0;i<sz;i++)
2869 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2870 PyList_SetItem(ret,1,ret1);
2874 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2877 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2878 if (!SWIG_IsOK(res1))
2881 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2882 self->transformWithIndArr(tmp,tmp+size);
2886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2887 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2891 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2895 std::vector<int> multiVal;
2896 std::pair<int, std::pair<int,int> > slic;
2897 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2898 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2902 return self->getIdsEqualList(&singleVal,&singleVal+1);
2904 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2906 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2908 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2912 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2916 std::vector<int> multiVal;
2917 std::pair<int, std::pair<int,int> > slic;
2918 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2919 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2923 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2925 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2927 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2929 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2933 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2935 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2937 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2938 if (!SWIG_IsOK(res1))
2941 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2942 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2946 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2948 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2949 da2->checkAllocated();
2950 int size=self->getNumberOfTuples();
2951 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2953 PyObject *ret = PyList_New(3);
2954 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2955 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2956 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2960 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2963 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2964 if (!SWIG_IsOK(res1))
2967 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2968 return self->transformWithIndArrR(tmp,tmp+size);
2972 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2973 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2977 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2980 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2981 if (!SWIG_IsOK(res1))
2984 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2985 if(size!=self->getNumberOfTuples())
2987 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2989 return self->renumberAndReduce(tmp,newNbOfTuple);
2993 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2995 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2996 da2->checkAllocated();
2997 int size=self->getNumberOfTuples();
2998 if(size!=self->getNumberOfTuples())
3000 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3002 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3006 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3009 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3010 if (!SWIG_IsOK(res1))
3013 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3014 if(size!=self->getNumberOfTuples())
3016 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3018 return self->renumber(tmp);
3022 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3024 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3025 da2->checkAllocated();
3026 int size=self->getNumberOfTuples();
3027 if(size!=self->getNumberOfTuples())
3029 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3031 return self->renumber(da2->getConstPointer());
3035 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3038 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3039 if (!SWIG_IsOK(res1))
3042 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3043 if(size!=self->getNumberOfTuples())
3045 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3047 return self->renumberR(tmp);
3051 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3053 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3054 da2->checkAllocated();
3055 int size=self->getNumberOfTuples();
3056 if(size!=self->getNumberOfTuples())
3058 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3060 return self->renumberR(da2->getConstPointer());
3064 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3066 std::vector<int> tmp;
3067 convertPyToNewIntArr3(li,tmp);
3068 self->setSelectedComponents(a,tmp);
3071 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3073 int sz=self->getNumberOfComponents();
3074 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3075 self->getTuple(tupleId,tmp);
3076 return convertIntArrToPyList(tmp,sz);
3079 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3081 DataArrayInt *arr=0;
3082 DataArrayInt *arrI=0;
3083 self->changeSurjectiveFormat(targetNb,arr,arrI);
3084 PyObject *res = PyList_New(2);
3085 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3086 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3090 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3092 std::vector<const DataArrayInt *> tmp;
3093 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3094 return DataArrayInt::Meld(tmp);
3097 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3099 std::vector<const DataArrayInt *> tmp;
3100 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3101 return DataArrayInt::Aggregate(tmp);
3104 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3106 std::vector<const DataArrayInt *> tmp;
3107 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3108 return DataArrayInt::AggregateIndexes(tmp);
3111 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3113 std::vector<const DataArrayInt *> tmp;
3114 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3115 return DataArrayInt::BuildUnion(tmp);
3118 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3120 std::vector<const DataArrayInt *> tmp;
3121 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3122 return DataArrayInt::BuildIntersection(tmp);
3125 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3128 int r1=self->getMaxValue(tmp);
3129 PyObject *ret=PyTuple_New(2);
3130 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3131 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3135 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3138 int r1=self->getMinValue(tmp);
3139 PyObject *ret=PyTuple_New(2);
3140 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3141 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3145 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3147 int nbOfCompo=self->getNumberOfComponents();
3152 if(PyInt_Check(obj))
3154 int val=(int)PyInt_AS_LONG(obj);
3155 return self->locateValue(val);
3158 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3162 std::vector<int> arr;
3163 convertPyToNewIntArr3(obj,arr);
3164 return self->locateTuple(arr);
3169 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3171 int nbOfCompo=self->getNumberOfComponents();
3178 if(PyInt_Check(obj))
3180 int val=(int)PyInt_AS_LONG(obj);
3181 return self->presenceOfValue(val);
3184 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3188 std::vector<int> arr;
3189 convertPyToNewIntArr3(obj,arr);
3190 return self->presenceOfTuple(arr);
3195 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3197 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3198 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3199 self->checkAllocated();
3200 int nbOfTuples=self->getNumberOfTuples();
3201 int nbOfComponents=self->getNumberOfComponents();
3203 std::vector<int> vt1,vc1;
3204 std::pair<int, std::pair<int,int> > pt1,pc1;
3205 DataArrayInt *dt1=0,*dc1=0;
3207 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3208 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3213 if(nbOfComponents==1)
3214 return PyInt_FromLong(self->getIJSafe(it1,0));
3215 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3218 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3220 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3222 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3224 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3227 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3228 std::vector<int> v2(1,ic1);
3229 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3233 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3234 std::vector<int> v2(1,ic1);
3235 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3239 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3240 std::vector<int> v2(1,ic1);
3241 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3245 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3246 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3250 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3251 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3255 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3256 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3260 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3261 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3265 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3266 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3267 std::vector<int> v2(nbOfComp);
3268 for(int i=0;i<nbOfComp;i++)
3269 v2[i]=pc1.first+i*pc1.second.second;
3270 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3274 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3275 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3276 std::vector<int> v2(nbOfComp);
3277 for(int i=0;i<nbOfComp;i++)
3278 v2[i]=pc1.first+i*pc1.second.second;
3279 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3283 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3284 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3285 std::vector<int> v2(nbOfComp);
3286 for(int i=0;i<nbOfComp;i++)
3287 v2[i]=pc1.first+i*pc1.second.second;
3288 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3292 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3293 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3294 std::vector<int> v2(nbOfComp);
3295 for(int i=0;i<nbOfComp;i++)
3296 v2[i]=pc1.first+i*pc1.second.second;
3297 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3300 throw INTERP_KERNEL::Exception(msg);
3304 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3306 self->checkAllocated();
3307 const char msg[]="Unexpected situation in __setitem__ !";
3308 int nbOfTuples=self->getNumberOfTuples();
3309 int nbOfComponents=self->getNumberOfComponents();
3312 std::vector<int> v1;
3314 DataArrayIntTuple *dd1=0;
3315 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3317 std::vector<int> vt1,vc1;
3318 std::pair<int, std::pair<int,int> > pt1,pc1;
3319 DataArrayInt *dt1=0,*dc1=0;
3320 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3321 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3329 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3332 tmp=DataArrayInt::New();
3333 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3334 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3337 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3340 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3341 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3344 throw INTERP_KERNEL::Exception(msg);
3353 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3356 tmp=DataArrayInt::New();
3357 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3358 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3361 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3364 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3365 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3368 throw INTERP_KERNEL::Exception(msg);
3377 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3380 tmp=DataArrayInt::New();
3381 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3382 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3385 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3388 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3389 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3392 throw INTERP_KERNEL::Exception(msg);
3401 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3404 tmp=DataArrayInt::New();
3405 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3406 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3409 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3412 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3413 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3416 throw INTERP_KERNEL::Exception(msg);
3425 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3428 tmp=DataArrayInt::New();
3429 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3430 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3433 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3436 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3437 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3440 throw INTERP_KERNEL::Exception(msg);
3449 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3452 tmp=DataArrayInt::New();
3453 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3454 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3457 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3460 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3461 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3464 throw INTERP_KERNEL::Exception(msg);
3473 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3476 tmp=DataArrayInt::New();
3477 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3478 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3481 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3484 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3485 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3488 throw INTERP_KERNEL::Exception(msg);
3497 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3500 tmp=DataArrayInt::New();
3501 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3502 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3505 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3508 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3509 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3512 throw INTERP_KERNEL::Exception(msg);
3521 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3524 tmp=DataArrayInt::New();
3525 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3526 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3529 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3532 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3533 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3536 throw INTERP_KERNEL::Exception(msg);
3545 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3548 tmp=DataArrayInt::New();
3549 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3550 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3553 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3556 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3557 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3560 throw INTERP_KERNEL::Exception(msg);
3569 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3572 tmp=DataArrayInt::New();
3573 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3574 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3577 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3580 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3581 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3584 throw INTERP_KERNEL::Exception(msg);
3593 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3596 tmp=DataArrayInt::New();
3597 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3598 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3601 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3604 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3605 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3608 throw INTERP_KERNEL::Exception(msg);
3617 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3620 tmp=DataArrayInt::New();
3621 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3622 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3625 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3628 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3629 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3632 throw INTERP_KERNEL::Exception(msg);
3641 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3644 tmp=DataArrayInt::New();
3645 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3646 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3649 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3652 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3653 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3656 throw INTERP_KERNEL::Exception(msg);
3665 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3668 tmp=DataArrayInt::New();
3669 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3670 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3673 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3676 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3677 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3680 throw INTERP_KERNEL::Exception(msg);
3689 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3692 tmp=DataArrayInt::New();
3693 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3694 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3697 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3700 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3701 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3704 throw INTERP_KERNEL::Exception(msg);
3709 throw INTERP_KERNEL::Exception(msg);
3714 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3716 return self->negate();
3719 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3721 const char msg[]="Unexpected situation in __add__ !";
3724 std::vector<int> aa;
3725 DataArrayIntTuple *aaa;
3727 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3732 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3733 ret->applyLin(1,val);
3738 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3739 return DataArrayInt::Add(self,aaaa);
3743 return DataArrayInt::Add(self,a);
3747 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3748 return DataArrayInt::Add(self,aaaa);
3751 throw INTERP_KERNEL::Exception(msg);
3755 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3757 const char msg[]="Unexpected situation in __radd__ !";
3760 std::vector<int> aa;
3761 DataArrayIntTuple *aaa;
3763 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3768 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3769 ret->applyLin(1,val);
3774 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3775 return DataArrayInt::Add(self,aaaa);
3779 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3780 return DataArrayInt::Add(self,aaaa);
3783 throw INTERP_KERNEL::Exception(msg);
3787 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3789 const char msg[]="Unexpected situation in __iadd__ !";
3792 std::vector<int> aa;
3793 DataArrayIntTuple *aaa;
3795 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3800 self->applyLin(1,val);
3801 Py_XINCREF(trueSelf);
3806 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3808 Py_XINCREF(trueSelf);
3814 Py_XINCREF(trueSelf);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3820 self->addEqual(aaaa);
3821 Py_XINCREF(trueSelf);
3825 throw INTERP_KERNEL::Exception(msg);
3829 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3831 const char msg[]="Unexpected situation in __sub__ !";
3834 std::vector<int> aa;
3835 DataArrayIntTuple *aaa;
3837 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3842 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3843 ret->applyLin(1,-val);
3848 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3849 return DataArrayInt::Substract(self,aaaa);
3853 return DataArrayInt::Substract(self,a);
3857 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3858 return DataArrayInt::Substract(self,aaaa);
3861 throw INTERP_KERNEL::Exception(msg);
3865 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3867 const char msg[]="Unexpected situation in __rsub__ !";
3870 std::vector<int> aa;
3871 DataArrayIntTuple *aaa;
3873 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3878 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3879 ret->applyLin(-1,val);
3884 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3885 return DataArrayInt::Substract(aaaa,self);
3889 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3890 return DataArrayInt::Substract(aaaa,self);
3893 throw INTERP_KERNEL::Exception(msg);
3897 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3899 const char msg[]="Unexpected situation in __isub__ !";
3902 std::vector<int> aa;
3903 DataArrayIntTuple *aaa;
3905 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3910 self->applyLin(1,-val);
3911 Py_XINCREF(trueSelf);
3916 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3917 self->substractEqual(bb);
3918 Py_XINCREF(trueSelf);
3923 self->substractEqual(a);
3924 Py_XINCREF(trueSelf);
3929 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3930 self->substractEqual(aaaa);
3931 Py_XINCREF(trueSelf);
3935 throw INTERP_KERNEL::Exception(msg);
3939 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3941 const char msg[]="Unexpected situation in __mul__ !";
3944 std::vector<int> aa;
3945 DataArrayIntTuple *aaa;
3947 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3952 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3953 ret->applyLin(val,0);
3958 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3959 return DataArrayInt::Multiply(self,aaaa);
3963 return DataArrayInt::Multiply(self,a);
3967 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3968 return DataArrayInt::Multiply(self,aaaa);
3971 throw INTERP_KERNEL::Exception(msg);
3975 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3977 const char msg[]="Unexpected situation in __rmul__ !";
3980 std::vector<int> aa;
3981 DataArrayIntTuple *aaa;
3983 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3988 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3989 ret->applyLin(val,0);
3994 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3995 return DataArrayInt::Multiply(self,aaaa);
3999 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4000 return DataArrayInt::Multiply(self,aaaa);
4003 throw INTERP_KERNEL::Exception(msg);
4007 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4009 const char msg[]="Unexpected situation in __imul__ !";
4012 std::vector<int> aa;
4013 DataArrayIntTuple *aaa;
4015 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4020 self->applyLin(val,0);
4021 Py_XINCREF(trueSelf);
4026 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4027 self->multiplyEqual(bb);
4028 Py_XINCREF(trueSelf);
4033 self->multiplyEqual(a);
4034 Py_XINCREF(trueSelf);
4039 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4040 self->multiplyEqual(aaaa);
4041 Py_XINCREF(trueSelf);
4045 throw INTERP_KERNEL::Exception(msg);
4049 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4051 const char msg[]="Unexpected situation in __div__ !";
4054 std::vector<int> aa;
4055 DataArrayIntTuple *aaa;
4057 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4062 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4063 ret->applyDivideBy(val);
4068 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4069 return DataArrayInt::Divide(self,aaaa);
4073 return DataArrayInt::Divide(self,a);
4077 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4078 return DataArrayInt::Divide(self,aaaa);
4081 throw INTERP_KERNEL::Exception(msg);
4085 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4087 const char msg[]="Unexpected situation in __rdiv__ !";
4090 std::vector<int> aa;
4091 DataArrayIntTuple *aaa;
4093 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4098 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4104 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4105 return DataArrayInt::Divide(aaaa,self);
4109 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4110 return DataArrayInt::Divide(aaaa,self);
4113 throw INTERP_KERNEL::Exception(msg);
4117 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4119 const char msg[]="Unexpected situation in __idiv__ !";
4122 std::vector<int> aa;
4123 DataArrayIntTuple *aaa;
4125 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4130 self->applyDivideBy(val);
4131 Py_XINCREF(trueSelf);
4136 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4137 self->divideEqual(bb);
4138 Py_XINCREF(trueSelf);
4143 self->divideEqual(a);
4144 Py_XINCREF(trueSelf);
4149 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4150 self->divideEqual(aaaa);
4151 Py_XINCREF(trueSelf);
4155 throw INTERP_KERNEL::Exception(msg);
4159 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4161 const char msg[]="Unexpected situation in __mod__ !";
4164 std::vector<int> aa;
4165 DataArrayIntTuple *aaa;
4167 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4172 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4173 ret->applyModulus(val);
4178 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4179 return DataArrayInt::Modulus(self,aaaa);
4183 return DataArrayInt::Modulus(self,a);
4187 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4188 return DataArrayInt::Modulus(self,aaaa);
4191 throw INTERP_KERNEL::Exception(msg);
4195 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4197 const char msg[]="Unexpected situation in __rmod__ !";
4200 std::vector<int> aa;
4201 DataArrayIntTuple *aaa;
4203 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4208 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4209 ret->applyRModulus(val);
4214 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4215 return DataArrayInt::Modulus(aaaa,self);
4219 return DataArrayInt::Modulus(a,self);
4223 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4224 return DataArrayInt::Modulus(aaaa,self);
4227 throw INTERP_KERNEL::Exception(msg);
4231 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4233 const char msg[]="Unexpected situation in __imod__ !";
4236 std::vector<int> aa;
4237 DataArrayIntTuple *aaa;
4239 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4244 self->applyModulus(val);
4245 Py_XINCREF(trueSelf);
4250 self->modulusEqual(a);
4251 Py_XINCREF(trueSelf);
4256 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4257 self->modulusEqual(aaaa);
4258 Py_XINCREF(trueSelf);
4262 throw INTERP_KERNEL::Exception(msg);
4266 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4268 const char msg[]="Unexpected situation in __pow__ !";
4271 std::vector<int> aa;
4272 DataArrayIntTuple *aaa;
4274 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4279 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4285 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4286 return DataArrayInt::Pow(self,aaaa);
4290 return DataArrayInt::Pow(self,a);
4294 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4295 return DataArrayInt::Pow(self,aaaa);
4298 throw INTERP_KERNEL::Exception(msg);
4302 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4304 const char msg[]="Unexpected situation in __rpow__ !";
4307 std::vector<int> aa;
4308 DataArrayIntTuple *aaa;
4310 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4315 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4316 ret->applyRPow(val);
4321 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4322 return DataArrayInt::Pow(aaaa,self);
4326 return DataArrayInt::Pow(a,self);
4330 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4331 return DataArrayInt::Pow(aaaa,self);
4334 throw INTERP_KERNEL::Exception(msg);
4338 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4340 const char msg[]="Unexpected situation in __ipow__ !";
4343 std::vector<int> aa;
4344 DataArrayIntTuple *aaa;
4346 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4351 self->applyPow(val);
4352 Py_XINCREF(trueSelf);
4358 Py_XINCREF(trueSelf);
4363 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4364 self->powEqual(aaaa);
4365 Py_XINCREF(trueSelf);
4369 throw INTERP_KERNEL::Exception(msg);
4373 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4375 std::ostringstream oss;
4376 self->reprQuickOverview(oss);
4380 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4382 int szArr,sw,iTypppArr;
4383 std::vector<int> stdvecTyyppArr;
4384 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4385 self->pushBackValsSilent(tmp,tmp+szArr);
4388 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4390 std::vector<int> ret1;
4391 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4392 std::size_t sz=ret0.size();
4393 PyObject *pyRet=PyTuple_New(2);
4394 PyObject *pyRet0=PyList_New((int)sz);
4395 PyObject *pyRet1=PyList_New((int)sz);
4396 for(std::size_t i=0;i<sz;i++)
4398 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4399 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4401 PyTuple_SetItem(pyRet,0,pyRet0);
4402 PyTuple_SetItem(pyRet,1,pyRet1);
4406 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4408 DataArrayInt *ret0=0,*ret1=0;
4409 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4410 PyObject *pyRet=PyTuple_New(2);
4411 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4412 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4418 class DataArrayIntTuple;
4420 class DataArrayIntIterator
4423 DataArrayIntIterator(DataArrayInt *da);
4424 ~DataArrayIntIterator();
4429 DataArrayIntTuple *ret=self->nextt();
4431 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4434 PyErr_SetString(PyExc_StopIteration,"No more data.");
4441 class DataArrayIntTuple
4444 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4445 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4448 std::string __str__() const throw(INTERP_KERNEL::Exception)
4450 return self->repr();
4453 int __int__() const throw(INTERP_KERNEL::Exception)
4455 return self->intValue();
4458 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4460 return self->buildDAInt(1,self->getNumberOfCompo());
4463 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4465 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4466 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4467 Py_XINCREF(trueSelf);
4471 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4473 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4474 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4475 Py_XINCREF(trueSelf);
4479 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4481 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4482 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4483 Py_XINCREF(trueSelf);
4487 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4489 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4490 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4491 Py_XINCREF(trueSelf);
4495 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4497 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4498 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4499 Py_XINCREF(trueSelf);
4503 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4505 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4508 std::vector<int> multiVal;
4509 std::pair<int, std::pair<int,int> > slic;
4510 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4511 const int *pt=self->getConstPointer();
4512 int nbc=self->getNumberOfCompo();
4513 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4520 std::ostringstream oss;
4521 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4522 throw INTERP_KERNEL::Exception(oss.str().c_str());
4525 return PyInt_FromLong(pt[singleVal]);
4529 return PyInt_FromLong(pt[nbc+singleVal]);
4532 std::ostringstream oss;
4533 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4534 throw INTERP_KERNEL::Exception(oss.str().c_str());
4540 PyObject *t=PyTuple_New(multiVal.size());
4541 for(int j=0;j<(int)multiVal.size();j++)
4543 int cid=multiVal[j];
4546 std::ostringstream oss;
4547 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4548 throw INTERP_KERNEL::Exception(oss.str().c_str());
4550 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4556 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4557 PyObject *t=PyTuple_New(sz);
4558 for(int j=0;j<sz;j++)
4559 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4563 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4567 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4569 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4570 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4573 std::vector<int> multiValV;
4574 std::pair<int, std::pair<int,int> > slicV;
4575 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4576 int nbc=self->getNumberOfCompo();
4577 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4579 std::vector<int> multiVal;
4580 std::pair<int, std::pair<int,int> > slic;
4581 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4582 int *pt=self->getPointer();
4583 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4590 std::ostringstream oss;
4591 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4592 throw INTERP_KERNEL::Exception(oss.str().c_str());
4598 pt[singleVal]=singleValV;
4603 if(multiValV.size()!=1)
4605 std::ostringstream oss;
4606 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4607 throw INTERP_KERNEL::Exception(oss.str().c_str());
4609 pt[singleVal]=multiValV[0];
4614 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4618 throw INTERP_KERNEL::Exception(msg);
4627 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4631 std::ostringstream oss;
4632 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4633 throw INTERP_KERNEL::Exception(oss.str().c_str());
4641 if(multiVal.size()!=multiValV.size())
4643 std::ostringstream oss;
4644 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4645 throw INTERP_KERNEL::Exception(oss.str().c_str());
4647 for(int i=0;i<(int)multiVal.size();i++)
4649 int pos=multiVal[i];
4652 std::ostringstream oss;
4653 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4654 throw INTERP_KERNEL::Exception(oss.str().c_str());
4656 pt[multiVal[i]]=multiValV[i];
4662 const int *ptV=daIntTyyppV->getConstPointer();
4663 if(nbc>daIntTyyppV->getNumberOfCompo())
4665 std::ostringstream oss;
4666 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4667 throw INTERP_KERNEL::Exception(oss.str().c_str());
4669 std::copy(ptV,ptV+nbc,pt);
4673 throw INTERP_KERNEL::Exception(msg);
4678 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4683 for(int j=0;j<sz;j++)
4684 pt[slic.first+j*slic.second.second]=singleValV;
4689 if(sz!=(int)multiValV.size())
4691 std::ostringstream oss;
4692 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4693 throw INTERP_KERNEL::Exception(oss.str().c_str());
4695 for(int j=0;j<sz;j++)
4696 pt[slic.first+j*slic.second.second]=multiValV[j];
4701 const int *ptV=daIntTyyppV->getConstPointer();
4702 if(sz>daIntTyyppV->getNumberOfCompo())
4704 std::ostringstream oss;
4705 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4706 throw INTERP_KERNEL::Exception(oss.str().c_str());
4708 for(int j=0;j<sz;j++)
4709 pt[slic.first+j*slic.second.second]=ptV[j];
4713 throw INTERP_KERNEL::Exception(msg);
4717 throw INTERP_KERNEL::Exception(msg);
4723 class DataArrayChar : public DataArray
4726 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4727 int getHashCode() const throw(INTERP_KERNEL::Exception);
4728 bool empty() const throw(INTERP_KERNEL::Exception);
4729 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4730 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4731 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4732 char popBackSilent() throw(INTERP_KERNEL::Exception);
4733 void pack() const throw(INTERP_KERNEL::Exception);
4734 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4735 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4736 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4737 void reverse() throw(INTERP_KERNEL::Exception);
4738 void fillWithZero() throw(INTERP_KERNEL::Exception);
4739 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4740 std::string repr() const throw(INTERP_KERNEL::Exception);
4741 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4742 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4743 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4744 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4745 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4746 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4747 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4748 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4749 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4750 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4751 char front() const throw(INTERP_KERNEL::Exception);
4752 char back() const throw(INTERP_KERNEL::Exception);
4753 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4754 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4755 char *getPointer() throw(INTERP_KERNEL::Exception);
4756 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4757 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4758 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4759 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4760 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4761 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4762 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4763 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4764 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4765 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4766 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4769 int __len__() const throw(INTERP_KERNEL::Exception)
4771 if(self->isAllocated())
4773 return self->getNumberOfTuples();
4777 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4781 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4784 bool ret0=self->isEqualIfNotWhy(other,ret1);
4785 PyObject *ret=PyTuple_New(2);
4786 PyObject *ret0Py=ret0?Py_True:Py_False;
4788 PyTuple_SetItem(ret,0,ret0Py);
4789 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4793 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4796 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4797 if (!SWIG_IsOK(res1))
4800 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4801 if(size!=self->getNumberOfTuples())
4803 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4805 return self->renumber(tmp);
4809 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4811 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4812 da2->checkAllocated();
4813 int size=self->getNumberOfTuples();
4814 if(size!=self->getNumberOfTuples())
4816 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4818 return self->renumber(da2->getConstPointer());
4822 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4825 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4826 if (!SWIG_IsOK(res1))
4829 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4830 if(size!=self->getNumberOfTuples())
4832 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4834 return self->renumberR(tmp);
4838 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4840 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4841 da2->checkAllocated();
4842 int size=self->getNumberOfTuples();
4843 if(size!=self->getNumberOfTuples())
4845 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4847 return self->renumberR(da2->getConstPointer());
4851 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4854 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4855 if (!SWIG_IsOK(res1))
4858 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4859 if(size!=self->getNumberOfTuples())
4861 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4863 return self->renumberAndReduce(tmp,newNbOfTuple);
4867 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4869 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4870 da2->checkAllocated();
4871 int size=self->getNumberOfTuples();
4872 if(size!=self->getNumberOfTuples())
4874 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4876 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4880 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4882 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4883 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4884 return DataArrayChar::Aggregate(tmp);
4887 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4889 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4890 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4891 return DataArrayChar::Meld(tmp);
4896 class DataArrayByteIterator;
4898 class DataArrayByte : public DataArrayChar
4901 static DataArrayByte *New();
4902 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4903 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4904 char byteValue() const throw(INTERP_KERNEL::Exception);
4907 DataArrayByte() throw(INTERP_KERNEL::Exception)
4909 return DataArrayByte::New();
4912 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4914 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) !";
4915 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4919 if(PyInt_Check(nbOfTuples))
4921 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4923 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4926 if(PyInt_Check(nbOfComp))
4927 {//DataArrayByte.New([1,3,4,5],2,2)
4928 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4930 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4931 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4932 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4933 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4937 throw INTERP_KERNEL::Exception(msg);
4940 {//DataArrayByte.New([1,3,4],3)
4941 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4943 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4944 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4949 throw INTERP_KERNEL::Exception(msg);
4952 {// DataArrayByte.New([1,3,4])
4953 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4954 int tmpp1=-1,tmpp2=-1;
4955 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4956 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4960 else if(PyInt_Check(elt0))
4962 int nbOfTuples1=PyInt_AS_LONG(elt0);
4964 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4969 if(PyInt_Check(nbOfTuples))
4970 {//DataArrayByte.New(5,2)
4971 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4973 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4974 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4975 ret->alloc(nbOfTuples1,nbOfCompo);
4979 throw INTERP_KERNEL::Exception(msg);
4982 throw INTERP_KERNEL::Exception(msg);
4985 {//DataArrayByte.New(5)
4986 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4987 ret->alloc(nbOfTuples1,1);
4992 throw INTERP_KERNEL::Exception(msg);
4995 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4997 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5000 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5002 std::ostringstream oss;
5003 self->reprQuickOverview(oss);
5007 int __int__() const throw(INTERP_KERNEL::Exception)
5009 return (int) self->byteValue();
5012 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5014 return self->iterator();
5017 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5019 return (int)self->getIJ(tupleId,compoId);
5022 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5024 return (int)self->getIJSafe(tupleId,compoId);
5027 std::string __str__() const throw(INTERP_KERNEL::Exception)
5029 return self->repr();
5032 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5034 const char *vals=self->getConstPointer();
5035 int nbOfComp=self->getNumberOfComponents();
5036 int nbOfTuples=self->getNumberOfTuples();
5037 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5040 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5043 int ival=-1; std::vector<int> ivval;
5044 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5045 std::vector<char> vals(sz);
5046 std::copy(pt,pt+sz,vals.begin());
5047 return self->presenceOfTuple(vals);
5050 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5053 int ival=-1; std::vector<int> ivval;
5054 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5055 std::vector<char> vals2(sz);
5056 std::copy(pt,pt+sz,vals2.begin());
5057 return self->presenceOfValue(vals2);
5060 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5063 int ival=-1; std::vector<int> ivval;
5064 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5065 std::vector<char> vals2(sz);
5066 std::copy(pt,pt+sz,vals2.begin());
5067 return self->locateValue(vals2);
5070 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5073 int ival=-1; std::vector<int> ivval;
5074 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5075 std::vector<char> vals(sz);
5076 std::copy(pt,pt+sz,vals.begin());
5077 return self->locateTuple(vals);
5080 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5083 int ival=-1; std::vector<int> ivval;
5084 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5085 std::vector<char> vals(sz);
5086 std::copy(pt,pt+sz,vals.begin());
5087 return self->search(vals);
5090 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5092 int sz=self->getNumberOfComponents();
5093 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5094 self->getTuple(tupleId,tmp);
5095 PyObject *ret=PyTuple_New(sz);
5096 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5100 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5103 int r1=(int)self->getMaxValue(tmp);
5104 PyObject *ret=PyTuple_New(2);
5105 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5106 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5110 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5113 int r1=(int)self->getMinValue(tmp);
5114 PyObject *ret=PyTuple_New(2);
5115 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5116 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5120 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5122 int nbOfCompo=self->getNumberOfComponents();
5127 if(PyInt_Check(obj))
5129 int val=(int)PyInt_AS_LONG(obj);
5130 return self->locateValue(val);
5133 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5136 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5140 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5142 int nbOfCompo=self->getNumberOfComponents();
5149 if(PyInt_Check(obj))
5151 int val=(int)PyInt_AS_LONG(obj);
5152 return self->presenceOfValue(val);
5155 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5158 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5164 class DataArrayByteTuple;
5166 class DataArrayByteIterator
5169 DataArrayByteIterator(DataArrayByte *da);
5170 ~DataArrayByteIterator();
5173 class DataArrayByteTuple
5176 std::string repr() const throw(INTERP_KERNEL::Exception);
5177 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5180 std::string __str__() const throw(INTERP_KERNEL::Exception)
5182 return self->repr();
5185 char __int__() const throw(INTERP_KERNEL::Exception)
5187 return self->byteValue();
5190 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5192 return self->buildDAByte(1,self->getNumberOfCompo());
5197 class DataArrayAsciiCharIterator;
5199 class DataArrayAsciiChar : public DataArrayChar
5202 static DataArrayAsciiChar *New();
5203 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5204 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5205 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5208 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5210 return DataArrayAsciiChar::New();
5213 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5215 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) !";
5216 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5220 if(PyInt_Check(nbOfTuples))
5222 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5224 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5227 if(PyInt_Check(nbOfComp))
5228 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5229 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5231 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5232 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5233 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5234 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5238 throw INTERP_KERNEL::Exception(msg);
5241 {//DataArrayAsciiChar.New([1,3,4],3)
5242 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5244 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5245 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5249 else if(PyString_Check(nbOfTuples))
5251 if(PyString_Size(nbOfTuples)!=1)
5252 throw INTERP_KERNEL::Exception(msg);
5253 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5254 std::vector<std::string> tmp;
5255 if(fillStringVector(elt0,tmp))
5256 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5258 throw INTERP_KERNEL::Exception(msg);
5261 throw INTERP_KERNEL::Exception(msg);
5265 std::vector<std::string> tmmp;
5266 if(fillStringVector(elt0,tmmp))
5267 //DataArrayAsciiChar.New(["abc","de","fghi"])
5268 return DataArrayAsciiChar::New(tmmp,' ');
5271 // DataArrayAsciiChar.New([1,3,4])
5272 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5273 int tmpp1=-1,tmpp2=-1;
5274 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5275 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5280 else if(PyInt_Check(elt0))
5282 int nbOfTuples1=PyInt_AS_LONG(elt0);
5284 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5289 if(PyInt_Check(nbOfTuples))
5290 {//DataArrayAsciiChar.New(5,2)
5291 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5293 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5294 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5295 ret->alloc(nbOfTuples1,nbOfCompo);
5299 throw INTERP_KERNEL::Exception(msg);
5302 throw INTERP_KERNEL::Exception(msg);
5305 {//DataArrayAsciiChar.New(5)
5306 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5307 ret->alloc(nbOfTuples1,1);
5312 throw INTERP_KERNEL::Exception(msg);
5315 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5317 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5320 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5322 std::ostringstream oss;
5323 self->reprQuickOverview(oss);
5327 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5329 return self->iterator();
5332 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5334 char tmp[2]; tmp[1]='\0';
5335 tmp[0]=self->getIJ(tupleId,compoId);
5336 return std::string(tmp);
5339 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5341 char tmp[2]; tmp[1]='\0';
5342 tmp[0]=self->getIJSafe(tupleId,compoId);
5343 return std::string(tmp);
5346 std::string __str__() const throw(INTERP_KERNEL::Exception)
5348 return self->repr();
5351 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5353 const char *vals=self->getConstPointer();
5354 int nbOfComp=self->getNumberOfComponents();
5355 int nbOfTuples=self->getNumberOfTuples();
5356 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5359 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5361 if(PyString_Check(tupl))
5363 Py_ssize_t sz=PyString_Size(tupl);
5364 std::vector<char> vals(sz);
5365 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5366 return self->presenceOfTuple(vals);
5369 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5372 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5374 if(PyString_Check(vals))
5376 Py_ssize_t sz=PyString_Size(vals);
5377 std::vector<char> vals2(sz);
5378 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5379 return self->presenceOfValue(vals2);
5382 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5385 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5387 if(PyString_Check(vals))
5389 Py_ssize_t sz=PyString_Size(vals);
5390 std::vector<char> vals2(sz);
5391 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5392 return self->locateValue(vals2);
5395 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5398 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5400 if(PyString_Check(tupl))
5402 Py_ssize_t sz=PyString_Size(tupl);
5403 std::vector<char> vals(sz);
5404 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5405 return self->locateTuple(vals);
5408 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5411 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5413 if(PyString_Check(strOrListOfInt))
5415 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5416 std::vector<char> vals(sz);
5417 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5418 return self->search(vals);
5421 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5424 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5426 int sz=self->getNumberOfComponents();
5427 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5428 self->getTuple(tupleId,tmp);
5429 return PyString_FromString(tmp);
5432 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5435 char tmp2[2]; tmp2[1]='\0';
5436 tmp2[0]=self->getMaxValue(tmp);
5437 PyObject *ret=PyTuple_New(2);
5438 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5439 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5443 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5446 char tmp2[2]; tmp2[1]='\0';
5447 tmp2[0]=self->getMinValue(tmp);
5448 PyObject *ret=PyTuple_New(2);
5449 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5450 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5454 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5456 int nbOfCompo=self->getNumberOfComponents();
5461 if(PyString_Check(obj))
5463 Py_ssize_t sz=PyString_Size(obj);
5464 char *pt=PyString_AsString(obj);
5466 return self->locateValue(pt[0]);
5468 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5471 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5474 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5478 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5480 int nbOfCompo=self->getNumberOfComponents();
5487 if(PyString_Check(obj))
5489 Py_ssize_t sz=PyString_Size(obj);
5490 char *pt=PyString_AsString(obj);
5492 return self->presenceOfValue(pt[0]);
5494 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5497 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5500 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5504 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5507 std::vector<int> stdvecTyyppArr;
5508 std::pair<int, std::pair<int,int> > sTyyppArr;
5509 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5510 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5514 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5516 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5518 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5520 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5522 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5526 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5528 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.";
5530 std::vector<int> stdvecTyyppArr;
5531 std::pair<int, std::pair<int,int> > sTyyppArr;
5532 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5533 int nbOfCompo=self->getNumberOfComponents();
5534 int nbOfTuples=self->getNumberOfTuples();
5535 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5537 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5538 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5547 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5553 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5554 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5557 //value vector<string>
5560 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5561 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5564 //value DataArrayChar
5567 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5571 throw INTERP_KERNEL::Exception(msg);
5575 {//obj list-tuple[int]
5581 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5587 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5588 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5591 //value vector<string>
5594 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5595 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5598 //value DataArrayChar
5601 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5605 throw INTERP_KERNEL::Exception(msg);
5616 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5622 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5623 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5626 //value vector<string>
5629 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5630 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5633 //value DataArrayChar
5636 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5640 throw INTERP_KERNEL::Exception(msg);
5651 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5657 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5658 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5661 //value vector<string>
5664 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5665 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5668 //value DataArrayChar
5671 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5675 throw INTERP_KERNEL::Exception(msg);
5680 throw INTERP_KERNEL::Exception(msg);
5686 class DataArrayAsciiCharTuple;
5688 class DataArrayAsciiCharIterator
5691 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5692 ~DataArrayAsciiCharIterator();
5697 DataArrayAsciiCharTuple *ret=self->nextt();
5699 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5702 PyErr_SetString(PyExc_StopIteration,"No more data.");
5709 class DataArrayAsciiCharTuple
5712 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5713 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5716 std::string __str__() const throw(INTERP_KERNEL::Exception)
5718 return self->repr();
5721 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5723 return self->buildDAAsciiChar(1,self->getNumberOfCompo());