1 // Copyright (C) 2007-2015 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, or (at your option) any later version.
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::getIdsEqualTuple;
71 %newobject ParaMEDMEM::DataArrayInt::sumPerTuple;
72 %newobject ParaMEDMEM::DataArrayInt::negate;
73 %newobject ParaMEDMEM::DataArrayInt::computeAbs;
74 %newobject ParaMEDMEM::DataArrayInt::getIdsInRange;
75 %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange;
76 %newobject ParaMEDMEM::DataArrayInt::getIdsStrictlyNegative;
77 %newobject ParaMEDMEM::DataArrayInt::Aggregate;
78 %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes;
79 %newobject ParaMEDMEM::DataArrayInt::Meld;
80 %newobject ParaMEDMEM::DataArrayInt::Add;
81 %newobject ParaMEDMEM::DataArrayInt::Substract;
82 %newobject ParaMEDMEM::DataArrayInt::Multiply;
83 %newobject ParaMEDMEM::DataArrayInt::Divide;
84 %newobject ParaMEDMEM::DataArrayInt::Pow;
85 %newobject ParaMEDMEM::DataArrayInt::BuildUnion;
86 %newobject ParaMEDMEM::DataArrayInt::BuildIntersection;
87 %newobject ParaMEDMEM::DataArrayInt::Range;
88 %newobject ParaMEDMEM::DataArrayInt::fromNoInterlace;
89 %newobject ParaMEDMEM::DataArrayInt::toNoInterlace;
90 %newobject ParaMEDMEM::DataArrayInt::buildComplement;
91 %newobject ParaMEDMEM::DataArrayInt::buildUnion;
92 %newobject ParaMEDMEM::DataArrayInt::buildSubstraction;
93 %newobject ParaMEDMEM::DataArrayInt::buildSubstractionOptimized;
94 %newobject ParaMEDMEM::DataArrayInt::buildIntersection;
95 %newobject ParaMEDMEM::DataArrayInt::buildUnique;
96 %newobject ParaMEDMEM::DataArrayInt::buildUniqueNotSorted;
97 %newobject ParaMEDMEM::DataArrayInt::deltaShiftIndex;
98 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrByRanges;
99 %newobject ParaMEDMEM::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
100 %newobject ParaMEDMEM::DataArrayInt::findRangeIdForEachTuple;
101 %newobject ParaMEDMEM::DataArrayInt::findIdInRangeForEachTuple;
102 %newobject ParaMEDMEM::DataArrayInt::duplicateEachTupleNTimes;
103 %newobject ParaMEDMEM::DataArrayInt::buildPermutationArr;
104 %newobject ParaMEDMEM::DataArrayInt::buildPermArrPerLevel;
105 %newobject ParaMEDMEM::DataArrayInt::getDifferentValues;
106 %newobject ParaMEDMEM::DataArrayInt::FindPermutationFromFirstToSecond;
107 %newobject ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation;
108 %newobject ParaMEDMEM::DataArrayInt::__neg__;
109 %newobject ParaMEDMEM::DataArrayInt::__add__;
110 %newobject ParaMEDMEM::DataArrayInt::__radd__;
111 %newobject ParaMEDMEM::DataArrayInt::__sub__;
112 %newobject ParaMEDMEM::DataArrayInt::__rsub__;
113 %newobject ParaMEDMEM::DataArrayInt::__mul__;
114 %newobject ParaMEDMEM::DataArrayInt::__rmul__;
115 %newobject ParaMEDMEM::DataArrayInt::__div__;
116 %newobject ParaMEDMEM::DataArrayInt::__rdiv__;
117 %newobject ParaMEDMEM::DataArrayInt::__mod__;
118 %newobject ParaMEDMEM::DataArrayInt::__rmod__;
119 %newobject ParaMEDMEM::DataArrayInt::__pow__;
120 %newobject ParaMEDMEM::DataArrayInt::__rpow__;
121 %newobject ParaMEDMEM::DataArrayIntTuple::buildDAInt;
122 %newobject ParaMEDMEM::DataArrayChar::convertToIntArr;
123 %newobject ParaMEDMEM::DataArrayChar::renumber;
124 %newobject ParaMEDMEM::DataArrayChar::renumberR;
125 %newobject ParaMEDMEM::DataArrayChar::renumberAndReduce;
126 %newobject ParaMEDMEM::DataArrayChar::changeNbOfComponents;
127 %newobject ParaMEDMEM::DataArrayChar::getIdsEqual;
128 %newobject ParaMEDMEM::DataArrayChar::getIdsNotEqual;
129 %newobject ParaMEDMEM::DataArrayChar::Aggregate;
130 %newobject ParaMEDMEM::DataArrayChar::Meld;
131 %newobject ParaMEDMEM::DataArrayByte::New;
132 %newobject ParaMEDMEM::DataArrayByte::__iter__;
133 %newobject ParaMEDMEM::DataArrayByte::performCpy;
134 %newobject ParaMEDMEM::DataArrayByteTuple::buildDAByte;
135 %newobject ParaMEDMEM::DataArrayChar::substr;
136 %newobject ParaMEDMEM::DataArrayAsciiChar::New;
137 %newobject ParaMEDMEM::DataArrayAsciiChar::__iter__;
138 %newobject ParaMEDMEM::DataArrayAsciiChar::performCpy;
139 %newobject ParaMEDMEM::DataArrayAsciiCharTuple::buildDAAsciiChar;
140 %newobject ParaMEDMEM::DataArrayDouble::New;
141 %newobject ParaMEDMEM::DataArrayDouble::__iter__;
142 %newobject ParaMEDMEM::DataArrayDouble::convertToIntArr;
143 %newobject ParaMEDMEM::DataArrayDouble::performCpy;
144 %newobject ParaMEDMEM::DataArrayDouble::Aggregate;
145 %newobject ParaMEDMEM::DataArrayDouble::Meld;
146 %newobject ParaMEDMEM::DataArrayDouble::Dot;
147 %newobject ParaMEDMEM::DataArrayDouble::CrossProduct;
148 %newobject ParaMEDMEM::DataArrayDouble::Add;
149 %newobject ParaMEDMEM::DataArrayDouble::Substract;
150 %newobject ParaMEDMEM::DataArrayDouble::Multiply;
151 %newobject ParaMEDMEM::DataArrayDouble::Divide;
152 %newobject ParaMEDMEM::DataArrayDouble::Pow;
153 %newobject ParaMEDMEM::DataArrayDouble::substr;
154 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
155 %newobject ParaMEDMEM::DataArrayDouble::accumulatePerChunck;
156 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
157 %newobject ParaMEDMEM::DataArrayDouble::getIdsNotInRange;
158 %newobject ParaMEDMEM::DataArrayDouble::negate;
159 %newobject ParaMEDMEM::DataArrayDouble::computeAbs;
160 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
161 %newobject ParaMEDMEM::DataArrayDouble::applyFunc2;
162 %newobject ParaMEDMEM::DataArrayDouble::applyFunc3;
163 %newobject ParaMEDMEM::DataArrayDouble::doublyContractedProduct;
164 %newobject ParaMEDMEM::DataArrayDouble::determinant;
165 %newobject ParaMEDMEM::DataArrayDouble::eigenValues;
166 %newobject ParaMEDMEM::DataArrayDouble::eigenVectors;
167 %newobject ParaMEDMEM::DataArrayDouble::inverse;
168 %newobject ParaMEDMEM::DataArrayDouble::trace;
169 %newobject ParaMEDMEM::DataArrayDouble::deviator;
170 %newobject ParaMEDMEM::DataArrayDouble::magnitude;
171 %newobject ParaMEDMEM::DataArrayDouble::maxPerTuple;
172 %newobject ParaMEDMEM::DataArrayDouble::sumPerTuple;
173 %newobject ParaMEDMEM::DataArrayDouble::computeBBoxPerTuple;
174 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
175 %newobject ParaMEDMEM::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
176 %newobject ParaMEDMEM::DataArrayDouble::renumber;
177 %newobject ParaMEDMEM::DataArrayDouble::renumberR;
178 %newobject ParaMEDMEM::DataArrayDouble::renumberAndReduce;
179 %newobject ParaMEDMEM::DataArrayDouble::fromNoInterlace;
180 %newobject ParaMEDMEM::DataArrayDouble::toNoInterlace;
181 %newobject ParaMEDMEM::DataArrayDouble::fromPolarToCart;
182 %newobject ParaMEDMEM::DataArrayDouble::fromCylToCart;
183 %newobject ParaMEDMEM::DataArrayDouble::fromSpherToCart;
184 %newobject ParaMEDMEM::DataArrayDouble::cartesianize;
185 %newobject ParaMEDMEM::DataArrayDouble::getDifferentValues;
186 %newobject ParaMEDMEM::DataArrayDouble::findClosestTupleId;
187 %newobject ParaMEDMEM::DataArrayDouble::computeNbOfInteractionsWith;
188 %newobject ParaMEDMEM::DataArrayDouble::duplicateEachTupleNTimes;
189 %newobject ParaMEDMEM::DataArrayDouble::__neg__;
190 %newobject ParaMEDMEM::DataArrayDouble::__radd__;
191 %newobject ParaMEDMEM::DataArrayDouble::__rsub__;
192 %newobject ParaMEDMEM::DataArrayDouble::__rmul__;
193 %newobject ParaMEDMEM::DataArrayDouble::__rdiv__;
194 %newobject ParaMEDMEM::DataArrayDouble::__pow__;
195 %newobject ParaMEDMEM::DataArrayDouble::__rpow__;
196 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
198 %feature("unref") DataArray "$this->decrRef();"
199 %feature("unref") DataArrayDouble "$this->decrRef();"
200 %feature("unref") DataArrayInt "$this->decrRef();"
201 %feature("unref") DataArrayChar "$this->decrRef();"
202 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
203 %feature("unref") DataArrayByte "$this->decrRef();"
212 } MEDCouplingAxisType;
214 class DataArray : public RefCountObject, public TimeLabel
217 void setName(const std::string& name);
218 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
219 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
220 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
221 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
222 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
223 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
224 std::string getName() const;
225 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
226 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
227 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
228 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
229 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
230 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
231 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
232 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
233 int getNumberOfComponents() const;
234 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
235 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
236 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
237 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
238 virtual void desallocate() throw(INTERP_KERNEL::Exception);
239 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
240 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
241 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
242 virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
243 virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
244 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
245 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
246 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
247 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
248 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
249 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
250 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
251 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
252 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
253 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
254 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
255 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
256 static std::string GetAxTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
257 void updateTime() const;
260 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
262 const std::vector<std::string>& comps=self->getInfoOnComponents();
263 PyObject *ret=PyList_New((int)comps.size());
264 for(int i=0;i<(int)comps.size();i++)
265 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
269 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
271 std::vector<int> tmp;
272 convertPyToNewIntArr3(li,tmp);
273 self->copyPartOfStringInfoFrom(other,tmp);
276 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
278 std::vector<int> tmp;
279 convertPyToNewIntArr3(li,tmp);
280 self->copyPartOfStringInfoFrom2(tmp,other);
283 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
286 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
287 if (!SWIG_IsOK(res1))
290 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
291 if(size!=self->getNumberOfTuples())
293 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
295 self->renumberInPlace(tmp);
299 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
301 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
302 da2->checkAllocated();
303 int size=self->getNumberOfTuples();
304 if(size!=self->getNumberOfTuples())
306 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
308 self->renumberInPlace(da2->getConstPointer());
312 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
315 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
316 if (!SWIG_IsOK(res1))
319 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
320 if(size!=self->getNumberOfTuples())
322 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
324 self->renumberInPlaceR(tmp);
328 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
330 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
331 da2->checkAllocated();
332 int size=self->getNumberOfTuples();
333 if(size!=self->getNumberOfTuples())
335 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
337 self->renumberInPlaceR(da2->getConstPointer());
341 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
342 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
344 static const char msg[]="DataArray::setContigPartOfSelectedValues2 : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
345 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 3rd parameter \"aBase\" should be of type DataArray");
346 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
347 DataArrayInt *tuplesSelecPtr2=0;
350 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
352 throw INTERP_KERNEL::Exception(msg);
354 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
357 virtual void setContigPartOfSelectedValues2(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
359 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValues2 : 2nd parameter \"aBase\" should be of type DataArray");
360 self->setContigPartOfSelectedValues2(tupleIdStart,a,bg,end2,step);
363 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
365 std::vector<std::pair<int,int> > ranges;
366 convertPyToVectorPairInt(li,ranges);
367 return self->selectByTupleRanges(ranges);
370 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
373 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
374 if (!SWIG_IsOK(res1))
377 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
378 return self->selectByTupleId(tmp,tmp+size);
382 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
384 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
385 da2->checkAllocated();
386 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
390 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
393 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
394 if (!SWIG_IsOK(res1))
397 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
398 return self->selectByTupleIdSafe(tmp,tmp+size);
402 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
404 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
405 da2->checkAllocated();
406 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
410 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
412 std::vector<int> tmp;
413 convertPyToNewIntArr3(li,tmp);
414 DataArray *ret=self->keepSelectedComponents(tmp);
415 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
418 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
420 if(!PySlice_Check(slic))
421 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
422 Py_ssize_t strt=2,stp=2,step=2;
423 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
424 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
426 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
427 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
430 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
432 if(!PySlice_Check(slic))
433 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
434 Py_ssize_t strt=2,stp=2,step=2;
435 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
436 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
438 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
439 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
442 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
444 if(!PySlice_Check(slic))
445 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
446 Py_ssize_t strt=2,stp=2,step=2;
447 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
448 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
449 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
452 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
454 if(!PySlice_Check(slic))
455 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
456 Py_ssize_t strt=2,stp=2,step=2;
457 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
458 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
459 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
462 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
464 std::vector<const DataArray *> tmp;
465 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArray *>(arrs,SWIGTYPE_p_ParaMEDMEM__DataArray,"DataArray",tmp);
466 return DataArray::Aggregate(tmp);
469 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
471 if(!PySlice_Check(slic))
472 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
473 Py_ssize_t strt=2,stp=2,step=2;
474 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
475 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
476 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
479 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
481 if(!PySlice_Check(slic))
482 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
483 Py_ssize_t strt=2,stp=2,step=2;
484 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
485 GetIndicesOfSlice(sly,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
486 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
489 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
491 PyObject *ret(PyTuple_New(2));
492 std::string a0(self->getName());
493 const std::vector<std::string> &a1(self->getInfoOnComponents());
494 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
497 PyObject *ret1(PyList_New(sz));
498 for(int i=0;i<sz;i++)
499 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
500 PyTuple_SetItem(ret,1,ret1);
505 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
507 static const char MSG[]="DataArrayDouble.__setstate__ : expected input is a tuple of size 2 with string as 1st arg and list of string as 2nd arg !";
508 if(!PyTuple_Check(inp))
509 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
510 int sz(PyTuple_Size(inp));
512 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
513 PyObject *a0(PyTuple_GetItem(inp,0));
514 if(!PyString_Check(a0))
515 throw INTERP_KERNEL::Exception(MSG);
516 PyObject *a1(PyTuple_GetItem(inp,1));
517 std::vector<std::string> a1cpp;
518 if(!fillStringVector(a1,a1cpp))
519 throw INTERP_KERNEL::Exception(MSG);
520 self->setName(PyString_AsString(a0));
521 self->setInfoOnComponents(a1cpp);
527 class DataArrayDoubleIterator;
529 class DataArrayDouble : public DataArray
532 static DataArrayDouble *New();
533 double doubleValue() const throw(INTERP_KERNEL::Exception);
534 bool empty() const throw(INTERP_KERNEL::Exception);
535 DataArrayDouble *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
536 void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
537 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
538 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
539 double popBackSilent() throw(INTERP_KERNEL::Exception);
540 void pack() const throw(INTERP_KERNEL::Exception);
541 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
542 void fillWithZero() throw(INTERP_KERNEL::Exception);
543 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
544 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
545 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
546 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
547 void reverse() throw(INTERP_KERNEL::Exception);
548 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
549 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
550 std::string repr() const throw(INTERP_KERNEL::Exception);
551 std::string reprZip() const throw(INTERP_KERNEL::Exception);
552 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
553 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
554 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
555 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
556 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
557 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
558 DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
559 void transpose() throw(INTERP_KERNEL::Exception);
560 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
561 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
562 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
563 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
564 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
565 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
566 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
567 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
568 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
569 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
570 double front() const throw(INTERP_KERNEL::Exception);
571 double back() const throw(INTERP_KERNEL::Exception);
572 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
573 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
574 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
575 double *getPointer() throw(INTERP_KERNEL::Exception);
576 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
577 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
578 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
579 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
580 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
581 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
582 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
583 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
584 double getAverageValue() const throw(INTERP_KERNEL::Exception);
585 double norm2() const throw(INTERP_KERNEL::Exception);
586 double normMax() const throw(INTERP_KERNEL::Exception);
587 double normMin() const throw(INTERP_KERNEL::Exception);
588 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
589 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
590 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
591 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
592 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
593 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
594 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
595 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
596 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
597 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
598 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
599 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
600 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
601 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
602 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
603 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
604 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
605 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
606 void abs() throw(INTERP_KERNEL::Exception);
607 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
608 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
609 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
610 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
611 void applyPow(double val) throw(INTERP_KERNEL::Exception);
612 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
613 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
614 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
615 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
616 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
617 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
618 DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
619 DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
620 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
621 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
622 DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
623 DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
624 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
625 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
626 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
627 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
628 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
629 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
630 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
631 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
632 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
633 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
634 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
635 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
636 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
637 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
638 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
639 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
642 DataArrayDouble() throw(INTERP_KERNEL::Exception)
644 return DataArrayDouble::New();
647 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
649 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)";
650 std::string msg(msgBase);
652 msg+="\n-DataArrayDouble.New(numpy array with dtype=float64)";
655 if(PyList_Check(elt0) || PyTuple_Check(elt0))
659 if(PyInt_Check(nbOfTuples))
661 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
663 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
666 if(PyInt_Check(elt2))
667 {//DataArrayDouble.New([1.,3.,4.,5.],2,2)
668 int nbOfCompo=PyInt_AS_LONG(elt2);
670 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
671 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
672 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,nbOfCompo);
673 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
677 throw INTERP_KERNEL::Exception(msg.c_str());
680 {//DataArrayDouble.New([1.,3.,4.],3)
681 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
683 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,nbOfTuples1,tmpp1);
684 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
689 throw INTERP_KERNEL::Exception(msg.c_str());
692 {// DataArrayDouble.New([1.,3.,4.])
693 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
694 int tmpp1=-1,tmpp2=-1;
695 std::vector<double> tmp=fillArrayWithPyListDbl2(elt0,tmpp1,tmpp2);
696 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
700 else if(PyInt_Check(elt0))
702 int nbOfTuples1=PyInt_AS_LONG(elt0);
704 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive set of allocated memory !");
709 if(PyInt_Check(nbOfTuples))
710 {//DataArrayDouble.New(5,2)
711 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
713 throw INTERP_KERNEL::Exception("DataArrayDouble::New : should be a positive number of components !");
714 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
715 ret->alloc(nbOfTuples1,nbOfCompo);
719 throw INTERP_KERNEL::Exception(msg.c_str());
722 throw INTERP_KERNEL::Exception(msg.c_str());
725 {//DataArrayDouble.New(5)
726 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
727 ret->alloc(nbOfTuples1,1);
732 else if(PyArray_Check(elt0) && nbOfTuples==NULL && elt2==NULL)
733 {//DataArrayDouble.New(numpyArray)
734 return BuildNewInstance<DataArrayDouble,double>(elt0,NPY_DOUBLE,&PyCallBackDataArrayDouble_RefType,"FLOAT64");
738 throw INTERP_KERNEL::Exception(msg.c_str());
739 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
742 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
744 return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
747 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
750 std::vector<double> bb;
752 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
753 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
754 self->pushBackValsSilent(tmp,tmp+nbTuples);
757 std::string __repr__() const throw(INTERP_KERNEL::Exception)
759 std::ostringstream oss;
760 self->reprQuickOverview(oss);
764 std::string __str__() const throw(INTERP_KERNEL::Exception)
766 return self->reprNotTooLong();
769 double __float__() const throw(INTERP_KERNEL::Exception)
771 return self->doubleValue();
774 int __len__() const throw(INTERP_KERNEL::Exception)
776 if(self->isAllocated())
778 return self->getNumberOfTuples();
782 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
786 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
788 return self->iterator();
791 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
793 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 !";
794 if(PyList_Check(li) || PyTuple_Check(li))
798 if(PyInt_Check(nbOfTuples))
800 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
802 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
805 if(PyInt_Check(nbOfComp))
806 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
807 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
809 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
810 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
811 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
814 throw INTERP_KERNEL::Exception(msg);
817 {//DataArrayDouble.setValues([1.,3.,4.],3)
819 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
820 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
824 throw INTERP_KERNEL::Exception(msg);
827 {// DataArrayDouble.setValues([1.,3.,4.])
828 int tmpp1=-1,tmpp2=-1;
829 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
830 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
834 throw INTERP_KERNEL::Exception(msg);
837 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
839 const double *vals=self->getConstPointer();
840 return convertDblArrToPyList(vals,self->getNbOfElems());
844 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
846 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
850 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
853 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
854 PyObject *ret=PyTuple_New(2);
855 PyObject *ret0Py=ret0?Py_True:Py_False;
857 PyTuple_SetItem(ret,0,ret0Py);
858 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
862 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
864 const double *vals=self->getConstPointer();
865 int nbOfComp=self->getNumberOfComponents();
866 int nbOfTuples=self->getNumberOfTuples();
867 return convertDblArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
870 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
873 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
874 if (!SWIG_IsOK(res1))
877 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
878 if(size!=self->getNumberOfTuples())
880 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
882 return self->renumber(tmp);
886 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
888 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
889 da2->checkAllocated();
890 int size=self->getNumberOfTuples();
891 if(size!=self->getNumberOfTuples())
893 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
895 return self->renumber(da2->getConstPointer());
899 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
902 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
903 if (!SWIG_IsOK(res1))
906 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
907 if(size!=self->getNumberOfTuples())
909 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
911 return self->renumberR(tmp);
915 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
917 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
918 da2->checkAllocated();
919 int size=self->getNumberOfTuples();
920 if(size!=self->getNumberOfTuples())
922 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
924 return self->renumberR(da2->getConstPointer());
928 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
931 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
932 if (!SWIG_IsOK(res1))
935 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
936 if(size!=self->getNumberOfTuples())
938 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
940 return self->renumberAndReduce(tmp,newNbOfTuple);
944 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
946 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
947 da2->checkAllocated();
948 int size=self->getNumberOfTuples();
949 if(size!=self->getNumberOfTuples())
951 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
953 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
957 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
959 int thisTupleId,otherTupleId;
960 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
961 PyObject *ret=PyTuple_New(3);
962 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
963 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
964 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
968 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
971 double r1=self->getMaxValue(tmp);
972 PyObject *ret=PyTuple_New(2);
973 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
974 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
978 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
981 double r1=self->getMaxValue2(tmp);
982 PyObject *ret=PyTuple_New(2);
983 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
984 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
988 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
991 double r1=self->getMinValue(tmp);
992 PyObject *ret=PyTuple_New(2);
993 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
994 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
998 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1001 double r1=self->getMinValue2(tmp);
1002 PyObject *ret=PyTuple_New(2);
1003 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1004 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1008 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1010 int nbOfCompo=self->getNumberOfComponents();
1011 INTERP_KERNEL::AutoPtr<double> tmp=new double[2*nbOfCompo];
1012 self->getMinMaxPerComponent(tmp);
1013 PyObject *ret=convertDblArrToPyListOfTuple(tmp,2,nbOfCompo);
1017 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1019 int sz=self->getNumberOfComponents();
1020 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1021 self->accumulate(tmp);
1022 return convertDblArrToPyList(tmp,sz);
1025 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1028 std::vector<int> val2;
1029 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
1030 return self->accumulatePerChunck(bg,bg+sz);
1033 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1035 DataArrayInt *comm, *commIndex;
1036 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1037 PyObject *res = PyList_New(2);
1038 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1039 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1043 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1047 DataArrayDoubleTuple *aa;
1048 std::vector<double> bb;
1050 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1051 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1053 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1054 PyObject *ret=PyTuple_New(2);
1055 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1056 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1060 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1062 std::vector<int> tmp;
1063 convertPyToNewIntArr3(li,tmp);
1064 self->setSelectedComponents(a,tmp);
1067 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1069 int sz=self->getNumberOfComponents();
1070 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1071 self->getTuple(tupleId,tmp);
1072 return convertDblArrToPyList(tmp,sz);
1075 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1077 std::vector<const DataArrayDouble *> tmp;
1078 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1079 return DataArrayDouble::Aggregate(tmp);
1082 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1084 std::vector<const DataArrayDouble *> tmp;
1085 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble,"DataArrayDouble",tmp);
1086 return DataArrayDouble::Meld(tmp);
1089 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1093 DataArrayDoubleTuple *aa;
1094 std::vector<double> bb;
1096 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1097 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1098 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1099 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1100 DataArrayInt *c=0,*cI=0;
1101 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1102 PyObject *ret=PyTuple_New(2);
1103 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1104 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1108 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1110 DataArrayInt *ret1=0;
1111 bool ret0=self->areIncludedInMe(other,prec,ret1);
1112 PyObject *ret=PyTuple_New(2);
1113 PyObject *ret0Py=ret0?Py_True:Py_False;
1115 PyTuple_SetItem(ret,0,ret0Py);
1116 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1120 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1122 const char msg[]="Unexpected situation in DataArrayDouble::__getitem__ !";
1123 const char msg2[]="DataArrayDouble::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
1124 self->checkAllocated();
1125 int nbOfTuples=self->getNumberOfTuples();
1126 int nbOfComponents=self->getNumberOfComponents();
1128 std::vector<int> vt1,vc1;
1129 std::pair<int, std::pair<int,int> > pt1,pc1;
1130 DataArrayInt *dt1=0,*dc1=0;
1132 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1133 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret;
1137 if(nbOfComponents==1)
1138 return PyFloat_FromDouble(self->getIJSafe(it1,0));
1139 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1141 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1143 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1145 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1147 return PyFloat_FromDouble(self->getIJSafe(it1,ic1));
1150 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1151 std::vector<int> v2(1,ic1);
1152 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1156 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1157 std::vector<int> v2(1,ic1);
1158 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1162 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1163 std::vector<int> v2(1,ic1);
1164 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1168 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1169 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1173 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1174 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1178 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1179 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1183 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1184 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1188 ret=self->selectByTupleIdSafe(&it1,&it1+1);
1189 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1190 std::vector<int> v2(nbOfComp);
1191 for(int i=0;i<nbOfComp;i++)
1192 v2[i]=pc1.first+i*pc1.second.second;
1193 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1197 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
1198 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1199 std::vector<int> v2(nbOfComp);
1200 for(int i=0;i<nbOfComp;i++)
1201 v2[i]=pc1.first+i*pc1.second.second;
1202 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1206 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
1207 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1208 std::vector<int> v2(nbOfComp);
1209 for(int i=0;i<nbOfComp;i++)
1210 v2[i]=pc1.first+i*pc1.second.second;
1211 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1215 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
1216 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
1217 std::vector<int> v2(nbOfComp);
1218 for(int i=0;i<nbOfComp;i++)
1219 v2[i]=pc1.first+i*pc1.second.second;
1220 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1223 throw INTERP_KERNEL::Exception(msg);
1227 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1229 self->checkAllocated();
1230 const char msg[]="Unexpected situation in DataArrayDouble::__setitem__ !";
1231 int nbOfTuples=self->getNumberOfTuples();
1232 int nbOfComponents=self->getNumberOfComponents();
1235 std::vector<double> v1;
1236 DataArrayDouble *d1=0;
1237 convertObjToPossibleCpp4(value,sw1,i1,v1,d1);
1239 std::vector<int> vt1,vc1;
1240 std::pair<int, std::pair<int,int> > pt1,pc1;
1241 DataArrayInt *dt1=0,*dc1=0;
1242 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
1243 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp;
1251 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
1254 tmp=DataArrayDouble::New();
1255 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1256 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
1259 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
1262 throw INTERP_KERNEL::Exception(msg);
1271 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1274 tmp=DataArrayDouble::New();
1275 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1276 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
1279 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
1282 throw INTERP_KERNEL::Exception(msg);
1291 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1294 tmp=DataArrayDouble::New();
1295 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1296 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
1299 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
1302 throw INTERP_KERNEL::Exception(msg);
1311 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1314 tmp=DataArrayDouble::New();
1315 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1316 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
1319 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
1322 throw INTERP_KERNEL::Exception(msg);
1331 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
1334 tmp=DataArrayDouble::New();
1335 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1336 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
1339 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
1342 throw INTERP_KERNEL::Exception(msg);
1351 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1354 tmp=DataArrayDouble::New();
1355 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1356 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
1359 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
1362 throw INTERP_KERNEL::Exception(msg);
1371 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1374 tmp=DataArrayDouble::New();
1375 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1376 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
1379 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
1382 throw INTERP_KERNEL::Exception(msg);
1391 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1394 tmp=DataArrayDouble::New();
1395 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1396 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
1399 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
1402 throw INTERP_KERNEL::Exception(msg);
1411 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1414 tmp=DataArrayDouble::New();
1415 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1416 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
1419 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
1422 throw INTERP_KERNEL::Exception(msg);
1431 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1434 tmp=DataArrayDouble::New();
1435 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1436 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
1439 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
1442 throw INTERP_KERNEL::Exception(msg);
1451 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1454 tmp=DataArrayDouble::New();
1455 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1456 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
1459 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
1462 throw INTERP_KERNEL::Exception(msg);
1471 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1474 tmp=DataArrayDouble::New();
1475 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1476 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
1479 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
1482 throw INTERP_KERNEL::Exception(msg);
1491 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1494 tmp=DataArrayDouble::New();
1495 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1496 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
1499 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
1502 throw INTERP_KERNEL::Exception(msg);
1511 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1514 tmp=DataArrayDouble::New();
1515 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1516 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
1519 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
1522 throw INTERP_KERNEL::Exception(msg);
1531 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1534 tmp=DataArrayDouble::New();
1535 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1536 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
1539 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
1542 throw INTERP_KERNEL::Exception(msg);
1551 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1554 tmp=DataArrayDouble::New();
1555 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
1556 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
1559 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
1562 throw INTERP_KERNEL::Exception(msg);
1567 throw INTERP_KERNEL::Exception(msg);
1572 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1574 return self->negate();
1577 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1579 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1582 DataArrayDoubleTuple *aa;
1583 std::vector<double> bb;
1586 #ifndef WITHOUT_AUTOFIELD
1588 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1590 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1593 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1594 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1599 throw INTERP_KERNEL::Exception(msg);
1603 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1608 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1609 ret->applyLin(1.,val);
1610 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1614 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1618 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1619 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1623 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1624 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1627 throw INTERP_KERNEL::Exception(msg);
1631 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1633 const char msg[]="Unexpected situation in __radd__ !";
1636 DataArrayDoubleTuple *aa;
1637 std::vector<double> bb;
1639 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1644 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1645 ret->applyLin(1.,val);
1650 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1651 return DataArrayDouble::Add(self,aaa);
1655 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1656 return DataArrayDouble::Add(self,aaa);
1659 throw INTERP_KERNEL::Exception(msg);
1663 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1665 const char msg[]="Unexpected situation in __iadd__ !";
1668 DataArrayDoubleTuple *aa;
1669 std::vector<double> bb;
1671 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1676 self->applyLin(1.,val);
1677 Py_XINCREF(trueSelf);
1683 Py_XINCREF(trueSelf);
1688 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1689 self->addEqual(aaa);
1690 Py_XINCREF(trueSelf);
1695 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1696 self->addEqual(aaa);
1697 Py_XINCREF(trueSelf);
1701 throw INTERP_KERNEL::Exception(msg);
1705 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1707 const char msg[]="Unexpected situation in __sub__ !";
1710 DataArrayDoubleTuple *aa;
1711 std::vector<double> bb;
1714 #ifndef WITHOUT_AUTOFIELD
1716 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1718 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1721 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1722 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1724 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1727 throw INTERP_KERNEL::Exception(msg);
1731 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1736 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1737 ret->applyLin(1.,-val);
1738 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1746 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1747 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1751 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1752 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1755 throw INTERP_KERNEL::Exception(msg);
1759 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1761 const char msg[]="Unexpected situation in __rsub__ !";
1764 DataArrayDoubleTuple *aa;
1765 std::vector<double> bb;
1767 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1772 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1773 ret->applyLin(-1.,val);
1778 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1779 return DataArrayDouble::Substract(aaa,self);
1783 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1784 return DataArrayDouble::Substract(aaa,self);
1787 throw INTERP_KERNEL::Exception(msg);
1791 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1793 const char msg[]="Unexpected situation in __isub__ !";
1796 DataArrayDoubleTuple *aa;
1797 std::vector<double> bb;
1799 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1804 self->applyLin(1,-val);
1805 Py_XINCREF(trueSelf);
1810 self->substractEqual(a);
1811 Py_XINCREF(trueSelf);
1816 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1817 self->substractEqual(aaa);
1818 Py_XINCREF(trueSelf);
1823 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1824 self->substractEqual(aaa);
1825 Py_XINCREF(trueSelf);
1829 throw INTERP_KERNEL::Exception(msg);
1833 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1835 const char msg[]="Unexpected situation in __mul__ !";
1838 DataArrayDoubleTuple *aa;
1839 std::vector<double> bb;
1842 #ifndef WITHOUT_AUTOFIELD
1844 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1846 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1849 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1850 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1852 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1855 throw INTERP_KERNEL::Exception(msg);
1859 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1864 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1865 ret->applyLin(val,0.);
1866 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1870 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1874 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1875 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1879 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1880 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1883 throw INTERP_KERNEL::Exception(msg);
1887 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1889 const char msg[]="Unexpected situation in __rmul__ !";
1892 DataArrayDoubleTuple *aa;
1893 std::vector<double> bb;
1895 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1900 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1901 ret->applyLin(val,0.);
1906 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1907 return DataArrayDouble::Multiply(self,aaa);
1911 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1912 return DataArrayDouble::Multiply(self,aaa);
1915 throw INTERP_KERNEL::Exception(msg);
1919 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1921 const char msg[]="Unexpected situation in __imul__ !";
1924 DataArrayDoubleTuple *aa;
1925 std::vector<double> bb;
1927 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1932 self->applyLin(val,0.);
1933 Py_XINCREF(trueSelf);
1938 self->multiplyEqual(a);
1939 Py_XINCREF(trueSelf);
1944 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1945 self->multiplyEqual(aaa);
1946 Py_XINCREF(trueSelf);
1951 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1952 self->multiplyEqual(aaa);
1953 Py_XINCREF(trueSelf);
1957 throw INTERP_KERNEL::Exception(msg);
1961 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1963 const char msg[]="Unexpected situation in __div__ !";
1966 DataArrayDoubleTuple *aa;
1967 std::vector<double> bb;
1970 #ifndef WITHOUT_AUTOFIELD
1972 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble,0|0)))
1974 MEDCouplingFieldDouble *other=reinterpret_cast< ParaMEDMEM::MEDCouplingFieldDouble * >(argp);
1977 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
1978 MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=ParaMEDMEM_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1980 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1983 throw INTERP_KERNEL::Exception(msg);
1987 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
1993 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1994 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
1995 ret->applyLin(1/val,0.);
1996 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2000 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2004 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2005 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2009 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2010 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 );
2013 throw INTERP_KERNEL::Exception(msg);
2017 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2019 const char msg[]="Unexpected situation in __rdiv__ !";
2022 DataArrayDoubleTuple *aa;
2023 std::vector<double> bb;
2025 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2030 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2036 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2037 return DataArrayDouble::Divide(aaa,self);
2041 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2042 return DataArrayDouble::Divide(aaa,self);
2045 throw INTERP_KERNEL::Exception(msg);
2049 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2051 const char msg[]="Unexpected situation in __idiv__ !";
2054 DataArrayDoubleTuple *aa;
2055 std::vector<double> bb;
2057 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2063 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
2064 self->applyLin(1./val,0.);
2065 Py_XINCREF(trueSelf);
2070 self->divideEqual(a);
2071 Py_XINCREF(trueSelf);
2076 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2077 self->divideEqual(aaa);
2078 Py_XINCREF(trueSelf);
2083 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2084 self->divideEqual(aaa);
2085 Py_XINCREF(trueSelf);
2089 throw INTERP_KERNEL::Exception(msg);
2093 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2095 const char msg[]="Unexpected situation in __pow__ !";
2098 DataArrayDoubleTuple *aa;
2099 std::vector<double> bb;
2101 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2106 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2112 return DataArrayDouble::Pow(self,a);
2116 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2117 return DataArrayDouble::Pow(self,aaa);
2121 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2122 return DataArrayDouble::Pow(self,aaa);
2125 throw INTERP_KERNEL::Exception(msg);
2129 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2131 const char msg[]="Unexpected situation in __rpow__ !";
2134 DataArrayDoubleTuple *aa;
2135 std::vector<double> bb;
2137 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2142 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->deepCpy();
2143 ret->applyRPow(val);
2148 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2149 return DataArrayDouble::Pow(aaa,self);
2153 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2154 return DataArrayDouble::Pow(aaa,self);
2157 throw INTERP_KERNEL::Exception(msg);
2161 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2163 const char msg[]="Unexpected situation in __ipow__ !";
2166 DataArrayDoubleTuple *aa;
2167 std::vector<double> bb;
2169 convertObjToPossibleCpp5(obj,sw,val,a,aa,bb);
2174 self->applyPow(val);
2175 Py_XINCREF(trueSelf);
2181 Py_XINCREF(trueSelf);
2186 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
2187 self->powEqual(aaa);
2188 Py_XINCREF(trueSelf);
2193 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
2194 self->powEqual(aaa);
2195 Py_XINCREF(trueSelf);
2199 throw INTERP_KERNEL::Exception(msg);
2203 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
2205 DataArrayInt *c=0,*cI=0;
2207 self->computeTupleIdsNearTuples(other,eps,c,cI);
2208 PyObject *ret=PyTuple_New(2);
2209 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2210 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2214 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
2216 DataArrayInt *ret1=0;
2217 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
2218 PyObject *ret=PyTuple_New(2);
2219 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
2220 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2225 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
2227 static const char MSG[]="DataArrayDouble.__new__ : the args in input is expected to be a tuple !";
2228 if(!PyTuple_Check(args))
2229 throw INTERP_KERNEL::Exception(MSG);
2230 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
2231 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
2232 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
2234 PyObject *tmp0(PyTuple_New(1));
2235 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
2236 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
2238 Py_DECREF(selfMeth);
2239 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
2240 int sz(PyTuple_Size(args));
2242 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
2243 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
2244 PyObject *zeNumpyRepr(0);
2245 PyObject *tmp1(PyInt_FromLong(0));
2246 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
2248 PyObject *tmp3(PyTuple_New(1));
2249 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
2250 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
2254 Py_DECREF(initMeth);
2258 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
2261 if(!self->isAllocated())
2262 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
2263 PyObject *ret(PyTuple_New(1));
2264 PyObject *ret0(PyDict_New());
2265 PyObject *numpyArryObj(ParaMEDMEM_DataArrayDouble_toNumPyArray(self));
2266 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
2267 PyObject *tmp1(PyInt_FromLong(0));
2268 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
2269 PyTuple_SetItem(ret,0,ret0);
2273 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
2279 class DataArrayDoubleTuple;
2281 class DataArrayDoubleIterator
2284 DataArrayDoubleIterator(DataArrayDouble *da);
2285 ~DataArrayDoubleIterator();
2290 DataArrayDoubleTuple *ret=self->nextt();
2292 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
2295 PyErr_SetString(PyExc_StopIteration,"No more data.");
2302 class DataArrayDoubleTuple
2305 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
2306 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
2309 std::string __str__() const throw(INTERP_KERNEL::Exception)
2311 return self->repr();
2314 double __float__() const throw(INTERP_KERNEL::Exception)
2316 return self->doubleValue();
2319 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2321 return self->buildDADouble(1,self->getNumberOfCompo());
2324 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2326 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2327 ParaMEDMEM_DataArrayDouble____iadd___(ret,0,obj);
2328 Py_XINCREF(trueSelf);
2332 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2334 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2335 ParaMEDMEM_DataArrayDouble____isub___(ret,0,obj);
2336 Py_XINCREF(trueSelf);
2340 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2342 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2343 ParaMEDMEM_DataArrayDouble____imul___(ret,0,obj);
2344 Py_XINCREF(trueSelf);
2348 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2350 MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2351 ParaMEDMEM_DataArrayDouble____idiv___(ret,0,obj);
2352 Py_XINCREF(trueSelf);
2356 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2358 return PyInt_FromLong(self->getNumberOfCompo());
2361 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2363 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2366 std::vector<int> multiVal;
2367 std::pair<int, std::pair<int,int> > slic;
2368 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2369 const double *pt=self->getConstPointer();
2370 int nbc=self->getNumberOfCompo();
2371 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2378 std::ostringstream oss;
2379 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2380 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2384 return PyFloat_FromDouble(pt[singleVal]);
2388 return PyFloat_FromDouble(pt[nbc+singleVal]);
2391 std::ostringstream oss;
2392 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2393 throw INTERP_KERNEL::Exception(oss.str().c_str());
2399 PyObject *t=PyTuple_New(multiVal.size());
2400 for(int j=0;j<(int)multiVal.size();j++)
2402 int cid=multiVal[j];
2405 std::ostringstream oss;
2406 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2407 throw INTERP_KERNEL::Exception(oss.str().c_str());
2409 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2415 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2416 PyObject *t=PyTuple_New(sz);
2417 for(int j=0;j<sz;j++)
2418 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2422 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2426 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2428 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2429 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2432 std::vector<double> multiValV;
2433 ParaMEDMEM::DataArrayDoubleTuple *daIntTyyppV=0;
2434 int nbc=self->getNumberOfCompo();
2435 convertObjToPossibleCpp44(value,sw1,singleValV,multiValV,daIntTyyppV);
2437 std::vector<int> multiVal;
2438 std::pair<int, std::pair<int,int> > slic;
2439 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
2440 double *pt=self->getPointer();
2441 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2448 std::ostringstream oss;
2449 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2450 throw INTERP_KERNEL::Exception(oss.str().c_str());
2456 pt[singleVal]=singleValV;
2461 if(multiValV.size()!=1)
2463 std::ostringstream oss;
2464 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2465 throw INTERP_KERNEL::Exception(oss.str().c_str());
2467 pt[singleVal]=multiValV[0];
2472 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2476 throw INTERP_KERNEL::Exception(msg);
2485 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2489 std::ostringstream oss;
2490 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2491 throw INTERP_KERNEL::Exception(oss.str().c_str());
2499 if(multiVal.size()!=multiValV.size())
2501 std::ostringstream oss;
2502 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2503 throw INTERP_KERNEL::Exception(oss.str().c_str());
2505 for(int i=0;i<(int)multiVal.size();i++)
2507 int pos=multiVal[i];
2510 std::ostringstream oss;
2511 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2512 throw INTERP_KERNEL::Exception(oss.str().c_str());
2514 pt[multiVal[i]]=multiValV[i];
2520 const double *ptV=daIntTyyppV->getConstPointer();
2521 if(nbc>daIntTyyppV->getNumberOfCompo())
2523 std::ostringstream oss;
2524 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2525 throw INTERP_KERNEL::Exception(oss.str().c_str());
2527 std::copy(ptV,ptV+nbc,pt);
2531 throw INTERP_KERNEL::Exception(msg);
2536 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2541 for(int j=0;j<sz;j++)
2542 pt[slic.first+j*slic.second.second]=singleValV;
2547 if(sz!=(int)multiValV.size())
2549 std::ostringstream oss;
2550 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2551 throw INTERP_KERNEL::Exception(oss.str().c_str());
2553 for(int j=0;j<sz;j++)
2554 pt[slic.first+j*slic.second.second]=multiValV[j];
2559 const double *ptV=daIntTyyppV->getConstPointer();
2560 if(sz>daIntTyyppV->getNumberOfCompo())
2562 std::ostringstream oss;
2563 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2564 throw INTERP_KERNEL::Exception(oss.str().c_str());
2566 for(int j=0;j<sz;j++)
2567 pt[slic.first+j*slic.second.second]=ptV[j];
2571 throw INTERP_KERNEL::Exception(msg);
2575 throw INTERP_KERNEL::Exception(msg);
2581 class DataArrayIntIterator;
2583 class DataArrayInt : public DataArray
2586 static DataArrayInt *New();
2587 int intValue() const throw(INTERP_KERNEL::Exception);
2588 int getHashCode() const throw(INTERP_KERNEL::Exception);
2589 bool empty() const throw(INTERP_KERNEL::Exception);
2590 DataArrayInt *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
2591 void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2592 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2593 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2594 int popBackSilent() throw(INTERP_KERNEL::Exception);
2595 void pack() const throw(INTERP_KERNEL::Exception);
2596 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2597 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2598 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2599 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2600 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2601 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2602 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2603 void reverse() throw(INTERP_KERNEL::Exception);
2604 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2605 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2606 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2607 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2608 void fillWithZero() throw(INTERP_KERNEL::Exception);
2609 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2610 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2611 void replaceOneValByInThis(int valToBeReplaced, int replacedBy) throw(INTERP_KERNEL::Exception);
2612 std::string repr() const throw(INTERP_KERNEL::Exception);
2613 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2614 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2615 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2616 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2617 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2618 DataArrayDouble *convertToDblArr() const throw(INTERP_KERNEL::Exception);
2619 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2620 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2621 DataArrayInt *selectByTupleId2(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2622 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2623 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2624 bool isIdentity() const throw(INTERP_KERNEL::Exception);
2625 bool isIdentity2(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2626 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2627 DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2628 void transpose() throw(INTERP_KERNEL::Exception);
2629 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2630 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2631 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2632 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2633 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2634 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2635 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2636 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2637 int front() const throw(INTERP_KERNEL::Exception);
2638 int back() const throw(INTERP_KERNEL::Exception);
2639 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2640 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2641 int *getPointer() throw(INTERP_KERNEL::Exception);
2642 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2643 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2644 const int *begin() const throw(INTERP_KERNEL::Exception);
2645 const int *end() const throw(INTERP_KERNEL::Exception);
2646 DataArrayInt *getIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2647 DataArrayInt *getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2648 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2649 int locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2650 int locateValue(int value) const throw(INTERP_KERNEL::Exception);
2651 int locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2652 int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2653 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2654 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2655 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2656 int count(int value) const throw(INTERP_KERNEL::Exception);
2657 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2658 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2659 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2660 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2661 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2662 void abs() throw(INTERP_KERNEL::Exception);
2663 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2664 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2665 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2666 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2667 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2668 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2669 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2670 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2671 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2672 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2673 DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2674 DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2675 DataArrayInt *getIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2676 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2677 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2678 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2679 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2680 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2681 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2682 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2683 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2684 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2685 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2686 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2687 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2688 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2689 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2690 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2691 void computeOffsets() throw(INTERP_KERNEL::Exception);
2692 void computeOffsets2() throw(INTERP_KERNEL::Exception);
2693 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2694 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2695 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2696 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2697 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2698 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2699 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2700 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2701 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2702 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2703 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2704 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2705 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2706 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2707 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2708 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2709 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2710 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2712 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2715 DataArrayInt() throw(INTERP_KERNEL::Exception)
2717 return DataArrayInt::New();
2720 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2722 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)";
2723 std::string msg(msgBase);
2725 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2728 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2732 if(PyInt_Check(nbOfTuples))
2734 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2736 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2739 if(PyInt_Check(nbOfComp))
2740 {//DataArrayInt.New([1,3,4,5],2,2)
2741 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2743 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2744 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2745 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2746 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2750 throw INTERP_KERNEL::Exception(msg.c_str());
2753 {//DataArrayInt.New([1,3,4],3)
2754 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2756 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2757 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2762 throw INTERP_KERNEL::Exception(msg.c_str());
2765 {// DataArrayInt.New([1,3,4])
2766 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2767 int tmpp1=-1,tmpp2=-1;
2768 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2769 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2773 else if(PyInt_Check(elt0))
2775 int nbOfTuples1=PyInt_AS_LONG(elt0);
2777 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2782 if(PyInt_Check(nbOfTuples))
2783 {//DataArrayInt.New(5,2)
2784 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2786 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2787 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2788 ret->alloc(nbOfTuples1,nbOfCompo);
2792 throw INTERP_KERNEL::Exception(msg.c_str());
2795 throw INTERP_KERNEL::Exception(msg.c_str());
2798 {//DataArrayInt.New(5)
2799 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
2800 ret->alloc(nbOfTuples1,1);
2805 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2806 {//DataArrayInt.New(numpyArray)
2807 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2811 throw INTERP_KERNEL::Exception(msg.c_str());
2812 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2815 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2817 return ParaMEDMEM_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2820 std::string __str__() const throw(INTERP_KERNEL::Exception)
2822 return self->reprNotTooLong();
2825 int __len__() const throw(INTERP_KERNEL::Exception)
2827 if(self->isAllocated())
2829 return self->getNumberOfTuples();
2833 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2837 int __int__() const throw(INTERP_KERNEL::Exception)
2839 return self->intValue();
2842 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2844 return self->iterator();
2847 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2849 int sz=self->getNumberOfComponents();
2850 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2851 self->accumulate(tmp);
2852 return convertIntArrToPyList(tmp,sz);
2855 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2858 std::vector<int> val2;
2859 const int *bg=convertObjToPossibleCpp1_Safe(indexArr,sw,sz,val,val2);
2860 return self->accumulatePerChunck(bg,bg+sz);
2863 DataArrayInt *getIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2866 std::vector<int> val2;
2867 const int *bg(convertObjToPossibleCpp1_Safe(inputTuple,sw,sz,val,val2));
2868 return self->getIdsEqualTuple(bg,bg+sz);
2871 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2873 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2874 PyObject *ret=PyList_New(slcs.size());
2875 for(std::size_t i=0;i<slcs.size();i++)
2876 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2880 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2882 if(!PySlice_Check(slic))
2883 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2884 Py_ssize_t strt=2,stp=2,step=2;
2885 PySliceObject *sly=reinterpret_cast<PySliceObject *>(slic);
2886 GetIndicesOfSliceExplicitely(sly,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2887 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2888 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 !");
2889 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2892 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2895 self->getMinMaxValues(a,b);
2896 PyObject *ret=PyTuple_New(2);
2897 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2898 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2902 static PyObject *BuildOld2NewArrayFromSurjectiveFormat2(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2904 int newNbOfTuples=-1;
2905 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2906 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2907 const int *arrPtr=convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2908 const int *arrIPtr=convertObjToPossibleCpp1_Safe(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2909 DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2910 PyObject *ret=PyTuple_New(2);
2911 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
2912 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2916 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2918 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
2919 int szArr,sw,iTypppArr;
2920 std::vector<int> stdvecTyyppArr;
2921 const int *arrPtr(convertObjToPossibleCpp1_Safe(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2922 int *pt(ParaMEDMEM::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2923 ret->useArray(pt,true,ParaMEDMEM::C_DEALLOC,szArr,1);
2927 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2929 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 !";
2930 if(PyList_Check(li) || PyTuple_Check(li))
2934 if(PyInt_Check(nbOfTuples))
2936 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2938 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2941 if(PyInt_Check(nbOfComp))
2942 {//DataArrayInt.setValues([1,3,4,5],2,2)
2943 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2945 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2946 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2947 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2950 throw INTERP_KERNEL::Exception(msg);
2953 {//DataArrayInt.setValues([1,3,4],3)
2955 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2956 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2960 throw INTERP_KERNEL::Exception(msg);
2963 {// DataArrayInt.setValues([1,3,4])
2964 int tmpp1=-1,tmpp2=-1;
2965 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2966 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2970 throw INTERP_KERNEL::Exception(msg);
2973 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2975 const int *vals=self->getConstPointer();
2976 return convertIntArrToPyList(vals,self->getNbOfElems());
2980 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2982 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2986 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2989 bool ret0=self->isEqualIfNotWhy(other,ret1);
2990 PyObject *ret=PyTuple_New(2);
2991 PyObject *ret0Py=ret0?Py_True:Py_False;
2993 PyTuple_SetItem(ret,0,ret0Py);
2994 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2998 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
3000 const int *vals=self->getConstPointer();
3001 int nbOfComp=self->getNumberOfComponents();
3002 int nbOfTuples=self->getNumberOfTuples();
3003 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
3006 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
3008 std::vector<const DataArrayInt *> groups;
3009 std::vector< std::vector<int> > fidsOfGroups;
3010 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(gps,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",groups);
3011 ParaMEDMEM::DataArrayInt *ret0=ParaMEDMEM::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
3012 PyObject *ret = PyList_New(2);
3013 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3014 int sz=fidsOfGroups.size();
3015 PyObject *ret1 = PyList_New(sz);
3016 for(int i=0;i<sz;i++)
3017 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
3018 PyList_SetItem(ret,1,ret1);
3022 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
3025 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3026 if (!SWIG_IsOK(res1))
3029 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3030 self->transformWithIndArr(tmp,tmp+size);
3034 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3035 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3039 DataArrayInt *getIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3043 std::vector<int> multiVal;
3044 std::pair<int, std::pair<int,int> > slic;
3045 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3046 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3050 return self->getIdsEqualList(&singleVal,&singleVal+1);
3052 return self->getIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3054 return self->getIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
3056 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3060 DataArrayInt *getIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
3064 std::vector<int> multiVal;
3065 std::pair<int, std::pair<int,int> > slic;
3066 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
3067 convertObjToPossibleCpp2(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
3071 return self->getIdsNotEqualList(&singleVal,&singleVal+1);
3073 return self->getIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
3075 return self->getIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
3077 throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
3081 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
3083 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
3085 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3086 if (!SWIG_IsOK(res1))
3089 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3090 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
3094 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3096 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3097 da2->checkAllocated();
3098 int size=self->getNumberOfTuples();
3099 self->splitByValueRange(da2->getConstPointer(),da2->getConstPointer()+size,ret0,ret1,ret2);
3101 PyObject *ret = PyList_New(3);
3102 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3103 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3104 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
3108 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
3111 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3112 if (!SWIG_IsOK(res1))
3115 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3116 return self->transformWithIndArrR(tmp,tmp+size);
3120 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3121 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
3125 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
3128 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3129 if (!SWIG_IsOK(res1))
3132 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3133 if(size!=self->getNumberOfTuples())
3135 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3137 return self->renumberAndReduce(tmp,newNbOfTuple);
3141 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3143 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3144 da2->checkAllocated();
3145 int size=self->getNumberOfTuples();
3146 if(size!=self->getNumberOfTuples())
3148 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3150 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
3154 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
3157 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3158 if (!SWIG_IsOK(res1))
3161 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3162 if(size!=self->getNumberOfTuples())
3164 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3166 return self->renumber(tmp);
3170 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3172 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3173 da2->checkAllocated();
3174 int size=self->getNumberOfTuples();
3175 if(size!=self->getNumberOfTuples())
3177 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3179 return self->renumber(da2->getConstPointer());
3183 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
3186 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
3187 if (!SWIG_IsOK(res1))
3190 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
3191 if(size!=self->getNumberOfTuples())
3193 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3195 return self->renumberR(tmp);
3199 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
3201 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
3202 da2->checkAllocated();
3203 int size=self->getNumberOfTuples();
3204 if(size!=self->getNumberOfTuples())
3206 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
3208 return self->renumberR(da2->getConstPointer());
3212 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
3214 std::vector<int> tmp;
3215 convertPyToNewIntArr3(li,tmp);
3216 self->setSelectedComponents(a,tmp);
3219 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
3221 int sz=self->getNumberOfComponents();
3222 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
3223 self->getTuple(tupleId,tmp);
3224 return convertIntArrToPyList(tmp,sz);
3227 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
3229 DataArrayInt *arr=0;
3230 DataArrayInt *arrI=0;
3231 self->changeSurjectiveFormat(targetNb,arr,arrI);
3232 PyObject *res = PyList_New(2);
3233 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3234 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,SWIG_POINTER_OWN | 0));
3238 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
3240 std::vector<const DataArrayInt *> tmp;
3241 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3242 return DataArrayInt::Meld(tmp);
3245 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
3247 std::vector<const DataArrayInt *> tmp;
3248 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3249 return DataArrayInt::Aggregate(tmp);
3252 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
3254 std::vector<const DataArrayInt *> tmp;
3255 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3256 return DataArrayInt::AggregateIndexes(tmp);
3259 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
3261 std::vector<const DataArrayInt *> tmp;
3262 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3263 return DataArrayInt::BuildUnion(tmp);
3266 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
3268 std::vector<const DataArrayInt *> tmp;
3269 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayInt *>(li,SWIGTYPE_p_ParaMEDMEM__DataArrayInt,"DataArrayInt",tmp);
3270 return DataArrayInt::BuildIntersection(tmp);
3273 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
3276 int r1=self->getMaxValue(tmp);
3277 PyObject *ret=PyTuple_New(2);
3278 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3279 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3283 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3286 int r1=self->getMinValue(tmp);
3287 PyObject *ret=PyTuple_New(2);
3288 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3289 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3293 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3295 int nbOfCompo=self->getNumberOfComponents();
3300 if(PyInt_Check(obj))
3302 int val=(int)PyInt_AS_LONG(obj);
3303 return self->locateValue(val);
3306 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3310 std::vector<int> arr;
3311 convertPyToNewIntArr3(obj,arr);
3312 return self->locateTuple(arr);
3317 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3319 int nbOfCompo=self->getNumberOfComponents();
3326 if(PyInt_Check(obj))
3328 int val=(int)PyInt_AS_LONG(obj);
3329 return self->presenceOfValue(val);
3332 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3336 std::vector<int> arr;
3337 convertPyToNewIntArr3(obj,arr);
3338 return self->presenceOfTuple(arr);
3343 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3345 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3346 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3347 self->checkAllocated();
3348 int nbOfTuples=self->getNumberOfTuples();
3349 int nbOfComponents=self->getNumberOfComponents();
3351 std::vector<int> vt1,vc1;
3352 std::pair<int, std::pair<int,int> > pt1,pc1;
3353 DataArrayInt *dt1=0,*dc1=0;
3355 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3356 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret;
3361 if(nbOfComponents==1)
3362 return PyInt_FromLong(self->getIJSafe(it1,0));
3363 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3366 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3368 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3370 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3372 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3375 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3376 std::vector<int> v2(1,ic1);
3377 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3381 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3382 std::vector<int> v2(1,ic1);
3383 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3387 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3388 std::vector<int> v2(1,ic1);
3389 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3393 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3394 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3398 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3399 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3403 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3404 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3408 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3409 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3413 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3414 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3415 std::vector<int> v2(nbOfComp);
3416 for(int i=0;i<nbOfComp;i++)
3417 v2[i]=pc1.first+i*pc1.second.second;
3418 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3422 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3423 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3424 std::vector<int> v2(nbOfComp);
3425 for(int i=0;i<nbOfComp;i++)
3426 v2[i]=pc1.first+i*pc1.second.second;
3427 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3431 ret=self->selectByTupleId2(pt1.first,pt1.second.first,pt1.second.second);
3432 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3433 std::vector<int> v2(nbOfComp);
3434 for(int i=0;i<nbOfComp;i++)
3435 v2[i]=pc1.first+i*pc1.second.second;
3436 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3440 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3441 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3442 std::vector<int> v2(nbOfComp);
3443 for(int i=0;i<nbOfComp;i++)
3444 v2[i]=pc1.first+i*pc1.second.second;
3445 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
3448 throw INTERP_KERNEL::Exception(msg);
3452 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3454 self->checkAllocated();
3455 const char msg[]="Unexpected situation in __setitem__ !";
3456 int nbOfTuples=self->getNumberOfTuples();
3457 int nbOfComponents=self->getNumberOfComponents();
3460 std::vector<int> v1;
3462 DataArrayIntTuple *dd1=0;
3463 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
3465 std::vector<int> vt1,vc1;
3466 std::pair<int, std::pair<int,int> > pt1,pc1;
3467 DataArrayInt *dt1=0,*dc1=0;
3468 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3469 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
3477 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3480 tmp=DataArrayInt::New();
3481 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3482 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3485 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3488 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3489 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3492 throw INTERP_KERNEL::Exception(msg);
3501 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3504 tmp=DataArrayInt::New();
3505 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3506 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3509 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3512 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3513 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3516 throw INTERP_KERNEL::Exception(msg);
3525 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3528 tmp=DataArrayInt::New();
3529 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3530 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3533 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3536 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3537 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3540 throw INTERP_KERNEL::Exception(msg);
3549 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3552 tmp=DataArrayInt::New();
3553 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3554 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3557 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3560 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3561 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3564 throw INTERP_KERNEL::Exception(msg);
3573 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3576 tmp=DataArrayInt::New();
3577 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3578 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3581 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3584 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3585 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3588 throw INTERP_KERNEL::Exception(msg);
3597 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3600 tmp=DataArrayInt::New();
3601 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3602 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3605 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3608 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3609 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3612 throw INTERP_KERNEL::Exception(msg);
3621 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3624 tmp=DataArrayInt::New();
3625 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3626 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3629 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3632 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3633 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3636 throw INTERP_KERNEL::Exception(msg);
3645 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3648 tmp=DataArrayInt::New();
3649 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3650 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3653 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3656 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3657 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3660 throw INTERP_KERNEL::Exception(msg);
3669 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3672 tmp=DataArrayInt::New();
3673 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3674 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3677 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3680 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3681 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3684 throw INTERP_KERNEL::Exception(msg);
3693 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3696 tmp=DataArrayInt::New();
3697 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3698 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3701 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3704 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3705 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3708 throw INTERP_KERNEL::Exception(msg);
3717 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3720 tmp=DataArrayInt::New();
3721 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3722 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3725 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3728 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3729 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3732 throw INTERP_KERNEL::Exception(msg);
3741 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3744 tmp=DataArrayInt::New();
3745 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3746 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3749 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3752 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3753 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3756 throw INTERP_KERNEL::Exception(msg);
3765 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3768 tmp=DataArrayInt::New();
3769 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3770 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3773 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3776 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3777 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3780 throw INTERP_KERNEL::Exception(msg);
3789 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3792 tmp=DataArrayInt::New();
3793 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3794 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3797 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3800 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3801 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3804 throw INTERP_KERNEL::Exception(msg);
3813 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3816 tmp=DataArrayInt::New();
3817 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3818 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3821 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3824 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3825 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3828 throw INTERP_KERNEL::Exception(msg);
3837 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3840 tmp=DataArrayInt::New();
3841 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3842 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3845 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3848 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3849 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3852 throw INTERP_KERNEL::Exception(msg);
3857 throw INTERP_KERNEL::Exception(msg);
3862 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3864 return self->negate();
3867 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3869 const char msg[]="Unexpected situation in __add__ !";
3872 std::vector<int> aa;
3873 DataArrayIntTuple *aaa;
3875 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3880 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3881 ret->applyLin(1,val);
3886 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3887 return DataArrayInt::Add(self,aaaa);
3891 return DataArrayInt::Add(self,a);
3895 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3896 return DataArrayInt::Add(self,aaaa);
3899 throw INTERP_KERNEL::Exception(msg);
3903 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3905 const char msg[]="Unexpected situation in __radd__ !";
3908 std::vector<int> aa;
3909 DataArrayIntTuple *aaa;
3911 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3916 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3917 ret->applyLin(1,val);
3922 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3923 return DataArrayInt::Add(self,aaaa);
3927 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3928 return DataArrayInt::Add(self,aaaa);
3931 throw INTERP_KERNEL::Exception(msg);
3935 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3937 const char msg[]="Unexpected situation in __iadd__ !";
3940 std::vector<int> aa;
3941 DataArrayIntTuple *aaa;
3943 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3948 self->applyLin(1,val);
3949 Py_XINCREF(trueSelf);
3954 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3956 Py_XINCREF(trueSelf);
3962 Py_XINCREF(trueSelf);
3967 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3968 self->addEqual(aaaa);
3969 Py_XINCREF(trueSelf);
3973 throw INTERP_KERNEL::Exception(msg);
3977 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3979 const char msg[]="Unexpected situation in __sub__ !";
3982 std::vector<int> aa;
3983 DataArrayIntTuple *aaa;
3985 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
3990 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
3991 ret->applyLin(1,-val);
3996 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3997 return DataArrayInt::Substract(self,aaaa);
4001 return DataArrayInt::Substract(self,a);
4005 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4006 return DataArrayInt::Substract(self,aaaa);
4009 throw INTERP_KERNEL::Exception(msg);
4013 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4015 const char msg[]="Unexpected situation in __rsub__ !";
4018 std::vector<int> aa;
4019 DataArrayIntTuple *aaa;
4021 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4026 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4027 ret->applyLin(-1,val);
4032 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4033 return DataArrayInt::Substract(aaaa,self);
4037 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4038 return DataArrayInt::Substract(aaaa,self);
4041 throw INTERP_KERNEL::Exception(msg);
4045 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4047 const char msg[]="Unexpected situation in __isub__ !";
4050 std::vector<int> aa;
4051 DataArrayIntTuple *aaa;
4053 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4058 self->applyLin(1,-val);
4059 Py_XINCREF(trueSelf);
4064 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4065 self->substractEqual(bb);
4066 Py_XINCREF(trueSelf);
4071 self->substractEqual(a);
4072 Py_XINCREF(trueSelf);
4077 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4078 self->substractEqual(aaaa);
4079 Py_XINCREF(trueSelf);
4083 throw INTERP_KERNEL::Exception(msg);
4087 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4089 const char msg[]="Unexpected situation in __mul__ !";
4092 std::vector<int> aa;
4093 DataArrayIntTuple *aaa;
4095 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4100 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4101 ret->applyLin(val,0);
4106 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4107 return DataArrayInt::Multiply(self,aaaa);
4111 return DataArrayInt::Multiply(self,a);
4115 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4116 return DataArrayInt::Multiply(self,aaaa);
4119 throw INTERP_KERNEL::Exception(msg);
4123 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4125 const char msg[]="Unexpected situation in __rmul__ !";
4128 std::vector<int> aa;
4129 DataArrayIntTuple *aaa;
4131 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4136 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4137 ret->applyLin(val,0);
4142 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4143 return DataArrayInt::Multiply(self,aaaa);
4147 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4148 return DataArrayInt::Multiply(self,aaaa);
4151 throw INTERP_KERNEL::Exception(msg);
4155 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4157 const char msg[]="Unexpected situation in __imul__ !";
4160 std::vector<int> aa;
4161 DataArrayIntTuple *aaa;
4163 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4168 self->applyLin(val,0);
4169 Py_XINCREF(trueSelf);
4174 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4175 self->multiplyEqual(bb);
4176 Py_XINCREF(trueSelf);
4181 self->multiplyEqual(a);
4182 Py_XINCREF(trueSelf);
4187 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4188 self->multiplyEqual(aaaa);
4189 Py_XINCREF(trueSelf);
4193 throw INTERP_KERNEL::Exception(msg);
4197 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4199 const char msg[]="Unexpected situation in __div__ !";
4202 std::vector<int> aa;
4203 DataArrayIntTuple *aaa;
4205 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4210 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4211 ret->applyDivideBy(val);
4216 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4217 return DataArrayInt::Divide(self,aaaa);
4221 return DataArrayInt::Divide(self,a);
4225 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4226 return DataArrayInt::Divide(self,aaaa);
4229 throw INTERP_KERNEL::Exception(msg);
4233 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4235 const char msg[]="Unexpected situation in __rdiv__ !";
4238 std::vector<int> aa;
4239 DataArrayIntTuple *aaa;
4241 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4246 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4252 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4253 return DataArrayInt::Divide(aaaa,self);
4257 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4258 return DataArrayInt::Divide(aaaa,self);
4261 throw INTERP_KERNEL::Exception(msg);
4265 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4267 const char msg[]="Unexpected situation in __idiv__ !";
4270 std::vector<int> aa;
4271 DataArrayIntTuple *aaa;
4273 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4278 self->applyDivideBy(val);
4279 Py_XINCREF(trueSelf);
4284 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4285 self->divideEqual(bb);
4286 Py_XINCREF(trueSelf);
4291 self->divideEqual(a);
4292 Py_XINCREF(trueSelf);
4297 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4298 self->divideEqual(aaaa);
4299 Py_XINCREF(trueSelf);
4303 throw INTERP_KERNEL::Exception(msg);
4307 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4309 const char msg[]="Unexpected situation in __mod__ !";
4312 std::vector<int> aa;
4313 DataArrayIntTuple *aaa;
4315 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4320 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4321 ret->applyModulus(val);
4326 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4327 return DataArrayInt::Modulus(self,aaaa);
4331 return DataArrayInt::Modulus(self,a);
4335 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4336 return DataArrayInt::Modulus(self,aaaa);
4339 throw INTERP_KERNEL::Exception(msg);
4343 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4345 const char msg[]="Unexpected situation in __rmod__ !";
4348 std::vector<int> aa;
4349 DataArrayIntTuple *aaa;
4351 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4356 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4357 ret->applyRModulus(val);
4362 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4363 return DataArrayInt::Modulus(aaaa,self);
4367 return DataArrayInt::Modulus(a,self);
4371 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4372 return DataArrayInt::Modulus(aaaa,self);
4375 throw INTERP_KERNEL::Exception(msg);
4379 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4381 const char msg[]="Unexpected situation in __imod__ !";
4384 std::vector<int> aa;
4385 DataArrayIntTuple *aaa;
4387 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4392 self->applyModulus(val);
4393 Py_XINCREF(trueSelf);
4398 self->modulusEqual(a);
4399 Py_XINCREF(trueSelf);
4404 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4405 self->modulusEqual(aaaa);
4406 Py_XINCREF(trueSelf);
4410 throw INTERP_KERNEL::Exception(msg);
4414 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4416 const char msg[]="Unexpected situation in __pow__ !";
4419 std::vector<int> aa;
4420 DataArrayIntTuple *aaa;
4422 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4427 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4433 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4434 return DataArrayInt::Pow(self,aaaa);
4438 return DataArrayInt::Pow(self,a);
4442 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4443 return DataArrayInt::Pow(self,aaaa);
4446 throw INTERP_KERNEL::Exception(msg);
4450 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4452 const char msg[]="Unexpected situation in __rpow__ !";
4455 std::vector<int> aa;
4456 DataArrayIntTuple *aaa;
4458 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4463 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->deepCpy();
4464 ret->applyRPow(val);
4469 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4470 return DataArrayInt::Pow(aaaa,self);
4474 return DataArrayInt::Pow(a,self);
4478 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4479 return DataArrayInt::Pow(aaaa,self);
4482 throw INTERP_KERNEL::Exception(msg);
4486 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4488 const char msg[]="Unexpected situation in __ipow__ !";
4491 std::vector<int> aa;
4492 DataArrayIntTuple *aaa;
4494 convertObjToPossibleCpp1(obj,sw,val,aa,a,aaa);
4499 self->applyPow(val);
4500 Py_XINCREF(trueSelf);
4506 Py_XINCREF(trueSelf);
4511 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4512 self->powEqual(aaaa);
4513 Py_XINCREF(trueSelf);
4517 throw INTERP_KERNEL::Exception(msg);
4521 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4523 std::ostringstream oss;
4524 self->reprQuickOverview(oss);
4528 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4530 int szArr,sw,iTypppArr;
4531 std::vector<int> stdvecTyyppArr;
4532 const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4533 self->pushBackValsSilent(tmp,tmp+szArr);
4536 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4538 std::vector<int> ret1;
4539 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4540 std::size_t sz=ret0.size();
4541 PyObject *pyRet=PyTuple_New(2);
4542 PyObject *pyRet0=PyList_New((int)sz);
4543 PyObject *pyRet1=PyList_New((int)sz);
4544 for(std::size_t i=0;i<sz;i++)
4546 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4547 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4549 PyTuple_SetItem(pyRet,0,pyRet0);
4550 PyTuple_SetItem(pyRet,1,pyRet1);
4554 PyObject *searchRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4556 DataArrayInt *ret0=0,*ret1=0;
4557 self->searchRangesInListOfIds(listOfIds,ret0,ret1);
4558 PyObject *pyRet=PyTuple_New(2);
4559 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4560 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4564 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4567 bool ret(self->isRange(a,b,c));
4568 PyObject *pyRet=PyTuple_New(2);
4569 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4571 PyTuple_SetItem(pyRet,0,ret0Py);
4573 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4579 PyTuple_SetItem(pyRet,1,ret1Py);
4584 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4586 static const char MSG[]="DataArrayInt.__new__ : the args in input is expected to be a tuple !";
4587 if(!PyTuple_Check(args))
4588 throw INTERP_KERNEL::Exception(MSG);
4589 PyObject *builtinsd(PyEval_GetBuiltins());//borrowed
4590 PyObject *obj(PyDict_GetItemString(builtinsd,"object"));//borrowed
4591 PyObject *selfMeth(PyObject_GetAttrString(obj,"__new__"));
4593 PyObject *tmp0(PyTuple_New(1));
4594 PyTuple_SetItem(tmp0,0,cls); Py_XINCREF(cls);
4595 PyObject *instance(PyObject_CallObject(selfMeth,tmp0));
4597 Py_DECREF(selfMeth);
4598 PyObject *initMeth(PyObject_GetAttrString(instance,"__init__"));
4599 int sz(PyTuple_Size(args));
4601 if(PyTuple_Size(args)==2 && PyDict_Check(PyTuple_GetItem(args,1)) && PyDict_Size(PyTuple_GetItem(args,1))==1 )
4602 {// NOT general case. only true if in unpickeling context ! call __init__. Because for all other cases, __init__ is called right after __new__ !
4603 PyObject *zeNumpyRepr(0);
4604 PyObject *tmp1(PyInt_FromLong(0));
4605 zeNumpyRepr=PyDict_GetItem(PyTuple_GetItem(args,1),tmp1);//borrowed
4607 PyObject *tmp3(PyTuple_New(1));
4608 PyTuple_SetItem(tmp3,0,zeNumpyRepr); Py_XINCREF(zeNumpyRepr);
4609 PyObject *tmp2(PyObject_CallObject(initMeth,tmp3));
4613 Py_DECREF(initMeth);
4617 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4620 if(!self->isAllocated())
4621 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4622 PyObject *ret(PyTuple_New(1));
4623 PyObject *ret0(PyDict_New());
4624 PyObject *numpyArryObj(ParaMEDMEM_DataArrayInt_toNumPyArray(self));
4625 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4626 PyObject *tmp1(PyInt_FromLong(0));
4627 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4628 PyTuple_SetItem(ret,0,ret0);
4632 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4638 class DataArrayIntTuple;
4640 class DataArrayIntIterator
4643 DataArrayIntIterator(DataArrayInt *da);
4644 ~DataArrayIntIterator();
4649 DataArrayIntTuple *ret=self->nextt();
4651 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4654 PyErr_SetString(PyExc_StopIteration,"No more data.");
4661 class DataArrayIntTuple
4664 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4665 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4668 std::string __str__() const throw(INTERP_KERNEL::Exception)
4670 return self->repr();
4673 int __int__() const throw(INTERP_KERNEL::Exception)
4675 return self->intValue();
4678 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4680 return self->buildDAInt(1,self->getNumberOfCompo());
4683 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4685 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4686 ParaMEDMEM_DataArrayInt____iadd___(ret,0,obj);
4687 Py_XINCREF(trueSelf);
4691 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4693 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4694 ParaMEDMEM_DataArrayInt____isub___(ret,0,obj);
4695 Py_XINCREF(trueSelf);
4699 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4701 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4702 ParaMEDMEM_DataArrayInt____imul___(ret,0,obj);
4703 Py_XINCREF(trueSelf);
4707 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4709 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4710 ParaMEDMEM_DataArrayInt____idiv___(ret,0,obj);
4711 Py_XINCREF(trueSelf);
4715 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4717 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4718 ParaMEDMEM_DataArrayInt____imod___(ret,0,obj);
4719 Py_XINCREF(trueSelf);
4723 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4725 return PyInt_FromLong(self->getNumberOfCompo());
4728 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4730 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4733 std::vector<int> multiVal;
4734 std::pair<int, std::pair<int,int> > slic;
4735 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4736 const int *pt=self->getConstPointer();
4737 int nbc=self->getNumberOfCompo();
4738 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4745 std::ostringstream oss;
4746 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4747 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4751 return PyInt_FromLong(pt[singleVal]);
4755 return PyInt_FromLong(pt[nbc+singleVal]);
4758 std::ostringstream oss;
4759 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4760 throw INTERP_KERNEL::Exception(oss.str().c_str());
4766 PyObject *t=PyTuple_New(multiVal.size());
4767 for(int j=0;j<(int)multiVal.size();j++)
4769 int cid=multiVal[j];
4772 std::ostringstream oss;
4773 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4774 throw INTERP_KERNEL::Exception(oss.str().c_str());
4776 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4782 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4783 PyObject *t=PyTuple_New(sz);
4784 for(int j=0;j<sz;j++)
4785 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4789 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4793 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4795 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4796 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4799 std::vector<int> multiValV;
4800 std::pair<int, std::pair<int,int> > slicV;
4801 ParaMEDMEM::DataArrayIntTuple *daIntTyyppV=0;
4802 int nbc=self->getNumberOfCompo();
4803 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4805 std::vector<int> multiVal;
4806 std::pair<int, std::pair<int,int> > slic;
4807 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
4808 int *pt=self->getPointer();
4809 convertObjToPossibleCpp2WithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4816 std::ostringstream oss;
4817 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4818 throw INTERP_KERNEL::Exception(oss.str().c_str());
4824 pt[singleVal]=singleValV;
4829 if(multiValV.size()!=1)
4831 std::ostringstream oss;
4832 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4833 throw INTERP_KERNEL::Exception(oss.str().c_str());
4835 pt[singleVal]=multiValV[0];
4840 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4844 throw INTERP_KERNEL::Exception(msg);
4853 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4857 std::ostringstream oss;
4858 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4859 throw INTERP_KERNEL::Exception(oss.str().c_str());
4867 if(multiVal.size()!=multiValV.size())
4869 std::ostringstream oss;
4870 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4871 throw INTERP_KERNEL::Exception(oss.str().c_str());
4873 for(int i=0;i<(int)multiVal.size();i++)
4875 int pos=multiVal[i];
4878 std::ostringstream oss;
4879 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4880 throw INTERP_KERNEL::Exception(oss.str().c_str());
4882 pt[multiVal[i]]=multiValV[i];
4888 const int *ptV=daIntTyyppV->getConstPointer();
4889 if(nbc>daIntTyyppV->getNumberOfCompo())
4891 std::ostringstream oss;
4892 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4893 throw INTERP_KERNEL::Exception(oss.str().c_str());
4895 std::copy(ptV,ptV+nbc,pt);
4899 throw INTERP_KERNEL::Exception(msg);
4904 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4909 for(int j=0;j<sz;j++)
4910 pt[slic.first+j*slic.second.second]=singleValV;
4915 if(sz!=(int)multiValV.size())
4917 std::ostringstream oss;
4918 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4919 throw INTERP_KERNEL::Exception(oss.str().c_str());
4921 for(int j=0;j<sz;j++)
4922 pt[slic.first+j*slic.second.second]=multiValV[j];
4927 const int *ptV=daIntTyyppV->getConstPointer();
4928 if(sz>daIntTyyppV->getNumberOfCompo())
4930 std::ostringstream oss;
4931 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4932 throw INTERP_KERNEL::Exception(oss.str().c_str());
4934 for(int j=0;j<sz;j++)
4935 pt[slic.first+j*slic.second.second]=ptV[j];
4939 throw INTERP_KERNEL::Exception(msg);
4943 throw INTERP_KERNEL::Exception(msg);
4949 class DataArrayChar : public DataArray
4952 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4953 int getHashCode() const throw(INTERP_KERNEL::Exception);
4954 bool empty() const throw(INTERP_KERNEL::Exception);
4955 void cpyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4956 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4957 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4958 char popBackSilent() throw(INTERP_KERNEL::Exception);
4959 void pack() const throw(INTERP_KERNEL::Exception);
4960 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4961 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4962 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4963 void reverse() throw(INTERP_KERNEL::Exception);
4964 void fillWithZero() throw(INTERP_KERNEL::Exception);
4965 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4966 std::string repr() const throw(INTERP_KERNEL::Exception);
4967 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4968 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4969 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4970 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4971 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4972 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4973 DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4974 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4975 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4976 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception);
4977 char front() const throw(INTERP_KERNEL::Exception);
4978 char back() const throw(INTERP_KERNEL::Exception);
4979 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4980 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4981 char *getPointer() throw(INTERP_KERNEL::Exception);
4982 DataArrayInt *getIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4983 DataArrayInt *getIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4984 int locateTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4985 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4986 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4987 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4988 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4989 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4990 DataArrayInt *getIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4991 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4992 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4995 int __len__() const throw(INTERP_KERNEL::Exception)
4997 if(self->isAllocated())
4999 return self->getNumberOfTuples();
5003 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
5007 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
5010 bool ret0=self->isEqualIfNotWhy(other,ret1);
5011 PyObject *ret=PyTuple_New(2);
5012 PyObject *ret0Py=ret0?Py_True:Py_False;
5014 PyTuple_SetItem(ret,0,ret0Py);
5015 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
5019 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
5022 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5023 if (!SWIG_IsOK(res1))
5026 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5027 if(size!=self->getNumberOfTuples())
5029 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5031 return self->renumber(tmp);
5035 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5037 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5038 da2->checkAllocated();
5039 int size=self->getNumberOfTuples();
5040 if(size!=self->getNumberOfTuples())
5042 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5044 return self->renumber(da2->getConstPointer());
5048 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
5051 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5052 if (!SWIG_IsOK(res1))
5055 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5056 if(size!=self->getNumberOfTuples())
5058 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5060 return self->renumberR(tmp);
5064 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5066 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5067 da2->checkAllocated();
5068 int size=self->getNumberOfTuples();
5069 if(size!=self->getNumberOfTuples())
5071 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5073 return self->renumberR(da2->getConstPointer());
5077 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
5080 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayInt, 0 | 0 );
5081 if (!SWIG_IsOK(res1))
5084 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
5085 if(size!=self->getNumberOfTuples())
5087 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5089 return self->renumberAndReduce(tmp,newNbOfTuple);
5093 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
5095 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
5096 da2->checkAllocated();
5097 int size=self->getNumberOfTuples();
5098 if(size!=self->getNumberOfTuples())
5100 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
5102 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
5106 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5108 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5109 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5110 return DataArrayChar::Aggregate(tmp);
5113 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
5115 std::vector<const ParaMEDMEM::DataArrayChar *> tmp;
5116 convertFromPyObjVectorOfObj<const ParaMEDMEM::DataArrayChar *>(dachs,SWIGTYPE_p_ParaMEDMEM__DataArrayChar,"DataArrayChar",tmp);
5117 return DataArrayChar::Meld(tmp);
5122 class DataArrayByteIterator;
5124 class DataArrayByte : public DataArrayChar
5127 static DataArrayByte *New();
5128 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
5129 DataArrayByte *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5130 char byteValue() const throw(INTERP_KERNEL::Exception);
5133 DataArrayByte() throw(INTERP_KERNEL::Exception)
5135 return DataArrayByte::New();
5138 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5140 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) !";
5141 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5145 if(PyInt_Check(nbOfTuples))
5147 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5149 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5152 if(PyInt_Check(nbOfComp))
5153 {//DataArrayByte.New([1,3,4,5],2,2)
5154 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5156 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5157 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5158 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5159 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5163 throw INTERP_KERNEL::Exception(msg);
5166 {//DataArrayByte.New([1,3,4],3)
5167 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5169 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5170 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5175 throw INTERP_KERNEL::Exception(msg);
5178 {// DataArrayByte.New([1,3,4])
5179 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5180 int tmpp1=-1,tmpp2=-1;
5181 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5182 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5186 else if(PyInt_Check(elt0))
5188 int nbOfTuples1=PyInt_AS_LONG(elt0);
5190 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
5195 if(PyInt_Check(nbOfTuples))
5196 {//DataArrayByte.New(5,2)
5197 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5199 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
5200 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5201 ret->alloc(nbOfTuples1,nbOfCompo);
5205 throw INTERP_KERNEL::Exception(msg);
5208 throw INTERP_KERNEL::Exception(msg);
5211 {//DataArrayByte.New(5)
5212 MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret=DataArrayByte::New();
5213 ret->alloc(nbOfTuples1,1);
5218 throw INTERP_KERNEL::Exception(msg);
5221 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5223 return ParaMEDMEM_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5226 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5228 std::ostringstream oss;
5229 self->reprQuickOverview(oss);
5233 int __int__() const throw(INTERP_KERNEL::Exception)
5235 return (int) self->byteValue();
5238 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
5240 return self->iterator();
5243 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5245 return (int)self->getIJ(tupleId,compoId);
5248 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5250 return (int)self->getIJSafe(tupleId,compoId);
5253 std::string __str__() const throw(INTERP_KERNEL::Exception)
5255 return self->repr();
5258 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5260 const char *vals=self->getConstPointer();
5261 int nbOfComp=self->getNumberOfComponents();
5262 int nbOfTuples=self->getNumberOfTuples();
5263 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5266 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5269 int ival=-1; std::vector<int> ivval;
5270 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5271 std::vector<char> vals(sz);
5272 std::copy(pt,pt+sz,vals.begin());
5273 return self->presenceOfTuple(vals);
5276 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5279 int ival=-1; std::vector<int> ivval;
5280 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5281 std::vector<char> vals2(sz);
5282 std::copy(pt,pt+sz,vals2.begin());
5283 return self->presenceOfValue(vals2);
5286 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5289 int ival=-1; std::vector<int> ivval;
5290 const int *pt=convertObjToPossibleCpp1_Safe(vals,sw,sz,ival,ivval);
5291 std::vector<char> vals2(sz);
5292 std::copy(pt,pt+sz,vals2.begin());
5293 return self->locateValue(vals2);
5296 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5299 int ival=-1; std::vector<int> ivval;
5300 const int *pt=convertObjToPossibleCpp1_Safe(tupl,sw,sz,ival,ivval);
5301 std::vector<char> vals(sz);
5302 std::copy(pt,pt+sz,vals.begin());
5303 return self->locateTuple(vals);
5306 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5309 int ival=-1; std::vector<int> ivval;
5310 const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
5311 std::vector<char> vals(sz);
5312 std::copy(pt,pt+sz,vals.begin());
5313 return self->search(vals);
5316 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5318 int sz=self->getNumberOfComponents();
5319 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5320 self->getTuple(tupleId,tmp);
5321 PyObject *ret=PyTuple_New(sz);
5322 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5326 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5329 int r1=(int)self->getMaxValue(tmp);
5330 PyObject *ret=PyTuple_New(2);
5331 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5332 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5336 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5339 int r1=(int)self->getMinValue(tmp);
5340 PyObject *ret=PyTuple_New(2);
5341 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5342 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5346 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5348 int nbOfCompo=self->getNumberOfComponents();
5353 if(PyInt_Check(obj))
5355 int val=(int)PyInt_AS_LONG(obj);
5356 return self->locateValue(val);
5359 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5362 return ParaMEDMEM_DataArrayByte_locateTuple(self,obj);
5366 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5368 int nbOfCompo=self->getNumberOfComponents();
5375 if(PyInt_Check(obj))
5377 int val=(int)PyInt_AS_LONG(obj);
5378 return self->presenceOfValue(val);
5381 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5384 return ParaMEDMEM_DataArrayByte_presenceOfTuple(self,obj);
5388 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5390 self->checkAllocated();
5391 const char msg[]="Unexpected situation in __setitem__ !";
5392 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5395 std::vector<int> v1;
5397 DataArrayIntTuple *dd1=0;
5398 convertObjToPossibleCpp1(value,sw1,i1,v1,d1,dd1);
5400 std::vector<int> vt1,vc1;
5401 std::pair<int, std::pair<int,int> > pt1,pc1;
5402 DataArrayInt *dt1=0,*dc1=0;
5403 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5404 MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
5412 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5415 throw INTERP_KERNEL::Exception(msg);
5424 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5427 throw INTERP_KERNEL::Exception(msg);
5436 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5439 throw INTERP_KERNEL::Exception(msg);
5448 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5451 throw INTERP_KERNEL::Exception(msg);
5460 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5463 throw INTERP_KERNEL::Exception(msg);
5472 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5475 throw INTERP_KERNEL::Exception(msg);
5484 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5487 throw INTERP_KERNEL::Exception(msg);
5496 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5499 throw INTERP_KERNEL::Exception(msg);
5508 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5511 throw INTERP_KERNEL::Exception(msg);
5520 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5523 throw INTERP_KERNEL::Exception(msg);
5532 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5535 throw INTERP_KERNEL::Exception(msg);
5544 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5547 throw INTERP_KERNEL::Exception(msg);
5556 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5559 throw INTERP_KERNEL::Exception(msg);
5568 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5571 throw INTERP_KERNEL::Exception(msg);
5580 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5583 throw INTERP_KERNEL::Exception(msg);
5592 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5595 throw INTERP_KERNEL::Exception(msg);
5600 throw INTERP_KERNEL::Exception(msg);
5607 class DataArrayByteTuple;
5609 class DataArrayByteIterator
5612 DataArrayByteIterator(DataArrayByte *da);
5613 ~DataArrayByteIterator();
5616 class DataArrayByteTuple
5619 std::string repr() const throw(INTERP_KERNEL::Exception);
5620 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5623 std::string __str__() const throw(INTERP_KERNEL::Exception)
5625 return self->repr();
5628 char __int__() const throw(INTERP_KERNEL::Exception)
5630 return self->byteValue();
5633 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5635 return self->buildDAByte(1,self->getNumberOfCompo());
5640 class DataArrayAsciiCharIterator;
5642 class DataArrayAsciiChar : public DataArrayChar
5645 static DataArrayAsciiChar *New();
5646 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5647 DataArrayAsciiChar *performCpy(bool deepCpy) const throw(INTERP_KERNEL::Exception);
5648 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5651 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5653 return DataArrayAsciiChar::New();
5656 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5658 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) !";
5659 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5663 if(PyInt_Check(nbOfTuples))
5665 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5667 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5670 if(PyInt_Check(nbOfComp))
5671 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5672 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5674 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5675 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5676 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5677 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5681 throw INTERP_KERNEL::Exception(msg);
5684 {//DataArrayAsciiChar.New([1,3,4],3)
5685 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5687 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5688 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5692 else if(PyString_Check(nbOfTuples))
5694 if(PyString_Size(nbOfTuples)!=1)
5695 throw INTERP_KERNEL::Exception(msg);
5696 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5697 std::vector<std::string> tmp;
5698 if(fillStringVector(elt0,tmp))
5699 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5701 throw INTERP_KERNEL::Exception(msg);
5704 throw INTERP_KERNEL::Exception(msg);
5708 std::vector<std::string> tmmp;
5709 if(fillStringVector(elt0,tmmp))
5710 //DataArrayAsciiChar.New(["abc","de","fghi"])
5711 return DataArrayAsciiChar::New(tmmp,' ');
5714 // DataArrayAsciiChar.New([1,3,4])
5715 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5716 int tmpp1=-1,tmpp2=-1;
5717 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5718 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5723 else if(PyInt_Check(elt0))
5725 int nbOfTuples1=PyInt_AS_LONG(elt0);
5727 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5732 if(PyInt_Check(nbOfTuples))
5733 {//DataArrayAsciiChar.New(5,2)
5734 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5736 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5737 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5738 ret->alloc(nbOfTuples1,nbOfCompo);
5742 throw INTERP_KERNEL::Exception(msg);
5745 throw INTERP_KERNEL::Exception(msg);
5748 {//DataArrayAsciiChar.New(5)
5749 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5750 ret->alloc(nbOfTuples1,1);
5755 throw INTERP_KERNEL::Exception(msg);
5758 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5760 return ParaMEDMEM_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5763 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5765 std::ostringstream oss;
5766 self->reprQuickOverview(oss);
5770 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5772 return self->iterator();
5775 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5777 char tmp[2]; tmp[1]='\0';
5778 tmp[0]=self->getIJ(tupleId,compoId);
5779 return std::string(tmp);
5782 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5784 char tmp[2]; tmp[1]='\0';
5785 tmp[0]=self->getIJSafe(tupleId,compoId);
5786 return std::string(tmp);
5789 std::string __str__() const throw(INTERP_KERNEL::Exception)
5791 return self->repr();
5794 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5796 const char *vals=self->getConstPointer();
5797 int nbOfComp=self->getNumberOfComponents();
5798 int nbOfTuples=self->getNumberOfTuples();
5799 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5802 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5804 if(PyString_Check(tupl))
5806 Py_ssize_t sz=PyString_Size(tupl);
5807 std::vector<char> vals(sz);
5808 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5809 return self->presenceOfTuple(vals);
5812 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5815 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5817 if(PyString_Check(vals))
5819 Py_ssize_t sz=PyString_Size(vals);
5820 std::vector<char> vals2(sz);
5821 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5822 return self->presenceOfValue(vals2);
5825 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5828 int locateValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5830 if(PyString_Check(vals))
5832 Py_ssize_t sz=PyString_Size(vals);
5833 std::vector<char> vals2(sz);
5834 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5835 return self->locateValue(vals2);
5838 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateValue : only strings in input supported !");
5841 int locateTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5843 if(PyString_Check(tupl))
5845 Py_ssize_t sz=PyString_Size(tupl);
5846 std::vector<char> vals(sz);
5847 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5848 return self->locateTuple(vals);
5851 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::locateTuple : only strings in input supported !");
5854 int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5856 if(PyString_Check(strOrListOfInt))
5858 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5859 std::vector<char> vals(sz);
5860 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5861 return self->search(vals);
5864 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5867 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5869 int sz=self->getNumberOfComponents();
5870 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5871 self->getTuple(tupleId,tmp);
5872 return PyString_FromString(tmp);
5875 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5878 char tmp2[2]; tmp2[1]='\0';
5879 tmp2[0]=self->getMaxValue(tmp);
5880 PyObject *ret=PyTuple_New(2);
5881 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5882 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5886 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5889 char tmp2[2]; tmp2[1]='\0';
5890 tmp2[0]=self->getMinValue(tmp);
5891 PyObject *ret=PyTuple_New(2);
5892 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5893 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5897 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5899 int nbOfCompo=self->getNumberOfComponents();
5904 if(PyString_Check(obj))
5906 Py_ssize_t sz=PyString_Size(obj);
5907 char *pt=PyString_AsString(obj);
5909 return self->locateValue(pt[0]);
5911 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5914 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5917 return ParaMEDMEM_DataArrayAsciiChar_locateTuple(self,obj);
5921 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5923 int nbOfCompo=self->getNumberOfComponents();
5930 if(PyString_Check(obj))
5932 Py_ssize_t sz=PyString_Size(obj);
5933 char *pt=PyString_AsString(obj);
5935 return self->presenceOfValue(pt[0]);
5937 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5940 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5943 return ParaMEDMEM_DataArrayAsciiChar_presenceOfTuple(self,obj);
5947 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5950 std::vector<int> stdvecTyyppArr;
5951 std::pair<int, std::pair<int,int> > sTyyppArr;
5952 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5953 convertObjToPossibleCpp2WithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5957 return ParaMEDMEM_DataArrayAsciiChar_getTuple(self,iTypppArr);
5959 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5961 return convertDataArrayChar(self->selectByTupleId2(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5963 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5965 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5969 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5971 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.";
5973 std::vector<int> stdvecTyyppArr;
5974 std::pair<int, std::pair<int,int> > sTyyppArr;
5975 ParaMEDMEM::DataArrayInt *daIntTyypp=0;
5976 int nbOfCompo=self->getNumberOfComponents();
5977 int nbOfTuples=self->getNumberOfTuples();
5978 convertObjToPossibleCpp2WithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5980 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5981 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5990 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5996 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5997 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6000 //value vector<string>
6003 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6004 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6007 //value DataArrayChar
6010 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
6014 throw INTERP_KERNEL::Exception(msg);
6018 {//obj list-tuple[int]
6024 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
6030 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6031 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6034 //value vector<string>
6037 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6038 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6041 //value DataArrayChar
6044 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
6048 throw INTERP_KERNEL::Exception(msg);
6059 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
6065 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6066 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6069 //value vector<string>
6072 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6073 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6076 //value DataArrayChar
6079 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
6083 throw INTERP_KERNEL::Exception(msg);
6094 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
6100 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
6101 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6104 //value vector<string>
6107 MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
6108 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6111 //value DataArrayChar
6114 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
6118 throw INTERP_KERNEL::Exception(msg);
6123 throw INTERP_KERNEL::Exception(msg);
6129 class DataArrayAsciiCharTuple;
6131 class DataArrayAsciiCharIterator
6134 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
6135 ~DataArrayAsciiCharIterator();
6140 DataArrayAsciiCharTuple *ret=self->nextt();
6142 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
6145 PyErr_SetString(PyExc_StopIteration,"No more data.");
6152 class DataArrayAsciiCharTuple
6155 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
6156 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
6159 std::string __str__() const throw(INTERP_KERNEL::Exception)
6161 return self->repr();
6164 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
6166 return self->buildDAAsciiChar(1,self->getNumberOfCompo());