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::sumPerTuple;
71 %newobject ParaMEDMEM::DataArrayInt::negate;
72 %newobject ParaMEDMEM::DataArrayInt::computeAbs;
73 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
74 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
75 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
76 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
77 %newobject ParaMEDMEM::DataArrayInt::Meld;
78 %newobject ParaMEDMEM::DataArrayInt::Add;
79 %newobject ParaMEDMEM::DataArrayInt::Substract;
80 %newobject ParaMEDMEM::DataArrayInt::Multiply;
81 %newobject ParaMEDMEM::DataArrayInt::Divide;
82 %newobject ParaMEDMEM::DataArrayInt::Pow;
83 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
84 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
85 %newobject ParaMEDMEM::DataArrayInt::Range;
86 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
87 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
88 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
89 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
90 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
91 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
92 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
93 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
94 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
95 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
96 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
97 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
98 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
99 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
100 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
101 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
102 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
103 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
104 %newobject ParaMEDMEM::DataArrayInt::__neg__;
105 %newobject ParaMEDMEM::DataArrayInt::__add__;
106 %newobject ParaMEDMEM::DataArrayInt::__radd__;
107 %newobject ParaMEDMEM::DataArrayInt::__sub__;
108 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
109 %newobject ParaMEDMEM::DataArrayInt::__mul__;
110 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
111 %newobject ParaMEDMEM::DataArrayInt::__div__;
112 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
113 %newobject ParaMEDMEM::DataArrayInt::__mod__;
114 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
115 %newobject ParaMEDMEM::DataArrayInt::__pow__;
116 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
117 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
118 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
119 %newobject ParaMEDMEM::DataArrayChar::renumber;
120 %newobject ParaMEDMEM::DataArrayChar::renumberR;
121 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
122 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
123 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
124 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
125 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
126 %newobject ParaMEDMEM::DataArrayChar::Meld;
127 %newobject ParaMEDMEM::DataArrayByte::New;
128 %newobject ParaMEDMEM::DataArrayByte::__iter__;
129 %newobject ParaMEDMEM::DataArrayByte::performCpy;
130 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
131 %newobject ParaMEDMEM::DataArrayChar::substr;
132 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
133 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
134 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
135 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
136 %newobject ParaMEDMEM::DataArrayDouble::New;
137 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
138 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
139 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
140 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
141 %newobject ParaMEDMEM::DataArrayDouble::Meld;
142 %newobject ParaMEDMEM::DataArrayDouble::Dot;
143 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
144 %newobject ParaMEDMEM::DataArrayDouble::Add;
145 %newobject ParaMEDMEM::DataArrayDouble::Substract;
146 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
147 %newobject ParaMEDMEM::DataArrayDouble::Divide;
148 %newobject ParaMEDMEM::DataArrayDouble::Pow;
149 %newobject ParaMEDMEM::DataArrayDouble::substr;
150 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
151 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
152 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
153 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
154 %newobject ParaMEDMEM::DataArrayDouble::negate;
155 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
156 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
157 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
158 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
159 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
160 %newobject ParaMEDMEM::DataArrayDouble::determinant;
161 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
162 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
163 %newobject ParaMEDMEM::DataArrayDouble::inverse;
164 %newobject ParaMEDMEM::DataArrayDouble::trace;
165 %newobject ParaMEDMEM::DataArrayDouble::deviator;
166 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
167 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
168 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
169 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
170 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
171 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
172 %newobject ParaMEDMEM::DataArrayDouble::renumber;
173 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
174 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
175 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
176 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
177 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
178 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
179 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
180 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
181 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
182 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
183 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
184 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
185 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
186 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
187 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
188 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
189 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
190 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
191 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
193 %feature("unref") DataArray "$this->decrRef();"
194 %feature("unref") DataArrayDouble "$this->decrRef();"
195 %feature("unref") DataArrayInt "$this->decrRef();"
196 %feature("unref") DataArrayChar "$this->decrRef();"
197 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
198 %feature("unref") DataArrayByte "$this->decrRef();"
202 class DataArray : public RefCountObject, public TimeLabel
205 void setName(const char *name);
206 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
207 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
208 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
209 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
210 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
211 std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
212 std::string getName() const;
213 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
214 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
215 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
216 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
217 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
218 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
219 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
220 void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
221 int getNumberOfComponents() const;
222 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
223 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
224 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
225 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
226 virtual void desallocate() throw(INTERP_KERNEL::Exception);
227 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
228 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
229 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
230 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
231 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
232 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
233 void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
234 void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
235 void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
236 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
237 void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
238 static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
239 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
240 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
241 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
242 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
243 void updateTime() const;
246 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
248 const std::vector<std::string>& comps=self->getInfoOnComponents();
249 PyObject *ret=PyList_New((int)comps.size());
250 for(int i=0;i<(int)comps.size();i++)
251 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
255 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
257 std::vector<int> tmp;
258 convertPyToNewIntArr3(li,tmp);
259 self->copyPartOfStringInfoFrom(other,tmp);
262 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
264 std::vector<int> tmp;
265 convertPyToNewIntArr3(li,tmp);
266 self->copyPartOfStringInfoFrom2(tmp,other);
269 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
272 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
273 if (!SWIG_IsOK(res1))
276 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
277 if(size!=self->getNumberOfTuples())
279 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
281 self->renumberInPlace(tmp);
285 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
287 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
288 da2->checkAllocated();
289 int size=self->getNumberOfTuples();
290 if(size!=self->getNumberOfTuples())
292 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
294 self->renumberInPlace(da2->getConstPointer());
298 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
301 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
302 if (!SWIG_IsOK(res1))
305 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
306 if(size!=self->getNumberOfTuples())
308 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
310 self->renumberInPlaceR(tmp);
314 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
316 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
317 da2->checkAllocated();
318 int size=self->getNumberOfTuples();
319 if(size!=self->getNumberOfTuples())
321 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
323 self->renumberInPlaceR(da2->getConstPointer());
327 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
328 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
330 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
331 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
332 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
333 DataArrayInt *tuplesSelecPtr2=0;
336 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
338 throw INTERP_KERNEL::Exception(msg);
340 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
343 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
345 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
346 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
349 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
351 std::vector<std::pair<int,int> > ranges;
352 convertPyToVectorPairInt(li,ranges);
353 return self->selectByTupleRanges(ranges);
356 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
359 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
360 if (!SWIG_IsOK(res1))
363 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
364 return self->selectByTupleId(tmp,tmp+size);
368 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
370 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
371 da2->checkAllocated();
372 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
376 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
379 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
380 if (!SWIG_IsOK(res1))
383 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
384 return self->selectByTupleIdSafe(tmp,tmp+size);
388 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
390 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
391 da2->checkAllocated();
392 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
396 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
398 std::vector<int> tmp;
399 convertPyToNewIntArr3(li,tmp);
400 DataArray *ret=self->keepSelectedComponents(tmp);
401 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
404 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
406 if(!PySlice_Check(slic))
407 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
408 Py_ssize_t strt=2,stp=2,step=2;
409 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
410 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
411 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : the input slice is invalid !");
412 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
413 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 !");
415 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
416 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
419 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
421 if(!PySlice_Check(slic))
422 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
423 Py_ssize_t strt=2,stp=2,step=2;
424 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
425 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
426 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : the input slice is invalid !");
428 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
429 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
432 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
434 if(!PySlice_Check(slic))
435 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
436 Py_ssize_t strt=2,stp=2,step=2;
437 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
438 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
439 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
440 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
441 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : the input slice contains some unknowns that can't be determined in static method !");
442 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
445 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
447 if(!PySlice_Check(slic))
448 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
449 Py_ssize_t strt=2,stp=2,step=2;
450 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
451 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
452 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
453 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
454 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice contains some unknowns that can't be determined in static method !");
455 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
458 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
460 std::vector<const DataArray *> tmp;
461 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
462 return DataArray::Aggregate(tmp);
465 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
467 if(!PySlice_Check(slic))
468 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
469 Py_ssize_t strt=2,stp=2,step=2;
470 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
471 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
472 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
473 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
476 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
478 if(!PySlice_Check(slic))
479 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
480 Py_ssize_t strt=2,stp=2,step=2;
481 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
482 if(PySlice_GetIndices(sly,self->getNumberOfTuples(),&strt,&stp,&step)!=0)
483 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
484 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
490 class DataArrayDoubleIterator;
492 class DataArrayDouble : public DataArray
495 static DataArrayDouble *New();
496 double doubleValue() const throw(INTERP_KERNEL::Exception);
497 bool empty() const throw(INTERP_KERNEL::Exception);
498 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
499 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
500 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
501 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
502 double popBackSilent() throw(INTERP_KERNEL::Exception);
503 void pack() const throw(INTERP_KERNEL::Exception);
504 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
505 void fillWithZero() throw(INTERP_KERNEL::Exception);
506 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
507 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
508 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
509 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
510 void reverse() throw(INTERP_KERNEL::Exception);
511 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
512 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
513 std::string repr() const throw(INTERP_KERNEL::Exception);
514 std::string reprZip() const throw(INTERP_KERNEL::Exception);
515 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
516 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
517 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
518 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
519 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
520 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
521 void transpose() throw(INTERP_KERNEL::Exception);
522 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
523 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
524 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
525 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
526 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
527 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
528 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
529 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
530 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
531 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
532 double front() const throw(INTERP_KERNEL::Exception);
533 double back() const throw(INTERP_KERNEL::Exception);
534 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
535 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
536 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
537 double *getPointer() throw(INTERP_KERNEL::Exception);
538 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
539 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
540 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
541 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
542 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
543 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
544 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
545 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
546 double getAverageValue() const throw(INTERP_KERNEL::Exception);
547 double norm2() const throw(INTERP_KERNEL::Exception);
548 double normMax() const throw(INTERP_KERNEL::Exception);
549 double normMin() const throw(INTERP_KERNEL::Exception);
550 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
551 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
552 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
553 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
554 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
555 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
559 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
561 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
564 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
565 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
566 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
567 void abs() throw(INTERP_KERNEL::Exception);
568 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
569 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
570 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
571 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
572 void applyPow(double val) throw(INTERP_KERNEL::Exception);
573 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
574 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
575 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
576 DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
577 DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
578 DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
579 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
580 void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
581 void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
582 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
583 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
584 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
585 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
586 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
587 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
588 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
589 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
590 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
591 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
592 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
593 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
594 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
595 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
596 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
597 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
598 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
599 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
602 DataArrayDouble() throw(INTERP_KERNEL::Exception)
604 return DataArrayDouble::New();
607 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
609 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)";
610 std::string msg(msgBase);
612 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
615 if(PyList_Check(elt0) || PyTuple_Check(elt0))
619 if(PyInt_Check(nbOfTuples))
621 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
623 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
626 if(PyInt_Check(elt2))
627 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
628 int nbOfCompo=PyInt_AS_LONG(elt2);
630 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
631 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
632 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
633 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
637 throw INTERP_KERNEL::Exception(msg.c_str());
640 {//DataArrayDouble.New([1.,3.,4.],3)
641 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
643 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
644 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
649 throw INTERP_KERNEL::Exception(msg.c_str());
652 {// DataArrayDouble.New([1.,3.,4.])
653 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
654 int tmpp1=-1,tmpp2=-1;
655 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
656 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
660 else if(PyInt_Check(elt0))
662 int nbOfTuples1=PyInt_AS_LONG(elt0);
664 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
669 if(PyInt_Check(nbOfTuples))
670 {//DataArrayDouble.New(5,2)
671 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
673 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
674 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
675 ret->alloc(nbOfTuples1,nbOfCompo);
679 throw INTERP_KERNEL::Exception(msg.c_str());
682 throw INTERP_KERNEL::Exception(msg.c_str());
685 {//DataArrayDouble.New(5)
686 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
687 ret->alloc(nbOfTuples1,1);
692 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
693 {//DataArrayDouble.New(numpyArray)
694 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
698 throw INTERP_KERNEL::Exception(msg.c_str());
701 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
703 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
706 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
709 std::vector<double> bb;
711 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
712 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
713 self->pushBackValsSilent(tmp,tmp+nbTuples);
716 std::string __repr__() const throw(INTERP_KERNEL::Exception)
718 std::ostringstream oss;
719 self->reprQuickOverview(oss);
723 std::string __str__() const throw(INTERP_KERNEL::Exception)
728 double __float__() const throw(INTERP_KERNEL::Exception)
730 return self->doubleValue();
733 int __len__() const throw(INTERP_KERNEL::Exception)
735 if(self->isAllocated())
737 return self->getNumberOfTuples();
741 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
745 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
747 return self->iterator();
750 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
752 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 !";
753 if(PyList_Check(li) || PyTuple_Check(li))
757 if(PyInt_Check(nbOfTuples))
759 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
761 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
764 if(PyInt_Check(nbOfComp))
765 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
766 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
768 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
769 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
770 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
773 throw INTERP_KERNEL::Exception(msg);
776 {//DataArrayDouble.setValues([1.,3.,4.],3)
778 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
779 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
783 throw INTERP_KERNEL::Exception(msg);
786 {// DataArrayDouble.setValues([1.,3.,4.])
787 int tmpp1=-1,tmpp2=-1;
788 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
789 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
793 throw INTERP_KERNEL::Exception(msg);
796 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
798 const double *vals=self->getConstPointer();
799 return convertDblArrToPyList(vals,self->getNbOfElems());
803 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
805 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
809 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
812 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
813 PyObject *ret=PyTuple_New(2);
814 PyObject *ret0Py=ret0?Py_True:Py_False;
816 PyTuple_SetItem(ret,0,ret0Py);
817 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
821 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
823 const double *vals=self->getConstPointer();
824 int nbOfComp=self->getNumberOfComponents();
825 int nbOfTuples=self->getNumberOfTuples();
826 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
829 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
832 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
833 if (!SWIG_IsOK(res1))
836 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
837 if(size!=self->getNumberOfTuples())
839 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
841 return self->renumber(tmp);
845 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
847 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
848 da2->checkAllocated();
849 int size=self->getNumberOfTuples();
850 if(size!=self->getNumberOfTuples())
852 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
854 return self->renumber(da2->getConstPointer());
858 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
861 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
862 if (!SWIG_IsOK(res1))
865 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
866 if(size!=self->getNumberOfTuples())
868 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
870 return self->renumberR(tmp);
874 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
876 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
877 da2->checkAllocated();
878 int size=self->getNumberOfTuples();
879 if(size!=self->getNumberOfTuples())
881 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
883 return self->renumberR(da2->getConstPointer());
887 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
890 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
891 if (!SWIG_IsOK(res1))
894 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
895 if(size!=self->getNumberOfTuples())
897 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
899 return self->renumberAndReduce(tmp,newNbOfTuple);
903 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
905 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
906 da2->checkAllocated();
907 int size=self->getNumberOfTuples();
908 if(size!=self->getNumberOfTuples())
910 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
912 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
916 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
918 int thisTupleId,otherTupleId;
919 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
920 PyObject *ret=PyTuple_New(3);
921 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
922 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
923 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
927 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
930 double r1=self->getMaxValue(tmp);
931 PyObject *ret=PyTuple_New(2);
932 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
933 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
937 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
940 double r1=self->getMaxValue2(tmp);
941 PyObject *ret=PyTuple_New(2);
942 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
943 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
947 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
950 double r1=self->getMinValue(tmp);
951 PyObject *ret=PyTuple_New(2);
952 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
953 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
957 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
960 double r1=self->getMinValue2(tmp);
961 PyObject *ret=PyTuple_New(2);
962 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
963 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
967 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
969 int nbOfCompo=self->getNumberOfComponents();
970 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
971 self->getMinMaxPerComponent(tmp);
972 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
976 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
978 int sz=self->getNumberOfComponents();
979 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
980 self->accumulate(tmp);
981 return convertDblArrToPyList(tmp,sz);
984 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
987 std::vector<int> val2;
988 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
989 return self->accumulatePerChunck(bg,bg+sz);
992 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
994 DataArrayInt *comm, *commIndex;
995 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
996 PyObject *res = PyList_New(2);
997 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
998 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1002 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1006 DataArrayDoubleTuple *aa;
1007 std::vector<double> bb;
1009 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1010 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1012 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1013 PyObject *ret=PyTuple_New(2);
1014 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1015 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1019 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1021 std::vector<int> tmp;
1022 convertPyToNewIntArr3(li,tmp);
1023 self->setSelectedComponents(a,tmp);
1026 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1028 int sz=self->getNumberOfComponents();
1029 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1030 self->getTuple(tupleId,tmp);
1031 return convertDblArrToPyList(tmp,sz);
1034 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1036 std::vector<const DataArrayDouble *> tmp;
1037 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1038 return DataArrayDouble::Aggregate(tmp);
1041 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1043 std::vector<const DataArrayDouble *> tmp;
1044 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1045 return DataArrayDouble::Meld(tmp);
1048 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1052 DataArrayDoubleTuple *aa;
1053 std::vector<double> bb;
1055 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1056 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1057 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1058 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1059 DataArrayInt *c=0,*cI=0;
1060 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1061 PyObject *ret=PyTuple_New(2);
1062 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1063 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1067 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1069 DataArrayInt *ret1=0;
1070 bool ret0=self->areIncludedInMe(other,prec,ret1);
1071 PyObject *ret=PyTuple_New(2);
1072 PyObject *ret0Py=ret0?Py_True:Py_False;
1074 PyTuple_SetItem(ret,0,ret0Py);
1075 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1079 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1081 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1082 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1083 self->checkAllocated();
1084 int nbOfTuples=self->getNumberOfTuples();
1085 int nbOfComponents=self->getNumberOfComponents();
1087 std::vector<int> vt1,vc1;
1088 std::pair<int, std::pair<int,int> > pt1,pc1;
1089 DataArrayInt *dt1=0,*dc1=0;
1091 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1092 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1096 if(nbOfComponents==1)
1097 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1098 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1100 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1102 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1104 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1106 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1109 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1110 std::vector<int> v2(1,ic1);
1111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1115 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1116 std::vector<int> v2(1,ic1);
1117 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1121 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1122 std::vector<int> v2(1,ic1);
1123 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1127 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1132 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1133 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1137 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1138 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1142 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1143 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1147 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1148 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1149 std::vector<int> v2(nbOfComp);
1150 for(int i=0;i<nbOfComp;i++)
1151 v2[i]=pc1.first+i*pc1.second.second;
1152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1156 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1157 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1158 std::vector<int> v2(nbOfComp);
1159 for(int i=0;i<nbOfComp;i++)
1160 v2[i]=pc1.first+i*pc1.second.second;
1161 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1165 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1166 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1167 std::vector<int> v2(nbOfComp);
1168 for(int i=0;i<nbOfComp;i++)
1169 v2[i]=pc1.first+i*pc1.second.second;
1170 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1174 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1175 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1176 std::vector<int> v2(nbOfComp);
1177 for(int i=0;i<nbOfComp;i++)
1178 v2[i]=pc1.first+i*pc1.second.second;
1179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1182 throw INTERP_KERNEL::Exception(msg);
1186 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1188 self->checkAllocated();
1189 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1190 int nbOfTuples=self->getNumberOfTuples();
1191 int nbOfComponents=self->getNumberOfComponents();
1194 std::vector<double> v1;
1195 DataArrayDouble *d1=0;
1196 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1198 std::vector<int> vt1,vc1;
1199 std::pair<int, std::pair<int,int> > pt1,pc1;
1200 DataArrayInt *dt1=0,*dc1=0;
1201 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1202 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1210 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1213 tmp=DataArrayDouble::New();
1214 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1215 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1218 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1221 throw INTERP_KERNEL::Exception(msg);
1230 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1233 tmp=DataArrayDouble::New();
1234 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1235 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1238 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1241 throw INTERP_KERNEL::Exception(msg);
1250 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1253 tmp=DataArrayDouble::New();
1254 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1255 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1258 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1261 throw INTERP_KERNEL::Exception(msg);
1270 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1273 tmp=DataArrayDouble::New();
1274 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1275 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1278 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1281 throw INTERP_KERNEL::Exception(msg);
1290 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1293 tmp=DataArrayDouble::New();
1294 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1295 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1298 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1301 throw INTERP_KERNEL::Exception(msg);
1310 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1313 tmp=DataArrayDouble::New();
1314 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1315 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1318 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1321 throw INTERP_KERNEL::Exception(msg);
1330 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1333 tmp=DataArrayDouble::New();
1334 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1335 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1338 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1341 throw INTERP_KERNEL::Exception(msg);
1350 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1353 tmp=DataArrayDouble::New();
1354 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1355 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1358 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1361 throw INTERP_KERNEL::Exception(msg);
1370 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1373 tmp=DataArrayDouble::New();
1374 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1375 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1378 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1381 throw INTERP_KERNEL::Exception(msg);
1390 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1393 tmp=DataArrayDouble::New();
1394 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1395 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1398 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1401 throw INTERP_KERNEL::Exception(msg);
1410 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1413 tmp=DataArrayDouble::New();
1414 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1415 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1418 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1421 throw INTERP_KERNEL::Exception(msg);
1430 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1433 tmp=DataArrayDouble::New();
1434 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1435 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1438 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1441 throw INTERP_KERNEL::Exception(msg);
1450 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1453 tmp=DataArrayDouble::New();
1454 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1455 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1458 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1461 throw INTERP_KERNEL::Exception(msg);
1470 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1473 tmp=DataArrayDouble::New();
1474 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1475 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1478 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1481 throw INTERP_KERNEL::Exception(msg);
1490 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1493 tmp=DataArrayDouble::New();
1494 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1495 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1498 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1501 throw INTERP_KERNEL::Exception(msg);
1510 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1513 tmp=DataArrayDouble::New();
1514 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1515 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1518 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1521 throw INTERP_KERNEL::Exception(msg);
1526 throw INTERP_KERNEL::Exception(msg);
1531 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1533 return self->negate();
1536 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1538 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1541 DataArrayDoubleTuple *aa;
1542 std::vector<double> bb;
1545 #ifndef WITHOUT_AUTOFIELD
1547 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1549 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1552 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1553 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1555 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1558 throw INTERP_KERNEL::Exception(msg);
1562 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1567 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1568 ret->applyLin(1.,val);
1569 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1573 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1577 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1578 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1582 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1583 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1586 throw INTERP_KERNEL::Exception(msg);
1590 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1592 const char msg[]="Unexpected situation in __radd__ !";
1595 DataArrayDoubleTuple *aa;
1596 std::vector<double> bb;
1598 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1603 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1604 ret->applyLin(1.,val);
1609 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1610 return DataArrayDouble::Add(self,aaa);
1614 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1615 return DataArrayDouble::Add(self,aaa);
1618 throw INTERP_KERNEL::Exception(msg);
1622 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1624 const char msg[]="Unexpected situation in __iadd__ !";
1627 DataArrayDoubleTuple *aa;
1628 std::vector<double> bb;
1630 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1635 self->applyLin(1.,val);
1636 Py_XINCREF(trueSelf);
1642 Py_XINCREF(trueSelf);
1647 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1648 self->addEqual(aaa);
1649 Py_XINCREF(trueSelf);
1654 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1655 self->addEqual(aaa);
1656 Py_XINCREF(trueSelf);
1660 throw INTERP_KERNEL::Exception(msg);
1664 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1666 const char msg[]="Unexpected situation in __sub__ !";
1669 DataArrayDoubleTuple *aa;
1670 std::vector<double> bb;
1673 #ifndef WITHOUT_AUTOFIELD
1675 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1677 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1680 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1681 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1683 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1686 throw INTERP_KERNEL::Exception(msg);
1690 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1695 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1696 ret->applyLin(1.,-val);
1697 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1701 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1705 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1706 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1710 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1711 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1714 throw INTERP_KERNEL::Exception(msg);
1718 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1720 const char msg[]="Unexpected situation in __rsub__ !";
1723 DataArrayDoubleTuple *aa;
1724 std::vector<double> bb;
1726 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1731 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1732 ret->applyLin(-1.,val);
1737 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1738 return DataArrayDouble::Substract(aaa,self);
1742 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1743 return DataArrayDouble::Substract(aaa,self);
1746 throw INTERP_KERNEL::Exception(msg);
1750 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1752 const char msg[]="Unexpected situation in __isub__ !";
1755 DataArrayDoubleTuple *aa;
1756 std::vector<double> bb;
1758 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1763 self->applyLin(1,-val);
1764 Py_XINCREF(trueSelf);
1769 self->substractEqual(a);
1770 Py_XINCREF(trueSelf);
1775 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1776 self->substractEqual(aaa);
1777 Py_XINCREF(trueSelf);
1782 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1783 self->substractEqual(aaa);
1784 Py_XINCREF(trueSelf);
1788 throw INTERP_KERNEL::Exception(msg);
1792 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1794 const char msg[]="Unexpected situation in __mul__ !";
1797 DataArrayDoubleTuple *aa;
1798 std::vector<double> bb;
1801 #ifndef WITHOUT_AUTOFIELD
1803 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1805 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1808 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1809 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1811 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1814 throw INTERP_KERNEL::Exception(msg);
1818 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1824 ret->applyLin(val,0.);
1825 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1829 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1833 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1834 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1838 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1839 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1842 throw INTERP_KERNEL::Exception(msg);
1846 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1848 const char msg[]="Unexpected situation in __rmul__ !";
1851 DataArrayDoubleTuple *aa;
1852 std::vector<double> bb;
1854 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1859 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1860 ret->applyLin(val,0.);
1865 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1866 return DataArrayDouble::Multiply(self,aaa);
1870 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1871 return DataArrayDouble::Multiply(self,aaa);
1874 throw INTERP_KERNEL::Exception(msg);
1878 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1880 const char msg[]="Unexpected situation in __imul__ !";
1883 DataArrayDoubleTuple *aa;
1884 std::vector<double> bb;
1886 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1891 self->applyLin(val,0.);
1892 Py_XINCREF(trueSelf);
1897 self->multiplyEqual(a);
1898 Py_XINCREF(trueSelf);
1903 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1904 self->multiplyEqual(aaa);
1905 Py_XINCREF(trueSelf);
1910 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1911 self->multiplyEqual(aaa);
1912 Py_XINCREF(trueSelf);
1916 throw INTERP_KERNEL::Exception(msg);
1920 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1922 const char msg[]="Unexpected situation in __div__ !";
1925 DataArrayDoubleTuple *aa;
1926 std::vector<double> bb;
1929 #ifndef WITHOUT_AUTOFIELD
1931 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1933 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1936 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1937 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1939 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1942 throw INTERP_KERNEL::Exception(msg);
1946 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1952 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1953 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1954 ret->applyLin(1/val,0.);
1955 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1959 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1963 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1964 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1968 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1969 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1972 throw INTERP_KERNEL::Exception(msg);
1976 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1978 const char msg[]="Unexpected situation in __rdiv__ !";
1981 DataArrayDoubleTuple *aa;
1982 std::vector<double> bb;
1984 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1989 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1995 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1996 return DataArrayDouble::Divide(aaa,self);
2000 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2001 return DataArrayDouble::Divide(aaa,self);
2004 throw INTERP_KERNEL::Exception(msg);
2008 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2010 const char msg[]="Unexpected situation in __idiv__ !";
2013 DataArrayDoubleTuple *aa;
2014 std::vector<double> bb;
2016 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2022 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2023 self->applyLin(1./val,0.);
2024 Py_XINCREF(trueSelf);
2029 self->divideEqual(a);
2030 Py_XINCREF(trueSelf);
2035 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2036 self->divideEqual(aaa);
2037 Py_XINCREF(trueSelf);
2042 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2043 self->divideEqual(aaa);
2044 Py_XINCREF(trueSelf);
2048 throw INTERP_KERNEL::Exception(msg);
2052 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2054 const char msg[]="Unexpected situation in __pow__ !";
2057 DataArrayDoubleTuple *aa;
2058 std::vector<double> bb;
2060 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2065 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2071 return DataArrayDouble::Pow(self,a);
2075 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2076 return DataArrayDouble::Pow(self,aaa);
2080 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2081 return DataArrayDouble::Pow(self,aaa);
2084 throw INTERP_KERNEL::Exception(msg);
2088 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2090 const char msg[]="Unexpected situation in __rpow__ !";
2093 DataArrayDoubleTuple *aa;
2094 std::vector<double> bb;
2096 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2101 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2102 ret->applyRPow(val);
2107 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2108 return DataArrayDouble::Pow(aaa,self);
2112 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2113 return DataArrayDouble::Pow(aaa,self);
2116 throw INTERP_KERNEL::Exception(msg);
2120 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2122 const char msg[]="Unexpected situation in __ipow__ !";
2125 DataArrayDoubleTuple *aa;
2126 std::vector<double> bb;
2128 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2133 self->applyPow(val);
2134 Py_XINCREF(trueSelf);
2140 Py_XINCREF(trueSelf);
2145 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2146 self->powEqual(aaa);
2147 Py_XINCREF(trueSelf);
2152 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2153 self->powEqual(aaa);
2154 Py_XINCREF(trueSelf);
2158 throw INTERP_KERNEL::Exception(msg);
2162 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2164 DataArrayInt *c=0,*cI=0;
2166 self->computeTupleIdsNearTuples(other,eps,c,cI);
2167 PyObject *ret=PyTuple_New(2);
2168 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2169 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2173 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2175 DataArrayInt *ret1=0;
2176 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2177 PyObject *ret=PyTuple_New(2);
2178 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2179 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2185 class DataArrayDoubleTuple;
2187 class DataArrayDoubleIterator
2190 DataArrayDoubleIterator(DataArrayDouble *da);
2191 ~DataArrayDoubleIterator();
2196 DataArrayDoubleTuple *ret=self->nextt();
2198 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2201 PyErr_SetString(PyExc_StopIteration,"No more data.");
2208 class DataArrayDoubleTuple
2211 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2212 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2215 std::string __str__() const throw(INTERP_KERNEL::Exception)
2217 return self->repr();
2220 double __float__() const throw(INTERP_KERNEL::Exception)
2222 return self->doubleValue();
2225 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2227 return self->buildDADouble(1,self->getNumberOfCompo());
2230 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2232 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2233 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2234 Py_XINCREF(trueSelf);
2238 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2240 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2241 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2242 Py_XINCREF(trueSelf);
2246 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2248 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2249 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2250 Py_XINCREF(trueSelf);
2254 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2256 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2257 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2258 Py_XINCREF(trueSelf);
2262 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2264 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2267 std::vector<int> multiVal;
2268 std::pair<int, std::pair<int,int> > slic;
2269 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2270 const double *pt=self->getConstPointer();
2271 int nbc=self->getNumberOfCompo();
2272 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2279 std::ostringstream oss;
2280 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2281 throw INTERP_KERNEL::Exception(oss.str().c_str());
2284 return PyFloat_FromDouble(pt[singleVal]);
2288 return PyFloat_FromDouble(pt[nbc+singleVal]);
2291 std::ostringstream oss;
2292 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2293 throw INTERP_KERNEL::Exception(oss.str().c_str());
2299 PyObject *t=PyTuple_New(multiVal.size());
2300 for(int j=0;j<(int)multiVal.size();j++)
2302 int cid=multiVal[j];
2305 std::ostringstream oss;
2306 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2307 throw INTERP_KERNEL::Exception(oss.str().c_str());
2309 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2315 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2316 PyObject *t=PyTuple_New(sz);
2317 for(int j=0;j<sz;j++)
2318 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2322 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2326 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2328 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2329 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2332 std::vector<double> multiValV;
2333 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2334 int nbc=self->getNumberOfCompo();
2335 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2337 std::vector<int> multiVal;
2338 std::pair<int, std::pair<int,int> > slic;
2339 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2340 double *pt=self->getPointer();
2341 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2348 std::ostringstream oss;
2349 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2350 throw INTERP_KERNEL::Exception(oss.str().c_str());
2356 pt[singleVal]=singleValV;
2361 if(multiValV.size()!=1)
2363 std::ostringstream oss;
2364 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2365 throw INTERP_KERNEL::Exception(oss.str().c_str());
2367 pt[singleVal]=multiValV[0];
2372 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2376 throw INTERP_KERNEL::Exception(msg);
2385 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2389 std::ostringstream oss;
2390 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2391 throw INTERP_KERNEL::Exception(oss.str().c_str());
2399 if(multiVal.size()!=multiValV.size())
2401 std::ostringstream oss;
2402 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2403 throw INTERP_KERNEL::Exception(oss.str().c_str());
2405 for(int i=0;i<(int)multiVal.size();i++)
2407 int pos=multiVal[i];
2410 std::ostringstream oss;
2411 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2412 throw INTERP_KERNEL::Exception(oss.str().c_str());
2414 pt[multiVal[i]]=multiValV[i];
2420 const double *ptV=daIntTyyppV->getConstPointer();
2421 if(nbc>daIntTyyppV->getNumberOfCompo())
2423 std::ostringstream oss;
2424 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2425 throw INTERP_KERNEL::Exception(oss.str().c_str());
2427 std::copy(ptV,ptV+nbc,pt);
2431 throw INTERP_KERNEL::Exception(msg);
2436 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2441 for(int j=0;j<sz;j++)
2442 pt[slic.first+j*slic.second.second]=singleValV;
2447 if(sz!=(int)multiValV.size())
2449 std::ostringstream oss;
2450 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2451 throw INTERP_KERNEL::Exception(oss.str().c_str());
2453 for(int j=0;j<sz;j++)
2454 pt[slic.first+j*slic.second.second]=multiValV[j];
2459 const double *ptV=daIntTyyppV->getConstPointer();
2460 if(sz>daIntTyyppV->getNumberOfCompo())
2462 std::ostringstream oss;
2463 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2464 throw INTERP_KERNEL::Exception(oss.str().c_str());
2466 for(int j=0;j<sz;j++)
2467 pt[slic.first+j*slic.second.second]=ptV[j];
2471 throw INTERP_KERNEL::Exception(msg);
2475 throw INTERP_KERNEL::Exception(msg);
2481 class DataArrayIntIterator;
2483 class DataArrayInt : public DataArray
2486 static DataArrayInt *New();
2487 int intValue() const throw(INTERP_KERNEL::Exception);
2488 int getHashCode() const throw(INTERP_KERNEL::Exception);
2489 bool empty() const throw(INTERP_KERNEL::Exception);
2490 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2491 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2492 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2493 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2494 int popBackSilent() throw(INTERP_KERNEL::Exception);
2495 void pack() const throw(INTERP_KERNEL::Exception);
2496 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2497 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2498 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2499 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2500 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2501 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2502 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2503 void reverse() throw(INTERP_KERNEL::Exception);
2504 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2505 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2506 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2507 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2508 void fillWithZero() throw(INTERP_KERNEL::Exception);
2509 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2510 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2511 std::string repr() const throw(INTERP_KERNEL::Exception);
2512 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2513 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2514 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2515 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2516 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2517 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2518 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2519 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2520 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2521 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2522 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2523 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2524 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2525 void transpose() throw(INTERP_KERNEL::Exception);
2526 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2527 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2528 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2529 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2530 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2531 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2532 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2533 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2534 int front() const throw(INTERP_KERNEL::Exception);
2535 int back() const throw(INTERP_KERNEL::Exception);
2536 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2537 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2538 int *getPointer() throw(INTERP_KERNEL::Exception);
2539 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2540 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2541 const int *begin() const throw(INTERP_KERNEL::Exception);
2542 const int *end() const throw(INTERP_KERNEL::Exception);
2543 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2544 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2545 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2546 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2547 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2548 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2549 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2550 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2551 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2552 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2553 int count(int value) const throw(INTERP_KERNEL::Exception);
2554 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2555 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2556 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2557 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2558 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2559 void abs() throw(INTERP_KERNEL::Exception);
2560 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2561 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2562 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2563 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2564 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2565 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2566 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2567 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2568 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2569 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2570 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2571 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2572 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2573 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2574 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2575 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2576 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2577 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2578 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2579 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2580 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2581 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2582 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2583 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2584 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2585 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2586 void computeOffsets() throw(INTERP_KERNEL::Exception);
2587 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2588 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2589 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2591 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2592 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2593 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2594 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2595 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2596 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2597 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2598 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2599 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2600 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2601 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2602 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2603 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2604 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2606 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2609 DataArrayInt() throw(INTERP_KERNEL::Exception)
2611 return DataArrayInt::New();
2614 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2616 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)";
2617 std::string msg(msgBase);
2619 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2622 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2626 if(PyInt_Check(nbOfTuples))
2628 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2630 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2633 if(PyInt_Check(nbOfComp))
2634 {//DataArrayInt.New([1,3,4,5],2,2)
2635 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2637 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2638 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2639 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2640 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2644 throw INTERP_KERNEL::Exception(msg.c_str());
2647 {//DataArrayInt.New([1,3,4],3)
2648 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2650 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2651 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2656 throw INTERP_KERNEL::Exception(msg.c_str());
2659 {// DataArrayInt.New([1,3,4])
2660 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2661 int tmpp1=-1,tmpp2=-1;
2662 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2663 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2667 else if(PyInt_Check(elt0))
2669 int nbOfTuples1=PyInt_AS_LONG(elt0);
2671 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2676 if(PyInt_Check(nbOfTuples))
2677 {//DataArrayInt.New(5,2)
2678 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2680 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2681 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2682 ret->alloc(nbOfTuples1,nbOfCompo);
2686 throw INTERP_KERNEL::Exception(msg.c_str());
2689 throw INTERP_KERNEL::Exception(msg.c_str());
2692 {//DataArrayInt.New(5)
2693 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2694 ret->alloc(nbOfTuples1,1);
2699 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2700 {//DataArrayInt.New(numpyArray)
2701 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2705 throw INTERP_KERNEL::Exception(msg.c_str());
2708 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2710 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2713 std::string __str__() const throw(INTERP_KERNEL::Exception)
2715 return self->repr();
2718 int __len__() const throw(INTERP_KERNEL::Exception)
2720 if(self->isAllocated())
2722 return self->getNumberOfTuples();
2726 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2730 int __int__() const throw(INTERP_KERNEL::Exception)
2732 return self->intValue();
2735 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2737 return self->iterator();
2740 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2742 int sz=self->getNumberOfComponents();
2743 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2744 self->accumulate(tmp);
2745 return convertIntArrToPyList(tmp,sz);
2748 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2751 std::vector<int> val2;
2752 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2753 return self->accumulatePerChunck(bg,bg+sz);
2756 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2758 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2759 PyObject *ret=PyList_New(slcs.size());
2760 for(std::size_t i=0;i<slcs.size();i++)
2761 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2765 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2767 if(!PySlice_Check(slic))
2768 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2769 Py_ssize_t strt=2,stp=2,step=2;
2770 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2771 if(PySlice_GetIndices(sly,std::numeric_limits<int>::max(),&strt,&stp,&step)!=0)
2772 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2773 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2774 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 !");
2775 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2778 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2780 int newNbOfTuples=-1;
2781 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2782 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2783 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2784 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2785 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2786 PyObject *ret=PyTuple_New(2);
2787 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2788 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2792 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2794 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 !";
2795 if(PyList_Check(li) || PyTuple_Check(li))
2799 if(PyInt_Check(nbOfTuples))
2801 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2803 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2806 if(PyInt_Check(nbOfComp))
2807 {//DataArrayInt.setValues([1,3,4,5],2,2)
2808 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2810 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2811 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2812 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2815 throw INTERP_KERNEL::Exception(msg);
2818 {//DataArrayInt.setValues([1,3,4],3)
2820 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2821 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2825 throw INTERP_KERNEL::Exception(msg);
2828 {// DataArrayInt.setValues([1,3,4])
2829 int tmpp1=-1,tmpp2=-1;
2830 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2831 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2835 throw INTERP_KERNEL::Exception(msg);
2838 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2840 const int *vals=self->getConstPointer();
2841 return convertIntArrToPyList(vals,self->getNbOfElems());
2845 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2847 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2851 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2854 bool ret0=self->isEqualIfNotWhy(other,ret1);
2855 PyObject *ret=PyTuple_New(2);
2856 PyObject *ret0Py=ret0?Py_True:Py_False;
2858 PyTuple_SetItem(ret,0,ret0Py);
2859 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2863 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2865 const int *vals=self->getConstPointer();
2866 int nbOfComp=self->getNumberOfComponents();
2867 int nbOfTuples=self->getNumberOfTuples();
2868 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2871 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2873 std::vector<const DataArrayInt *> groups;
2874 std::vector< std::vector<int> > fidsOfGroups;
2875 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
2876 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2877 PyObject *ret = PyList_New(2);
2878 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2879 int sz=fidsOfGroups.size();
2880 PyObject *ret1 = PyList_New(sz);
2881 for(int i=0;i<sz;i++)
2882 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2883 PyList_SetItem(ret,1,ret1);
2887 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2890 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2891 if (!SWIG_IsOK(res1))
2894 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2895 self->transformWithIndArr(tmp,tmp+size);
2899 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2900 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2904 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2908 std::vector<int> multiVal;
2909 std::pair<int, std::pair<int,int> > slic;
2910 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2911 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2915 return self->getIdsEqualList(&singleVal,&singleVal+1);
2917 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2919 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2921 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2925 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2929 std::vector<int> multiVal;
2930 std::pair<int, std::pair<int,int> > slic;
2931 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2932 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2936 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
2938 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2940 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2942 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2946 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2948 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2950 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2951 if (!SWIG_IsOK(res1))
2954 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2955 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2959 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2961 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2962 da2->checkAllocated();
2963 int size=self->getNumberOfTuples();
2964 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
2966 PyObject *ret = PyList_New(3);
2967 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2968 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2969 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2973 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2976 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2977 if (!SWIG_IsOK(res1))
2980 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2981 return self->transformWithIndArrR(tmp,tmp+size);
2985 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2986 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2990 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2993 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
2994 if (!SWIG_IsOK(res1))
2997 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2998 if(size!=self->getNumberOfTuples())
3000 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3002 return self->renumberAndReduce(tmp,newNbOfTuple);
3006 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3008 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3009 da2->checkAllocated();
3010 int size=self->getNumberOfTuples();
3011 if(size!=self->getNumberOfTuples())
3013 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3015 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3019 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3022 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3023 if (!SWIG_IsOK(res1))
3026 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3027 if(size!=self->getNumberOfTuples())
3029 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3031 return self->renumber(tmp);
3035 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3037 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3038 da2->checkAllocated();
3039 int size=self->getNumberOfTuples();
3040 if(size!=self->getNumberOfTuples())
3042 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3044 return self->renumber(da2->getConstPointer());
3048 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3051 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3052 if (!SWIG_IsOK(res1))
3055 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3056 if(size!=self->getNumberOfTuples())
3058 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3060 return self->renumberR(tmp);
3064 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3066 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3067 da2->checkAllocated();
3068 int size=self->getNumberOfTuples();
3069 if(size!=self->getNumberOfTuples())
3071 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3073 return self->renumberR(da2->getConstPointer());
3077 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3079 std::vector<int> tmp;
3080 convertPyToNewIntArr3(li,tmp);
3081 self->setSelectedComponents(a,tmp);
3084 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3086 int sz=self->getNumberOfComponents();
3087 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3088 self->getTuple(tupleId,tmp);
3089 return convertIntArrToPyList(tmp,sz);
3092 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3094 DataArrayInt *arr=0;
3095 DataArrayInt *arrI=0;
3096 self->changeSurjectiveFormat(targetNb,arr,arrI);
3097 PyObject *res = PyList_New(2);
3098 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3099 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3103 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3105 std::vector<const DataArrayInt *> tmp;
3106 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3107 return DataArrayInt::Meld(tmp);
3110 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3112 std::vector<const DataArrayInt *> tmp;
3113 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3114 return DataArrayInt::Aggregate(tmp);
3117 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3119 std::vector<const DataArrayInt *> tmp;
3120 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3121 return DataArrayInt::AggregateIndexes(tmp);
3124 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3126 std::vector<const DataArrayInt *> tmp;
3127 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3128 return DataArrayInt::BuildUnion(tmp);
3131 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3133 std::vector<const DataArrayInt *> tmp;
3134 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3135 return DataArrayInt::BuildIntersection(tmp);
3138 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3141 int r1=self->getMaxValue(tmp);
3142 PyObject *ret=PyTuple_New(2);
3143 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3144 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3148 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3151 int r1=self->getMinValue(tmp);
3152 PyObject *ret=PyTuple_New(2);
3153 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3154 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3158 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3160 int nbOfCompo=self->getNumberOfComponents();
3165 if(PyInt_Check(obj))
3167 int val=(int)PyInt_AS_LONG(obj);
3168 return self->locateValue(val);
3171 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3175 std::vector<int> arr;
3176 convertPyToNewIntArr3(obj,arr);
3177 return self->locateTuple(arr);
3182 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3184 int nbOfCompo=self->getNumberOfComponents();
3191 if(PyInt_Check(obj))
3193 int val=(int)PyInt_AS_LONG(obj);
3194 return self->presenceOfValue(val);
3197 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3201 std::vector<int> arr;
3202 convertPyToNewIntArr3(obj,arr);
3203 return self->presenceOfTuple(arr);
3208 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3210 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3211 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3212 self->checkAllocated();
3213 int nbOfTuples=self->getNumberOfTuples();
3214 int nbOfComponents=self->getNumberOfComponents();
3216 std::vector<int> vt1,vc1;
3217 std::pair<int, std::pair<int,int> > pt1,pc1;
3218 DataArrayInt *dt1=0,*dc1=0;
3220 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3221 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3226 if(nbOfComponents==1)
3227 return PyInt_FromLong(self->getIJSafe(it1,0));
3228 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3231 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3233 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3235 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3237 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3240 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3241 std::vector<int> v2(1,ic1);
3242 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3246 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3247 std::vector<int> v2(1,ic1);
3248 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3252 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3253 std::vector<int> v2(1,ic1);
3254 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3258 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3259 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3263 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3264 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3268 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3269 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3273 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3274 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3278 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3279 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3280 std::vector<int> v2(nbOfComp);
3281 for(int i=0;i<nbOfComp;i++)
3282 v2[i]=pc1.first+i*pc1.second.second;
3283 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3287 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3288 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3289 std::vector<int> v2(nbOfComp);
3290 for(int i=0;i<nbOfComp;i++)
3291 v2[i]=pc1.first+i*pc1.second.second;
3292 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3296 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3297 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3298 std::vector<int> v2(nbOfComp);
3299 for(int i=0;i<nbOfComp;i++)
3300 v2[i]=pc1.first+i*pc1.second.second;
3301 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3305 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3306 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3307 std::vector<int> v2(nbOfComp);
3308 for(int i=0;i<nbOfComp;i++)
3309 v2[i]=pc1.first+i*pc1.second.second;
3310 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3313 throw INTERP_KERNEL::Exception(msg);
3317 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3319 self->checkAllocated();
3320 const char msg[]="Unexpected situation in __setitem__ !";
3321 int nbOfTuples=self->getNumberOfTuples();
3322 int nbOfComponents=self->getNumberOfComponents();
3325 std::vector<int> v1;
3327 DataArrayIntTuple *dd1=0;
3328 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3330 std::vector<int> vt1,vc1;
3331 std::pair<int, std::pair<int,int> > pt1,pc1;
3332 DataArrayInt *dt1=0,*dc1=0;
3333 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3334 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3342 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3345 tmp=DataArrayInt::New();
3346 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3347 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3350 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3353 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3354 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3357 throw INTERP_KERNEL::Exception(msg);
3366 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3369 tmp=DataArrayInt::New();
3370 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3371 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3374 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3377 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3378 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3381 throw INTERP_KERNEL::Exception(msg);
3390 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3393 tmp=DataArrayInt::New();
3394 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3395 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3398 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3401 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3402 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3405 throw INTERP_KERNEL::Exception(msg);
3414 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3417 tmp=DataArrayInt::New();
3418 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3419 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3422 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3425 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3426 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3429 throw INTERP_KERNEL::Exception(msg);
3438 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3441 tmp=DataArrayInt::New();
3442 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3443 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3446 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3449 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3450 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3453 throw INTERP_KERNEL::Exception(msg);
3462 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3465 tmp=DataArrayInt::New();
3466 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3467 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3470 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3473 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3474 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3477 throw INTERP_KERNEL::Exception(msg);
3486 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3489 tmp=DataArrayInt::New();
3490 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3491 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3494 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3497 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3498 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3501 throw INTERP_KERNEL::Exception(msg);
3510 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3513 tmp=DataArrayInt::New();
3514 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3515 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3518 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3521 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3522 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3525 throw INTERP_KERNEL::Exception(msg);
3534 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3537 tmp=DataArrayInt::New();
3538 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3539 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3542 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3545 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3546 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3549 throw INTERP_KERNEL::Exception(msg);
3558 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3561 tmp=DataArrayInt::New();
3562 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3563 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3566 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3569 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3570 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3573 throw INTERP_KERNEL::Exception(msg);
3582 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3585 tmp=DataArrayInt::New();
3586 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3587 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3590 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3593 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3594 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3597 throw INTERP_KERNEL::Exception(msg);
3606 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3609 tmp=DataArrayInt::New();
3610 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3611 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3614 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3617 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3618 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3621 throw INTERP_KERNEL::Exception(msg);
3630 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3633 tmp=DataArrayInt::New();
3634 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3635 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3638 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3641 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3642 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3645 throw INTERP_KERNEL::Exception(msg);
3654 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3657 tmp=DataArrayInt::New();
3658 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3659 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3662 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3665 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3666 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3669 throw INTERP_KERNEL::Exception(msg);
3678 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3681 tmp=DataArrayInt::New();
3682 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3683 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3686 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3689 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3690 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3693 throw INTERP_KERNEL::Exception(msg);
3702 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3705 tmp=DataArrayInt::New();
3706 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3707 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3710 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3713 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3714 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3717 throw INTERP_KERNEL::Exception(msg);
3722 throw INTERP_KERNEL::Exception(msg);
3727 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3729 return self->negate();
3732 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3734 const char msg[]="Unexpected situation in __add__ !";
3737 std::vector<int> aa;
3738 DataArrayIntTuple *aaa;
3740 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3745 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3746 ret->applyLin(1,val);
3751 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3752 return DataArrayInt::Add(self,aaaa);
3756 return DataArrayInt::Add(self,a);
3760 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3761 return DataArrayInt::Add(self,aaaa);
3764 throw INTERP_KERNEL::Exception(msg);
3768 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3770 const char msg[]="Unexpected situation in __radd__ !";
3773 std::vector<int> aa;
3774 DataArrayIntTuple *aaa;
3776 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3781 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3782 ret->applyLin(1,val);
3787 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3788 return DataArrayInt::Add(self,aaaa);
3792 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3793 return DataArrayInt::Add(self,aaaa);
3796 throw INTERP_KERNEL::Exception(msg);
3800 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3802 const char msg[]="Unexpected situation in __iadd__ !";
3805 std::vector<int> aa;
3806 DataArrayIntTuple *aaa;
3808 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3813 self->applyLin(1,val);
3814 Py_XINCREF(trueSelf);
3819 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3821 Py_XINCREF(trueSelf);
3827 Py_XINCREF(trueSelf);
3832 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3833 self->addEqual(aaaa);
3834 Py_XINCREF(trueSelf);
3838 throw INTERP_KERNEL::Exception(msg);
3842 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3844 const char msg[]="Unexpected situation in __sub__ !";
3847 std::vector<int> aa;
3848 DataArrayIntTuple *aaa;
3850 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3855 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3856 ret->applyLin(1,-val);
3861 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3862 return DataArrayInt::Substract(self,aaaa);
3866 return DataArrayInt::Substract(self,a);
3870 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3871 return DataArrayInt::Substract(self,aaaa);
3874 throw INTERP_KERNEL::Exception(msg);
3878 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3880 const char msg[]="Unexpected situation in __rsub__ !";
3883 std::vector<int> aa;
3884 DataArrayIntTuple *aaa;
3886 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3891 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3892 ret->applyLin(-1,val);
3897 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3898 return DataArrayInt::Substract(aaaa,self);
3902 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3903 return DataArrayInt::Substract(aaaa,self);
3906 throw INTERP_KERNEL::Exception(msg);
3910 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3912 const char msg[]="Unexpected situation in __isub__ !";
3915 std::vector<int> aa;
3916 DataArrayIntTuple *aaa;
3918 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3923 self->applyLin(1,-val);
3924 Py_XINCREF(trueSelf);
3929 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3930 self->substractEqual(bb);
3931 Py_XINCREF(trueSelf);
3936 self->substractEqual(a);
3937 Py_XINCREF(trueSelf);
3942 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3943 self->substractEqual(aaaa);
3944 Py_XINCREF(trueSelf);
3948 throw INTERP_KERNEL::Exception(msg);
3952 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3954 const char msg[]="Unexpected situation in __mul__ !";
3957 std::vector<int> aa;
3958 DataArrayIntTuple *aaa;
3960 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3965 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3966 ret->applyLin(val,0);
3971 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3972 return DataArrayInt::Multiply(self,aaaa);
3976 return DataArrayInt::Multiply(self,a);
3980 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3981 return DataArrayInt::Multiply(self,aaaa);
3984 throw INTERP_KERNEL::Exception(msg);
3988 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3990 const char msg[]="Unexpected situation in __rmul__ !";
3993 std::vector<int> aa;
3994 DataArrayIntTuple *aaa;
3996 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4001 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4002 ret->applyLin(val,0);
4007 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4008 return DataArrayInt::Multiply(self,aaaa);
4012 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4013 return DataArrayInt::Multiply(self,aaaa);
4016 throw INTERP_KERNEL::Exception(msg);
4020 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4022 const char msg[]="Unexpected situation in __imul__ !";
4025 std::vector<int> aa;
4026 DataArrayIntTuple *aaa;
4028 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4033 self->applyLin(val,0);
4034 Py_XINCREF(trueSelf);
4039 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4040 self->multiplyEqual(bb);
4041 Py_XINCREF(trueSelf);
4046 self->multiplyEqual(a);
4047 Py_XINCREF(trueSelf);
4052 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4053 self->multiplyEqual(aaaa);
4054 Py_XINCREF(trueSelf);
4058 throw INTERP_KERNEL::Exception(msg);
4062 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4064 const char msg[]="Unexpected situation in __div__ !";
4067 std::vector<int> aa;
4068 DataArrayIntTuple *aaa;
4070 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4075 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4076 ret->applyDivideBy(val);
4081 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4082 return DataArrayInt::Divide(self,aaaa);
4086 return DataArrayInt::Divide(self,a);
4090 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4091 return DataArrayInt::Divide(self,aaaa);
4094 throw INTERP_KERNEL::Exception(msg);
4098 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4100 const char msg[]="Unexpected situation in __rdiv__ !";
4103 std::vector<int> aa;
4104 DataArrayIntTuple *aaa;
4106 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4111 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4117 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4118 return DataArrayInt::Divide(aaaa,self);
4122 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4123 return DataArrayInt::Divide(aaaa,self);
4126 throw INTERP_KERNEL::Exception(msg);
4130 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4132 const char msg[]="Unexpected situation in __idiv__ !";
4135 std::vector<int> aa;
4136 DataArrayIntTuple *aaa;
4138 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4143 self->applyDivideBy(val);
4144 Py_XINCREF(trueSelf);
4149 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4150 self->divideEqual(bb);
4151 Py_XINCREF(trueSelf);
4156 self->divideEqual(a);
4157 Py_XINCREF(trueSelf);
4162 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4163 self->divideEqual(aaaa);
4164 Py_XINCREF(trueSelf);
4168 throw INTERP_KERNEL::Exception(msg);
4172 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4174 const char msg[]="Unexpected situation in __mod__ !";
4177 std::vector<int> aa;
4178 DataArrayIntTuple *aaa;
4180 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4185 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4186 ret->applyModulus(val);
4191 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4192 return DataArrayInt::Modulus(self,aaaa);
4196 return DataArrayInt::Modulus(self,a);
4200 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4201 return DataArrayInt::Modulus(self,aaaa);
4204 throw INTERP_KERNEL::Exception(msg);
4208 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4210 const char msg[]="Unexpected situation in __rmod__ !";
4213 std::vector<int> aa;
4214 DataArrayIntTuple *aaa;
4216 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4221 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4222 ret->applyRModulus(val);
4227 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4228 return DataArrayInt::Modulus(aaaa,self);
4232 return DataArrayInt::Modulus(a,self);
4236 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4237 return DataArrayInt::Modulus(aaaa,self);
4240 throw INTERP_KERNEL::Exception(msg);
4244 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4246 const char msg[]="Unexpected situation in __imod__ !";
4249 std::vector<int> aa;
4250 DataArrayIntTuple *aaa;
4252 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4257 self->applyModulus(val);
4258 Py_XINCREF(trueSelf);
4263 self->modulusEqual(a);
4264 Py_XINCREF(trueSelf);
4269 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4270 self->modulusEqual(aaaa);
4271 Py_XINCREF(trueSelf);
4275 throw INTERP_KERNEL::Exception(msg);
4279 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4281 const char msg[]="Unexpected situation in __pow__ !";
4284 std::vector<int> aa;
4285 DataArrayIntTuple *aaa;
4287 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4292 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4298 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4299 return DataArrayInt::Pow(self,aaaa);
4303 return DataArrayInt::Pow(self,a);
4307 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4308 return DataArrayInt::Pow(self,aaaa);
4311 throw INTERP_KERNEL::Exception(msg);
4315 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4317 const char msg[]="Unexpected situation in __rpow__ !";
4320 std::vector<int> aa;
4321 DataArrayIntTuple *aaa;
4323 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4328 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4329 ret->applyRPow(val);
4334 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4335 return DataArrayInt::Pow(aaaa,self);
4339 return DataArrayInt::Pow(a,self);
4343 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4344 return DataArrayInt::Pow(aaaa,self);
4347 throw INTERP_KERNEL::Exception(msg);
4351 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4353 const char msg[]="Unexpected situation in __ipow__ !";
4356 std::vector<int> aa;
4357 DataArrayIntTuple *aaa;
4359 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4364 self->applyPow(val);
4365 Py_XINCREF(trueSelf);
4371 Py_XINCREF(trueSelf);
4376 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4377 self->powEqual(aaaa);
4378 Py_XINCREF(trueSelf);
4382 throw INTERP_KERNEL::Exception(msg);
4386 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4388 std::ostringstream oss;
4389 self->reprQuickOverview(oss);
4393 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4395 int szArr,sw,iTypppArr;
4396 std::vector<int> stdvecTyyppArr;
4397 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4398 self->pushBackValsSilent(tmp,tmp+szArr);
4401 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4403 std::vector<int> ret1;
4404 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4405 std::size_t sz=ret0.size();
4406 PyObject *pyRet=PyTuple_New(2);
4407 PyObject *pyRet0=PyList_New((int)sz);
4408 PyObject *pyRet1=PyList_New((int)sz);
4409 for(std::size_t i=0;i<sz;i++)
4411 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4412 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4414 PyTuple_SetItem(pyRet,0,pyRet0);
4415 PyTuple_SetItem(pyRet,1,pyRet1);
4419 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4421 DataArrayInt *ret0=0,*ret1=0;
4422 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4423 PyObject *pyRet=PyTuple_New(2);
4424 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4425 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4431 class DataArrayIntTuple;
4433 class DataArrayIntIterator
4436 DataArrayIntIterator(DataArrayInt *da);
4437 ~DataArrayIntIterator();
4442 DataArrayIntTuple *ret=self->nextt();
4444 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4447 PyErr_SetString(PyExc_StopIteration,"No more data.");
4454 class DataArrayIntTuple
4457 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4458 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4461 std::string __str__() const throw(INTERP_KERNEL::Exception)
4463 return self->repr();
4466 int __int__() const throw(INTERP_KERNEL::Exception)
4468 return self->intValue();
4471 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4473 return self->buildDAInt(1,self->getNumberOfCompo());
4476 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4478 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4479 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4480 Py_XINCREF(trueSelf);
4484 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4486 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4487 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4488 Py_XINCREF(trueSelf);
4492 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4494 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4495 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4496 Py_XINCREF(trueSelf);
4500 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4502 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4503 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4504 Py_XINCREF(trueSelf);
4508 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4510 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4511 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4512 Py_XINCREF(trueSelf);
4516 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4518 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4521 std::vector<int> multiVal;
4522 std::pair<int, std::pair<int,int> > slic;
4523 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4524 const int *pt=self->getConstPointer();
4525 int nbc=self->getNumberOfCompo();
4526 convertObjToPossibleCpp2(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4533 std::ostringstream oss;
4534 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4535 throw INTERP_KERNEL::Exception(oss.str().c_str());
4538 return PyInt_FromLong(pt[singleVal]);
4542 return PyInt_FromLong(pt[nbc+singleVal]);
4545 std::ostringstream oss;
4546 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4547 throw INTERP_KERNEL::Exception(oss.str().c_str());
4553 PyObject *t=PyTuple_New(multiVal.size());
4554 for(int j=0;j<(int)multiVal.size();j++)
4556 int cid=multiVal[j];
4559 std::ostringstream oss;
4560 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4561 throw INTERP_KERNEL::Exception(oss.str().c_str());
4563 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4569 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4570 PyObject *t=PyTuple_New(sz);
4571 for(int j=0;j<sz;j++)
4572 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4576 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4580 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4582 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4583 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4586 std::vector<int> multiValV;
4587 std::pair<int, std::pair<int,int> > slicV;
4588 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4589 int nbc=self->getNumberOfCompo();
4590 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4592 std::vector<int> multiVal;
4593 std::pair<int, std::pair<int,int> > slic;
4594 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4595 int *pt=self->getPointer();
4596 convertObjToPossibleCpp2(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4603 std::ostringstream oss;
4604 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4605 throw INTERP_KERNEL::Exception(oss.str().c_str());
4611 pt[singleVal]=singleValV;
4616 if(multiValV.size()!=1)
4618 std::ostringstream oss;
4619 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4620 throw INTERP_KERNEL::Exception(oss.str().c_str());
4622 pt[singleVal]=multiValV[0];
4627 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4631 throw INTERP_KERNEL::Exception(msg);
4640 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4644 std::ostringstream oss;
4645 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4646 throw INTERP_KERNEL::Exception(oss.str().c_str());
4654 if(multiVal.size()!=multiValV.size())
4656 std::ostringstream oss;
4657 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4658 throw INTERP_KERNEL::Exception(oss.str().c_str());
4660 for(int i=0;i<(int)multiVal.size();i++)
4662 int pos=multiVal[i];
4665 std::ostringstream oss;
4666 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4667 throw INTERP_KERNEL::Exception(oss.str().c_str());
4669 pt[multiVal[i]]=multiValV[i];
4675 const int *ptV=daIntTyyppV->getConstPointer();
4676 if(nbc>daIntTyyppV->getNumberOfCompo())
4678 std::ostringstream oss;
4679 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4680 throw INTERP_KERNEL::Exception(oss.str().c_str());
4682 std::copy(ptV,ptV+nbc,pt);
4686 throw INTERP_KERNEL::Exception(msg);
4691 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4696 for(int j=0;j<sz;j++)
4697 pt[slic.first+j*slic.second.second]=singleValV;
4702 if(sz!=(int)multiValV.size())
4704 std::ostringstream oss;
4705 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
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]=multiValV[j];
4714 const int *ptV=daIntTyyppV->getConstPointer();
4715 if(sz>daIntTyyppV->getNumberOfCompo())
4717 std::ostringstream oss;
4718 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4719 throw INTERP_KERNEL::Exception(oss.str().c_str());
4721 for(int j=0;j<sz;j++)
4722 pt[slic.first+j*slic.second.second]=ptV[j];
4726 throw INTERP_KERNEL::Exception(msg);
4730 throw INTERP_KERNEL::Exception(msg);
4736 class DataArrayChar : public DataArray
4739 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4740 int getHashCode() const throw(INTERP_KERNEL::Exception);
4741 bool empty() const throw(INTERP_KERNEL::Exception);
4742 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4743 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4744 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4745 char popBackSilent() throw(INTERP_KERNEL::Exception);
4746 void pack() const throw(INTERP_KERNEL::Exception);
4747 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4748 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4749 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4750 void reverse() throw(INTERP_KERNEL::Exception);
4751 void fillWithZero() throw(INTERP_KERNEL::Exception);
4752 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4753 std::string repr() const throw(INTERP_KERNEL::Exception);
4754 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4755 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4756 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4757 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4758 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4759 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4760 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4761 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4762 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4763 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4764 char front() const throw(INTERP_KERNEL::Exception);
4765 char back() const throw(INTERP_KERNEL::Exception);
4766 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4767 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4768 char *getPointer() throw(INTERP_KERNEL::Exception);
4769 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4770 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4771 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4772 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4773 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4774 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4775 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4776 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4777 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4778 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4779 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4782 int __len__() const throw(INTERP_KERNEL::Exception)
4784 if(self->isAllocated())
4786 return self->getNumberOfTuples();
4790 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4794 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4797 bool ret0=self->isEqualIfNotWhy(other,ret1);
4798 PyObject *ret=PyTuple_New(2);
4799 PyObject *ret0Py=ret0?Py_True:Py_False;
4801 PyTuple_SetItem(ret,0,ret0Py);
4802 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4806 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4809 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4810 if (!SWIG_IsOK(res1))
4813 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4814 if(size!=self->getNumberOfTuples())
4816 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4818 return self->renumber(tmp);
4822 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4824 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4825 da2->checkAllocated();
4826 int size=self->getNumberOfTuples();
4827 if(size!=self->getNumberOfTuples())
4829 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4831 return self->renumber(da2->getConstPointer());
4835 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4838 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4839 if (!SWIG_IsOK(res1))
4842 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4843 if(size!=self->getNumberOfTuples())
4845 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4847 return self->renumberR(tmp);
4851 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4853 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4854 da2->checkAllocated();
4855 int size=self->getNumberOfTuples();
4856 if(size!=self->getNumberOfTuples())
4858 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4860 return self->renumberR(da2->getConstPointer());
4864 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4867 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
4868 if (!SWIG_IsOK(res1))
4871 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4872 if(size!=self->getNumberOfTuples())
4874 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4876 return self->renumberAndReduce(tmp,newNbOfTuple);
4880 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4882 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4883 da2->checkAllocated();
4884 int size=self->getNumberOfTuples();
4885 if(size!=self->getNumberOfTuples())
4887 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4889 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4893 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4895 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4896 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4897 return DataArrayChar::Aggregate(tmp);
4900 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4902 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
4903 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
4904 return DataArrayChar::Meld(tmp);
4909 class DataArrayByteIterator;
4911 class DataArrayByte : public DataArrayChar
4914 static DataArrayByte *New();
4915 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4916 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
4917 char byteValue() const throw(INTERP_KERNEL::Exception);
4920 DataArrayByte() throw(INTERP_KERNEL::Exception)
4922 return DataArrayByte::New();
4925 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4927 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) !";
4928 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4932 if(PyInt_Check(nbOfTuples))
4934 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4936 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4939 if(PyInt_Check(nbOfComp))
4940 {//DataArrayByte.New([1,3,4,5],2,2)
4941 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4943 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4944 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4945 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4946 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4950 throw INTERP_KERNEL::Exception(msg);
4953 {//DataArrayByte.New([1,3,4],3)
4954 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4956 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4957 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4962 throw INTERP_KERNEL::Exception(msg);
4965 {// DataArrayByte.New([1,3,4])
4966 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4967 int tmpp1=-1,tmpp2=-1;
4968 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4969 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4973 else if(PyInt_Check(elt0))
4975 int nbOfTuples1=PyInt_AS_LONG(elt0);
4977 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4982 if(PyInt_Check(nbOfTuples))
4983 {//DataArrayByte.New(5,2)
4984 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4986 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4987 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
4988 ret->alloc(nbOfTuples1,nbOfCompo);
4992 throw INTERP_KERNEL::Exception(msg);
4995 throw INTERP_KERNEL::Exception(msg);
4998 {//DataArrayByte.New(5)
4999 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5000 ret->alloc(nbOfTuples1,1);
5005 throw INTERP_KERNEL::Exception(msg);
5008 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5010 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5013 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5015 std::ostringstream oss;
5016 self->reprQuickOverview(oss);
5020 int __int__() const throw(INTERP_KERNEL::Exception)
5022 return (int) self->byteValue();
5025 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5027 return self->iterator();
5030 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5032 return (int)self->getIJ(tupleId,compoId);
5035 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5037 return (int)self->getIJSafe(tupleId,compoId);
5040 std::string __str__() const throw(INTERP_KERNEL::Exception)
5042 return self->repr();
5045 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5047 const char *vals=self->getConstPointer();
5048 int nbOfComp=self->getNumberOfComponents();
5049 int nbOfTuples=self->getNumberOfTuples();
5050 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5053 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5056 int ival=-1; std::vector<int> ivval;
5057 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5058 std::vector<char> vals(sz);
5059 std::copy(pt,pt+sz,vals.begin());
5060 return self->presenceOfTuple(vals);
5063 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5066 int ival=-1; std::vector<int> ivval;
5067 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5068 std::vector<char> vals2(sz);
5069 std::copy(pt,pt+sz,vals2.begin());
5070 return self->presenceOfValue(vals2);
5073 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5076 int ival=-1; std::vector<int> ivval;
5077 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5078 std::vector<char> vals2(sz);
5079 std::copy(pt,pt+sz,vals2.begin());
5080 return self->locateValue(vals2);
5083 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5086 int ival=-1; std::vector<int> ivval;
5087 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5088 std::vector<char> vals(sz);
5089 std::copy(pt,pt+sz,vals.begin());
5090 return self->locateTuple(vals);
5093 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5096 int ival=-1; std::vector<int> ivval;
5097 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5098 std::vector<char> vals(sz);
5099 std::copy(pt,pt+sz,vals.begin());
5100 return self->search(vals);
5103 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5105 int sz=self->getNumberOfComponents();
5106 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5107 self->getTuple(tupleId,tmp);
5108 PyObject *ret=PyTuple_New(sz);
5109 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5113 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5116 int r1=(int)self->getMaxValue(tmp);
5117 PyObject *ret=PyTuple_New(2);
5118 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5119 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5123 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5126 int r1=(int)self->getMinValue(tmp);
5127 PyObject *ret=PyTuple_New(2);
5128 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5129 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5133 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5135 int nbOfCompo=self->getNumberOfComponents();
5140 if(PyInt_Check(obj))
5142 int val=(int)PyInt_AS_LONG(obj);
5143 return self->locateValue(val);
5146 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5149 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5153 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5155 int nbOfCompo=self->getNumberOfComponents();
5162 if(PyInt_Check(obj))
5164 int val=(int)PyInt_AS_LONG(obj);
5165 return self->presenceOfValue(val);
5168 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5171 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5177 class DataArrayByteTuple;
5179 class DataArrayByteIterator
5182 DataArrayByteIterator(DataArrayByte *da);
5183 ~DataArrayByteIterator();
5186 class DataArrayByteTuple
5189 std::string repr() const throw(INTERP_KERNEL::Exception);
5190 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5193 std::string __str__() const throw(INTERP_KERNEL::Exception)
5195 return self->repr();
5198 char __int__() const throw(INTERP_KERNEL::Exception)
5200 return self->byteValue();
5203 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5205 return self->buildDAByte(1,self->getNumberOfCompo());
5210 class DataArrayAsciiCharIterator;
5212 class DataArrayAsciiChar : public DataArrayChar
5215 static DataArrayAsciiChar *New();
5216 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5217 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5218 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5221 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5223 return DataArrayAsciiChar::New();
5226 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5228 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) !";
5229 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5233 if(PyInt_Check(nbOfTuples))
5235 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5237 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5240 if(PyInt_Check(nbOfComp))
5241 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5242 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5244 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5245 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5246 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5247 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5251 throw INTERP_KERNEL::Exception(msg);
5254 {//DataArrayAsciiChar.New([1,3,4],3)
5255 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5257 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5258 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5262 else if(PyString_Check(nbOfTuples))
5264 if(PyString_Size(nbOfTuples)!=1)
5265 throw INTERP_KERNEL::Exception(msg);
5266 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5267 std::vector<std::string> tmp;
5268 if(fillStringVector(elt0,tmp))
5269 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5271 throw INTERP_KERNEL::Exception(msg);
5274 throw INTERP_KERNEL::Exception(msg);
5278 std::vector<std::string> tmmp;
5279 if(fillStringVector(elt0,tmmp))
5280 //DataArrayAsciiChar.New(["abc","de","fghi"])
5281 return DataArrayAsciiChar::New(tmmp,' ');
5284 // DataArrayAsciiChar.New([1,3,4])
5285 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5286 int tmpp1=-1,tmpp2=-1;
5287 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5288 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5293 else if(PyInt_Check(elt0))
5295 int nbOfTuples1=PyInt_AS_LONG(elt0);
5297 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5302 if(PyInt_Check(nbOfTuples))
5303 {//DataArrayAsciiChar.New(5,2)
5304 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5306 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5307 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5308 ret->alloc(nbOfTuples1,nbOfCompo);
5312 throw INTERP_KERNEL::Exception(msg);
5315 throw INTERP_KERNEL::Exception(msg);
5318 {//DataArrayAsciiChar.New(5)
5319 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5320 ret->alloc(nbOfTuples1,1);
5325 throw INTERP_KERNEL::Exception(msg);
5328 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5330 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5333 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5335 std::ostringstream oss;
5336 self->reprQuickOverview(oss);
5340 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5342 return self->iterator();
5345 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5347 char tmp[2]; tmp[1]='\0';
5348 tmp[0]=self->getIJ(tupleId,compoId);
5349 return std::string(tmp);
5352 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5354 char tmp[2]; tmp[1]='\0';
5355 tmp[0]=self->getIJSafe(tupleId,compoId);
5356 return std::string(tmp);
5359 std::string __str__() const throw(INTERP_KERNEL::Exception)
5361 return self->repr();
5364 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5366 const char *vals=self->getConstPointer();
5367 int nbOfComp=self->getNumberOfComponents();
5368 int nbOfTuples=self->getNumberOfTuples();
5369 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5372 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5374 if(PyString_Check(tupl))
5376 Py_ssize_t sz=PyString_Size(tupl);
5377 std::vector<char> vals(sz);
5378 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5379 return self->presenceOfTuple(vals);
5382 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5385 bool presenceOfValue(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->presenceOfValue(vals2);
5395 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5398 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5400 if(PyString_Check(vals))
5402 Py_ssize_t sz=PyString_Size(vals);
5403 std::vector<char> vals2(sz);
5404 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5405 return self->locateValue(vals2);
5408 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5411 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5413 if(PyString_Check(tupl))
5415 Py_ssize_t sz=PyString_Size(tupl);
5416 std::vector<char> vals(sz);
5417 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5418 return self->locateTuple(vals);
5421 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5424 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5426 if(PyString_Check(strOrListOfInt))
5428 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5429 std::vector<char> vals(sz);
5430 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5431 return self->search(vals);
5434 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5437 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5439 int sz=self->getNumberOfComponents();
5440 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5441 self->getTuple(tupleId,tmp);
5442 return PyString_FromString(tmp);
5445 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5448 char tmp2[2]; tmp2[1]='\0';
5449 tmp2[0]=self->getMaxValue(tmp);
5450 PyObject *ret=PyTuple_New(2);
5451 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5452 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5456 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5459 char tmp2[2]; tmp2[1]='\0';
5460 tmp2[0]=self->getMinValue(tmp);
5461 PyObject *ret=PyTuple_New(2);
5462 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5463 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5467 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5469 int nbOfCompo=self->getNumberOfComponents();
5474 if(PyString_Check(obj))
5476 Py_ssize_t sz=PyString_Size(obj);
5477 char *pt=PyString_AsString(obj);
5479 return self->locateValue(pt[0]);
5481 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5484 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5487 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5491 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5493 int nbOfCompo=self->getNumberOfComponents();
5500 if(PyString_Check(obj))
5502 Py_ssize_t sz=PyString_Size(obj);
5503 char *pt=PyString_AsString(obj);
5505 return self->presenceOfValue(pt[0]);
5507 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5510 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5513 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5517 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5520 std::vector<int> stdvecTyyppArr;
5521 std::pair<int, std::pair<int,int> > sTyyppArr;
5522 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5523 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5527 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5529 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5531 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5533 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5535 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5539 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5541 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.";
5543 std::vector<int> stdvecTyyppArr;
5544 std::pair<int, std::pair<int,int> > sTyyppArr;
5545 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5546 int nbOfCompo=self->getNumberOfComponents();
5547 int nbOfTuples=self->getNumberOfTuples();
5548 convertObjToPossibleCpp2(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5550 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5551 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5560 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5566 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5567 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5570 //value vector<string>
5573 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5574 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5577 //value DataArrayChar
5580 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5584 throw INTERP_KERNEL::Exception(msg);
5588 {//obj list-tuple[int]
5594 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5600 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5601 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5604 //value vector<string>
5607 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5608 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5611 //value DataArrayChar
5614 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5618 throw INTERP_KERNEL::Exception(msg);
5629 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5635 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5636 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5639 //value vector<string>
5642 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5643 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5646 //value DataArrayChar
5649 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5653 throw INTERP_KERNEL::Exception(msg);
5664 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5670 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5671 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5674 //value vector<string>
5677 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5678 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5681 //value DataArrayChar
5684 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5688 throw INTERP_KERNEL::Exception(msg);
5693 throw INTERP_KERNEL::Exception(msg);
5699 class DataArrayAsciiCharTuple;
5701 class DataArrayAsciiCharIterator
5704 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5705 ~DataArrayAsciiCharIterator();
5710 DataArrayAsciiCharTuple *ret=self->nextt();
5712 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5715 PyErr_SetString(PyExc_StopIteration,"No more data.");
5722 class DataArrayAsciiCharTuple
5725 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5726 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5729 std::string __str__() const throw(INTERP_KERNEL::Exception)
5731 return self->repr();
5734 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5736 return self->buildDAAsciiChar(1,self->getNumberOfCompo());