1 // Copyright (C) 2007-2016 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 (EDF R&D)
22 %typemap(out) MEDCoupling::DataArray*
24 $result=convertDataArray($1,$owner);
27 %typemap(out) DataArray*
29 $result=convertDataArray($1,$owner);
34 %typemap(out) MEDCoupling::DataArrayChar*
36 $result=convertDataArrayChar($1,$owner);
39 %typemap(out) DataArrayChar*
41 $result=convertDataArrayChar($1,$owner);
44 %typemap(out) MCAuto<MEDCoupling::DataArrayInt>
46 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN|0);
49 %typemap(out) MCAuto<MEDCoupling::DataArrayDouble>
51 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble,SWIG_POINTER_OWN|0);
54 %typemap(out) MCAuto<MEDCoupling::DataArrayFloat>
56 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__DataArrayFloat,SWIG_POINTER_OWN|0);
59 %typemap(out) MCAuto<MEDCoupling::MapII>
61 $result=SWIG_NewPointerObj(SWIG_as_voidptr($1.retn()),SWIGTYPE_p_MEDCoupling__MapII,SWIG_POINTER_OWN|0);
65 %newobject MEDCoupling::DataArray::deepCopy;
66 %newobject MEDCoupling::DataArray::buildNewEmptyInstance;
67 %newobject MEDCoupling::DataArray::selectByTupleRanges;
68 %newobject MEDCoupling::DataArray::selectByTupleId;
69 %newobject MEDCoupling::DataArray::selectByTupleIdSafe;
70 %newobject MEDCoupling::DataArray::selectByTupleIdSafeSlice;
71 %newobject MEDCoupling::DataArray::Aggregate;
72 %newobject MEDCoupling::DataArrayFloat::New;
73 %newobject MEDCoupling::DataArrayFloat::iterator;
74 %newobject MEDCoupling::DataArrayFloat::__iter__;
75 %newobject MEDCoupling::DataArrayFloat::Meld;
76 %newobject MEDCoupling::DataArrayFloat::__rmul__;
77 %newobject MEDCoupling::DataArrayInt::New;
78 %newobject MEDCoupling::DataArrayInt::__iter__;
79 %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef;
80 %newobject MEDCoupling::DataArrayInt::subArray;
81 %newobject MEDCoupling::DataArrayInt::changeNbOfComponents;
82 %newobject MEDCoupling::DataArrayInt::accumulatePerChunck;
83 %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation;
84 %newobject MEDCoupling::DataArrayInt::transformWithIndArrR;
85 %newobject MEDCoupling::DataArrayInt::renumber;
86 %newobject MEDCoupling::DataArrayInt::renumberR;
87 %newobject MEDCoupling::DataArrayInt::renumberAndReduce;
88 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2O;
89 %newobject MEDCoupling::DataArrayInt::invertArrayN2O2O2N;
90 %newobject MEDCoupling::DataArrayInt::invertArrayO2N2N2OBis;
91 %newobject MEDCoupling::DataArrayInt::findIdsEqual;
92 %newobject MEDCoupling::DataArrayInt::findIdsNotEqual;
93 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
94 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
95 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
96 %newobject MEDCoupling::DataArrayInt::findIdForEach;
97 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
98 %newobject MEDCoupling::DataArrayInt::negate;
99 %newobject MEDCoupling::DataArrayInt::computeAbs;
100 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
101 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
102 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
103 %newobject MEDCoupling::DataArrayInt::Aggregate;
104 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
105 %newobject MEDCoupling::DataArrayInt::Meld;
106 %newobject MEDCoupling::DataArrayInt::Add;
107 %newobject MEDCoupling::DataArrayInt::Substract;
108 %newobject MEDCoupling::DataArrayInt::Multiply;
109 %newobject MEDCoupling::DataArrayInt::Divide;
110 %newobject MEDCoupling::DataArrayInt::Pow;
111 %newobject MEDCoupling::DataArrayInt::BuildUnion;
112 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
113 %newobject MEDCoupling::DataArrayInt::Range;
114 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
115 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
116 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
117 %newobject MEDCoupling::DataArrayInt::buildComplement;
118 %newobject MEDCoupling::DataArrayInt::buildUnion;
119 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
120 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
121 %newobject MEDCoupling::DataArrayInt::buildIntersection;
122 %newobject MEDCoupling::DataArrayInt::buildUnique;
123 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
124 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
125 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
126 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
127 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
128 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
129 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
130 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
131 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
132 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
133 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
134 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
135 %newobject MEDCoupling::DataArrayInt::__neg__;
136 %newobject MEDCoupling::DataArrayInt::__add__;
137 %newobject MEDCoupling::DataArrayInt::__radd__;
138 %newobject MEDCoupling::DataArrayInt::__sub__;
139 %newobject MEDCoupling::DataArrayInt::__rsub__;
140 %newobject MEDCoupling::DataArrayInt::__mul__;
141 %newobject MEDCoupling::DataArrayInt::__rmul__;
142 %newobject MEDCoupling::DataArrayInt::__div__;
143 %newobject MEDCoupling::DataArrayInt::__rdiv__;
144 %newobject MEDCoupling::DataArrayInt::__mod__;
145 %newobject MEDCoupling::DataArrayInt::__rmod__;
146 %newobject MEDCoupling::DataArrayInt::__pow__;
147 %newobject MEDCoupling::DataArrayInt::__rpow__;
148 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
149 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
150 %newobject MEDCoupling::DataArrayChar::renumber;
151 %newobject MEDCoupling::DataArrayChar::renumberR;
152 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
153 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
154 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
155 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
156 %newobject MEDCoupling::DataArrayChar::Aggregate;
157 %newobject MEDCoupling::DataArrayChar::Meld;
158 %newobject MEDCoupling::DataArrayByte::New;
159 %newobject MEDCoupling::DataArrayByte::__iter__;
160 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
161 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
162 %newobject MEDCoupling::DataArrayChar::subArray;
163 %newobject MEDCoupling::DataArrayAsciiChar::New;
164 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
165 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
166 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
167 %newobject MEDCoupling::DataArrayDouble::New;
168 %newobject MEDCoupling::DataArrayDouble::__iter__;
169 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
170 %newobject MEDCoupling::DataArrayDouble::Aggregate;
171 %newobject MEDCoupling::DataArrayDouble::Meld;
172 %newobject MEDCoupling::DataArrayDouble::Dot;
173 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
174 %newobject MEDCoupling::DataArrayDouble::Add;
175 %newobject MEDCoupling::DataArrayDouble::Substract;
176 %newobject MEDCoupling::DataArrayDouble::Multiply;
177 %newobject MEDCoupling::DataArrayDouble::Divide;
178 %newobject MEDCoupling::DataArrayDouble::Pow;
179 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
180 %newobject MEDCoupling::DataArrayDouble::subArray;
181 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
182 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
183 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
184 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
185 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
186 %newobject MEDCoupling::DataArrayDouble::negate;
187 %newobject MEDCoupling::DataArrayDouble::computeAbs;
188 %newobject MEDCoupling::DataArrayDouble::applyFunc;
189 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
190 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
191 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
192 %newobject MEDCoupling::DataArrayDouble::determinant;
193 %newobject MEDCoupling::DataArrayDouble::eigenValues;
194 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
195 %newobject MEDCoupling::DataArrayDouble::inverse;
196 %newobject MEDCoupling::DataArrayDouble::trace;
197 %newobject MEDCoupling::DataArrayDouble::deviator;
198 %newobject MEDCoupling::DataArrayDouble::magnitude;
199 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
200 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
201 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
202 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
203 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
204 %newobject MEDCoupling::DataArrayDouble::renumber;
205 %newobject MEDCoupling::DataArrayDouble::renumberR;
206 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
207 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
208 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
209 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
210 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
211 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
212 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
213 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
214 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
215 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
216 %newobject MEDCoupling::DataArrayDouble::cartesianize;
217 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
218 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
219 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
220 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
221 %newobject MEDCoupling::DataArrayDouble::__neg__;
222 %newobject MEDCoupling::DataArrayDouble::__radd__;
223 %newobject MEDCoupling::DataArrayDouble::__rsub__;
224 %newobject MEDCoupling::DataArrayDouble::__rmul__;
225 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
226 %newobject MEDCoupling::DataArrayDouble::__pow__;
227 %newobject MEDCoupling::DataArrayDouble::__rpow__;
228 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
230 %newobject MEDCoupling::PartDefinition::New;
231 %newobject MEDCoupling::PartDefinition::toDAI;
232 %newobject MEDCoupling::PartDefinition::__add__;
233 %newobject MEDCoupling::PartDefinition::composeWith;
234 %newobject MEDCoupling::PartDefinition::tryToSimplify;
235 %newobject MEDCoupling::DataArrayPartDefinition::New;
236 %newobject MEDCoupling::SlicePartDefinition::New;
239 %feature("unref") DataArray "$this->decrRef();"
240 %feature("unref") DataArrayDouble "$this->decrRef();"
241 %feature("unref") DataArrayInt "$this->decrRef();"
242 %feature("unref") DataArrayChar "$this->decrRef();"
243 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
244 %feature("unref") DataArrayByte "$this->decrRef();"
246 %feature("unref") MapII "$this->decrRef();"
247 %feature("unref") PartDefinition "$this->decrRef();"
248 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
249 %feature("unref") SlicePartDefinition "$this->decrRef();"
251 namespace MEDCoupling
258 } MEDCouplingAxisType;
262 class MapII : public RefCountObject, public TimeLabel
265 static MCAuto< MapII > New();
268 class PartDefinition : public RefCountObject, public TimeLabel
271 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
272 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
273 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
274 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
275 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
276 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
277 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
278 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
281 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
283 return (*self)+other;
286 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
289 bool ret0(self->isEqual(other,ret1));
290 PyObject *ret=PyTuple_New(2);
291 PyObject *ret0Py=ret0?Py_True:Py_False;
293 PyTuple_SetItem(ret,0,ret0Py);
294 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
298 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
300 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
304 virtual ~PartDefinition();
307 class DataArrayPartDefinition : public PartDefinition
310 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
313 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
315 return DataArrayPartDefinition::New(listOfIds);
318 std::string __str__() const throw(INTERP_KERNEL::Exception)
320 return self->getRepr();
323 std::string __repr__() const throw(INTERP_KERNEL::Exception)
325 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
326 oss << self->getRepr();
331 virtual ~DataArrayPartDefinition();
334 class SlicePartDefinition : public PartDefinition
337 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
338 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
341 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
343 return SlicePartDefinition::New(start,stop,step);
346 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
349 self->getSlice(a,b,c);
350 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
353 std::string __str__() const throw(INTERP_KERNEL::Exception)
355 return self->getRepr();
358 std::string __repr__() const throw(INTERP_KERNEL::Exception)
360 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
361 oss << self->getRepr();
366 virtual ~SlicePartDefinition();
369 class DataArray : public RefCountObject, public TimeLabel
372 void setName(const std::string& name);
373 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
374 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
375 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
376 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
377 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
378 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
379 std::string getName() const;
380 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
381 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
382 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
383 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
384 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
385 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
386 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
387 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
388 int getNumberOfComponents() const;
389 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
390 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
391 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
392 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
393 virtual void desallocate() throw(INTERP_KERNEL::Exception);
394 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
395 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
396 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
397 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
398 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
399 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
400 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
401 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
402 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
403 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
404 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
405 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
406 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
407 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
408 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
409 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
410 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
411 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
412 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
413 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
414 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
415 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
416 void updateTime() const;
419 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
421 const std::vector<std::string>& comps=self->getInfoOnComponents();
422 PyObject *ret=PyList_New((int)comps.size());
423 for(int i=0;i<(int)comps.size();i++)
424 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
428 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
430 std::vector<int> tmp;
431 convertPyToNewIntArr3(li,tmp);
432 self->copyPartOfStringInfoFrom(other,tmp);
435 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
437 std::vector<int> tmp;
438 convertPyToNewIntArr3(li,tmp);
439 self->copyPartOfStringInfoFrom2(tmp,other);
442 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
445 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
446 if (!SWIG_IsOK(res1))
449 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
450 if(size!=self->getNumberOfTuples())
452 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
454 self->renumberInPlace(tmp);
458 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
460 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
461 da2->checkAllocated();
462 int size=self->getNumberOfTuples();
463 if(size!=self->getNumberOfTuples())
465 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
467 self->renumberInPlace(da2->getConstPointer());
471 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
474 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
475 if (!SWIG_IsOK(res1))
478 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
479 if(size!=self->getNumberOfTuples())
481 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
483 self->renumberInPlaceR(tmp);
487 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
489 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
490 da2->checkAllocated();
491 int size=self->getNumberOfTuples();
492 if(size!=self->getNumberOfTuples())
494 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
496 self->renumberInPlaceR(da2->getConstPointer());
500 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
501 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
503 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
504 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
505 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
506 DataArrayInt *tuplesSelecPtr2=0;
509 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
511 throw INTERP_KERNEL::Exception(msg);
513 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
516 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
518 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
519 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
522 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
524 std::vector<std::pair<int,int> > ranges;
525 convertPyToVectorPairInt(li,ranges);
526 return self->selectByTupleRanges(ranges);
529 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
532 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
533 if (!SWIG_IsOK(res1))
536 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
537 return self->selectByTupleId(tmp,tmp+size);
541 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
543 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
544 da2->checkAllocated();
545 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
549 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
552 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
553 if (!SWIG_IsOK(res1))
556 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
557 return self->selectByTupleIdSafe(tmp,tmp+size);
561 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
563 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
564 da2->checkAllocated();
565 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
569 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
571 std::vector<int> tmp;
572 convertPyToNewIntArr3(li,tmp);
573 DataArray *ret=self->keepSelectedComponents(tmp);
574 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
577 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
579 if(!PySlice_Check(slic))
580 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
581 Py_ssize_t strt=2,stp=2,step=2;
582 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
584 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
585 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
588 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
590 if(!PySlice_Check(slic))
591 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
592 Py_ssize_t strt=2,stp=2,step=2;
593 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
595 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
596 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
599 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
601 if(!PySlice_Check(slic))
602 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
603 Py_ssize_t strt=2,stp=2,step=2;
604 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
605 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
608 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
610 if(!PySlice_Check(slic))
611 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
612 Py_ssize_t strt=2,stp=2,step=2;
613 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
614 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
617 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
619 std::vector<const DataArray *> tmp;
620 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
621 return DataArray::Aggregate(tmp);
624 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
626 if(!PySlice_Check(slic))
627 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
628 Py_ssize_t strt=2,stp=2,step=2;
629 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
630 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
633 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
635 if(!PySlice_Check(slic))
636 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
637 Py_ssize_t strt=2,stp=2,step=2;
638 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
639 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
642 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
644 PyObject *ret(PyTuple_New(2));
645 std::string a0(self->getName());
646 const std::vector<std::string> &a1(self->getInfoOnComponents());
647 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
650 PyObject *ret1(PyList_New(sz));
651 for(int i=0;i<sz;i++)
652 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
653 PyTuple_SetItem(ret,1,ret1);
658 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
660 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 !";
661 if(!PyTuple_Check(inp))
662 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
663 int sz(PyTuple_Size(inp));
665 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
666 PyObject *a0(PyTuple_GetItem(inp,0));
667 self->setName(convertPyObjectToStr(a0,MSG));
668 PyObject *a1(PyTuple_GetItem(inp,1));
669 std::vector<std::string> a1cpp;
670 if(!fillStringVector(a1,a1cpp))
671 throw INTERP_KERNEL::Exception(MSG);
672 self->setInfoOnComponents(a1cpp);
677 class DataArrayDouble;
679 class DataArrayFloat : public DataArray
682 static DataArrayFloat *New();
683 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
684 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
685 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
686 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
687 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
688 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
689 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
690 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
691 static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
694 DataArrayFloat() throw(INTERP_KERNEL::Exception)
696 return DataArrayFloat::New();
699 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
701 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
704 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
706 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
709 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
711 return self->iterator();
714 std::string __repr__() const throw(INTERP_KERNEL::Exception)
716 std::ostringstream oss;
717 self->reprQuickOverview(oss);
721 std::string __str__() const throw(INTERP_KERNEL::Exception)
723 return self->reprNotTooLong();
726 int __len__() const throw(INTERP_KERNEL::Exception)
728 if(self->isAllocated())
730 return self->getNumberOfTuples();
734 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
738 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
740 const float *vals(self->begin());
741 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
744 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
746 const float *vals(self->begin());
747 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
748 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
751 PyObject *isEqualIfNotWhy(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception)
754 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
755 PyObject *ret=PyTuple_New(2);
756 PyObject *ret0Py=ret0?Py_True:Py_False;
758 PyTuple_SetItem(ret,0,ret0Py);
759 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
763 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
765 return DataArrayT__getitem<float>(self,obj);
768 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
770 return DataArrayT__setitem__<float>(self,obj,value);
773 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
775 return DataArrayT_iadd<float>(trueSelf,obj,self);
778 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
780 return DataArrayT_isub<float>(trueSelf,obj,self);
783 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
785 return DataArrayT_imul<float>(trueSelf,obj,self);
788 DataArrayFloat *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
790 return DataArrayFPT_rmul<float>(self,obj);
793 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
795 return DataArrayT_idiv<float>(trueSelf,obj,self);
799 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
801 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
807 class DataArrayFloatTuple;
809 class DataArrayFloatIterator
812 DataArrayFloatIterator(DataArrayFloat *da);
813 ~DataArrayFloatIterator();
818 DataArrayFloatTuple *ret=self->nextt();
820 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
823 PyErr_SetString(PyExc_StopIteration,"No more data.");
830 class DataArrayFloatTuple
833 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
834 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
837 std::string __str__() const throw(INTERP_KERNEL::Exception)
842 float __float__() const throw(INTERP_KERNEL::Exception)
844 return self->floatValue();
847 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
849 return self->buildDAFloat(1,self->getNumberOfCompo());
852 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
854 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
855 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
856 Py_XINCREF(trueSelf);
860 PyObject *__len__() throw(INTERP_KERNEL::Exception)
862 return PyInt_FromLong(self->getNumberOfCompo());
868 class DataArrayDoubleIterator;
870 class DataArrayDouble : public DataArray
873 static DataArrayDouble *New();
874 double doubleValue() const throw(INTERP_KERNEL::Exception);
875 bool empty() const throw(INTERP_KERNEL::Exception);
876 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
877 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
878 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
879 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
880 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
881 double popBackSilent() throw(INTERP_KERNEL::Exception);
882 void pack() const throw(INTERP_KERNEL::Exception);
883 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
884 void fillWithZero() throw(INTERP_KERNEL::Exception);
885 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
886 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
887 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
888 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
889 void reverse() throw(INTERP_KERNEL::Exception);
890 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
891 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
892 std::string repr() const throw(INTERP_KERNEL::Exception);
893 std::string reprZip() const throw(INTERP_KERNEL::Exception);
894 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
895 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
896 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
897 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
898 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
899 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
900 void transpose() throw(INTERP_KERNEL::Exception);
901 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
902 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
903 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
904 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
905 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
906 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
907 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
908 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
909 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
910 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
911 double front() const throw(INTERP_KERNEL::Exception);
912 double back() const throw(INTERP_KERNEL::Exception);
913 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
914 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
915 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
916 double *getPointer() throw(INTERP_KERNEL::Exception);
917 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
918 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
919 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
920 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
921 double getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
922 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
923 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
924 double getAverageValue() const throw(INTERP_KERNEL::Exception);
925 double norm2() const throw(INTERP_KERNEL::Exception);
926 double normMax() const throw(INTERP_KERNEL::Exception);
927 double normMin() const throw(INTERP_KERNEL::Exception);
928 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
929 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
930 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
931 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
948 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
949 void abs() throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
951 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
952 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
953 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
954 void applyPow(double val) throw(INTERP_KERNEL::Exception);
955 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
956 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
960 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
963 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
964 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
965 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
966 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
967 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
968 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
969 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
970 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
971 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
972 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
973 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
974 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
975 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
976 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
977 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
978 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
979 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
980 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
981 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
982 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
983 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
984 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
985 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
986 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
987 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
988 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
989 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
990 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
991 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
994 DataArrayDouble() throw(INTERP_KERNEL::Exception)
996 return DataArrayDouble::New();
999 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1001 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1004 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1006 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1009 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1012 std::vector<double> bb;
1014 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1015 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1016 self->pushBackValsSilent(tmp,tmp+nbTuples);
1019 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1021 std::ostringstream oss;
1022 self->reprQuickOverview(oss);
1026 std::string __str__() const throw(INTERP_KERNEL::Exception)
1028 return self->reprNotTooLong();
1031 double __float__() const throw(INTERP_KERNEL::Exception)
1033 return self->doubleValue();
1036 int __len__() const throw(INTERP_KERNEL::Exception)
1038 if(self->isAllocated())
1040 return self->getNumberOfTuples();
1044 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1048 PyObject *asArcOfCircle() const throw(INTERP_KERNEL::Exception)
1050 double center[2],radius,ang;
1051 self->asArcOfCircle(center,radius,ang);
1052 PyObject *ret(PyTuple_New(3));
1054 PyObject *ret0(PyList_New(2));
1055 PyList_SetItem(ret0,0,PyFloat_FromDouble(center[0]));
1056 PyList_SetItem(ret0,1,PyFloat_FromDouble(center[1]));
1057 PyTuple_SetItem(ret,0,ret0);
1059 PyTuple_SetItem(ret,1,PyFloat_FromDouble(radius));
1060 PyTuple_SetItem(ret,2,PyFloat_FromDouble(ang));
1064 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1066 return self->iterator();
1069 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1071 const char *msg="MEDCoupling::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 !";
1072 if(PyList_Check(li) || PyTuple_Check(li))
1076 if(PyInt_Check(nbOfTuples))
1078 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1080 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1083 if(PyInt_Check(nbOfComp))
1084 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1085 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1087 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1088 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1089 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1092 throw INTERP_KERNEL::Exception(msg);
1095 {//DataArrayDouble.setValues([1.,3.,4.],3)
1097 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1098 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1102 throw INTERP_KERNEL::Exception(msg);
1105 {// DataArrayDouble.setValues([1.,3.,4.])
1106 int tmpp1=-1,tmpp2=-1;
1107 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1108 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1112 throw INTERP_KERNEL::Exception(msg);
1115 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1117 const double *vals(self->begin());
1118 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1122 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1124 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1128 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1131 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1132 PyObject *ret=PyTuple_New(2);
1133 PyObject *ret0Py=ret0?Py_True:Py_False;
1135 PyTuple_SetItem(ret,0,ret0Py);
1136 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1140 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1142 const double *vals(self->begin());
1143 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1144 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1147 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1149 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1151 DataArrayDouble *a,*a2;
1152 DataArrayDoubleTuple *aa,*aa2;
1153 std::vector<double> bb,bb2;
1155 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1156 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1157 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1161 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1163 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1165 DataArrayDouble *a,*a2;
1166 DataArrayDoubleTuple *aa,*aa2;
1167 std::vector<double> bb,bb2;
1169 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1171 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1172 return convertDblArrToPyListOfTuple<double>(res,3,3);
1175 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1177 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1179 DataArrayDouble *a,*a2;
1180 DataArrayDoubleTuple *aa,*aa2;
1181 std::vector<double> bb,bb2;
1183 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1184 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1185 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1188 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1191 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1192 if (!SWIG_IsOK(res1))
1195 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1196 if(size!=self->getNumberOfTuples())
1198 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1200 return self->renumber(tmp);
1204 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1206 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1207 da2->checkAllocated();
1208 int size=self->getNumberOfTuples();
1209 if(size!=self->getNumberOfTuples())
1211 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1213 return self->renumber(da2->getConstPointer());
1217 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1220 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1221 if (!SWIG_IsOK(res1))
1224 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1225 if(size!=self->getNumberOfTuples())
1227 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1229 return self->renumberR(tmp);
1233 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1235 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1236 da2->checkAllocated();
1237 int size=self->getNumberOfTuples();
1238 if(size!=self->getNumberOfTuples())
1240 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1242 return self->renumberR(da2->getConstPointer());
1246 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1249 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1250 if (!SWIG_IsOK(res1))
1253 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1254 if(size!=self->getNumberOfTuples())
1256 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1258 return self->renumberAndReduce(tmp,newNbOfTuple);
1262 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1264 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1265 da2->checkAllocated();
1266 int size=self->getNumberOfTuples();
1267 if(size!=self->getNumberOfTuples())
1269 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1271 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1275 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1277 int thisTupleId,otherTupleId;
1278 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1279 PyObject *ret=PyTuple_New(3);
1280 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1281 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1282 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1286 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1289 double r1=self->getMaxValue(tmp);
1290 PyObject *ret=PyTuple_New(2);
1291 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1292 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1296 PyObject *getMaxAbsValue() const throw(INTERP_KERNEL::Exception)
1299 double r1=self->getMaxAbsValue(tmp);
1300 PyObject *ret=PyTuple_New(2);
1301 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1302 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1306 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1309 double r1=self->getMaxValue2(tmp);
1310 PyObject *ret=PyTuple_New(2);
1311 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1312 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1316 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1319 double r1=self->getMinValue(tmp);
1320 PyObject *ret=PyTuple_New(2);
1321 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1322 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1326 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1329 double r1=self->getMinValue2(tmp);
1330 PyObject *ret=PyTuple_New(2);
1331 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1332 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1336 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1338 int nbOfCompo(self->getNumberOfComponents());
1339 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1340 self->getMinMaxPerComponent(tmp);
1341 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1345 PyObject *normMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1347 int nbOfCompo(self->getNumberOfComponents());
1348 INTERP_KERNEL::AutoPtr<double> tmp(new double[nbOfCompo]);
1349 self->normMaxPerComponent(tmp);
1350 return convertDblArrToPyList<double>(tmp,nbOfCompo);
1353 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1355 int sz=self->getNumberOfComponents();
1356 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1357 self->accumulate(tmp);
1358 return convertDblArrToPyList<double>(tmp,sz);
1361 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1364 std::vector<int> val2;
1365 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1366 return self->accumulatePerChunck(bg,bg+sz);
1369 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1371 DataArrayInt *comm, *commIndex;
1372 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1373 PyObject *res = PyList_New(2);
1374 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1375 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1379 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1383 DataArrayDoubleTuple *aa;
1384 std::vector<double> bb;
1386 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1387 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1389 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1390 PyObject *ret=PyTuple_New(2);
1391 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1392 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1396 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1398 std::vector<int> tmp;
1399 convertPyToNewIntArr3(li,tmp);
1400 self->setSelectedComponents(a,tmp);
1403 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1405 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1406 std::size_t sz(retCpp.size());
1407 PyObject *res(PyList_New(sz));
1408 for(std::size_t i=0;i<sz;i++)
1409 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1413 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1415 int sz=self->getNumberOfComponents();
1416 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1417 self->getTuple(tupleId,tmp);
1418 return convertDblArrToPyList<double>(tmp,sz);
1421 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1423 std::vector<const DataArrayDouble *> tmp;
1424 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1425 return DataArrayDouble::Aggregate(tmp);
1428 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1430 std::vector<const DataArrayDouble *> tmp;
1431 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1432 return DataArrayDouble::Meld(tmp);
1435 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1439 DataArrayDoubleTuple *aa;
1440 std::vector<double> bb;
1442 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1443 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1444 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1445 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1446 DataArrayInt *c=0,*cI=0;
1447 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1448 PyObject *ret=PyTuple_New(2);
1449 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1450 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1454 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1456 DataArrayInt *ret1=0;
1457 bool ret0=self->areIncludedInMe(other,prec,ret1);
1458 PyObject *ret=PyTuple_New(2);
1459 PyObject *ret0Py=ret0?Py_True:Py_False;
1461 PyTuple_SetItem(ret,0,ret0Py);
1462 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1466 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1468 return DataArrayT__getitem<double>(self,obj);
1471 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1473 return DataArrayT__setitem__<double>(self,obj,value);
1476 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1478 return self->negate();
1481 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1483 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1486 DataArrayDoubleTuple *aa;
1487 std::vector<double> bb;
1490 #ifndef WITHOUT_AUTOFIELD
1492 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1494 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1497 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1498 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1500 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1503 throw INTERP_KERNEL::Exception(msg);
1507 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1512 MCAuto<DataArrayDouble> ret=self->deepCopy();
1513 ret->applyLin(1.,val);
1514 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1518 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1522 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1523 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1527 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1528 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1531 throw INTERP_KERNEL::Exception(msg);
1535 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1537 const char msg[]="Unexpected situation in __radd__ !";
1540 DataArrayDoubleTuple *aa;
1541 std::vector<double> bb;
1543 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1548 MCAuto<DataArrayDouble> ret=self->deepCopy();
1549 ret->applyLin(1.,val);
1554 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1555 return DataArrayDouble::Add(self,aaa);
1559 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1560 return DataArrayDouble::Add(self,aaa);
1563 throw INTERP_KERNEL::Exception(msg);
1567 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1569 return DataArrayT_iadd<double>(trueSelf,obj,self);
1572 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1574 const char msg[]="Unexpected situation in __sub__ !";
1577 DataArrayDoubleTuple *aa;
1578 std::vector<double> bb;
1581 #ifndef WITHOUT_AUTOFIELD
1583 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1585 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1588 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1589 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1591 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1594 throw INTERP_KERNEL::Exception(msg);
1598 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1603 MCAuto<DataArrayDouble> ret=self->deepCopy();
1604 ret->applyLin(1.,-val);
1605 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1609 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1613 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1614 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1618 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1619 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1622 throw INTERP_KERNEL::Exception(msg);
1626 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1628 const char msg[]="Unexpected situation in __rsub__ !";
1631 DataArrayDoubleTuple *aa;
1632 std::vector<double> bb;
1634 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1639 MCAuto<DataArrayDouble> ret=self->deepCopy();
1640 ret->applyLin(-1.,val);
1645 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1646 return DataArrayDouble::Substract(aaa,self);
1650 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1651 return DataArrayDouble::Substract(aaa,self);
1654 throw INTERP_KERNEL::Exception(msg);
1658 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1660 return DataArrayT_isub<double>(trueSelf,obj,self);
1663 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1665 const char msg[]="Unexpected situation in __mul__ !";
1668 DataArrayDoubleTuple *aa;
1669 std::vector<double> bb;
1672 #ifndef WITHOUT_AUTOFIELD
1674 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1676 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1679 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1680 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1682 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1685 throw INTERP_KERNEL::Exception(msg);
1689 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1694 MCAuto<DataArrayDouble> ret=self->deepCopy();
1695 ret->applyLin(val,0.);
1696 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1700 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1704 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1705 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1709 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1710 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1713 throw INTERP_KERNEL::Exception(msg);
1717 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1719 return DataArrayFPT_rmul<double>(self,obj);
1722 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1724 return DataArrayT_imul<double>(trueSelf,obj,self);
1727 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1729 const char msg[]="Unexpected situation in __div__ !";
1732 DataArrayDoubleTuple *aa;
1733 std::vector<double> bb;
1736 #ifndef WITHOUT_AUTOFIELD
1738 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1740 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1743 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1744 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1746 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1749 throw INTERP_KERNEL::Exception(msg);
1753 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1759 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1760 MCAuto<DataArrayDouble> ret=self->deepCopy();
1761 ret->applyLin(1/val,0.);
1762 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1766 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1770 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1771 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1775 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1776 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1779 throw INTERP_KERNEL::Exception(msg);
1783 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1785 const char msg[]="Unexpected situation in __rdiv__ !";
1788 DataArrayDoubleTuple *aa;
1789 std::vector<double> bb;
1791 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1796 MCAuto<DataArrayDouble> ret=self->deepCopy();
1802 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1803 return DataArrayDouble::Divide(aaa,self);
1807 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1808 return DataArrayDouble::Divide(aaa,self);
1811 throw INTERP_KERNEL::Exception(msg);
1815 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1817 return DataArrayT_idiv<double>(trueSelf,obj,self);
1820 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1822 const char msg[]="Unexpected situation in __pow__ !";
1825 DataArrayDoubleTuple *aa;
1826 std::vector<double> bb;
1828 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1833 MCAuto<DataArrayDouble> ret=self->deepCopy();
1839 return DataArrayDouble::Pow(self,a);
1843 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1844 return DataArrayDouble::Pow(self,aaa);
1848 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1849 return DataArrayDouble::Pow(self,aaa);
1852 throw INTERP_KERNEL::Exception(msg);
1856 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1858 const char msg[]="Unexpected situation in __rpow__ !";
1861 DataArrayDoubleTuple *aa;
1862 std::vector<double> bb;
1864 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1869 MCAuto<DataArrayDouble> ret=self->deepCopy();
1870 ret->applyRPow(val);
1875 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1876 return DataArrayDouble::Pow(aaa,self);
1880 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1881 return DataArrayDouble::Pow(aaa,self);
1884 throw INTERP_KERNEL::Exception(msg);
1888 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1890 const char msg[]="Unexpected situation in __ipow__ !";
1893 DataArrayDoubleTuple *aa;
1894 std::vector<double> bb;
1896 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1901 self->applyPow(val);
1902 Py_XINCREF(trueSelf);
1908 Py_XINCREF(trueSelf);
1913 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1914 self->powEqual(aaa);
1915 Py_XINCREF(trueSelf);
1920 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1921 self->powEqual(aaa);
1922 Py_XINCREF(trueSelf);
1926 throw INTERP_KERNEL::Exception(msg);
1930 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1932 DataArrayInt *c=0,*cI=0;
1934 self->computeTupleIdsNearTuples(other,eps,c,cI);
1935 PyObject *ret=PyTuple_New(2);
1936 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1937 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1941 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1943 DataArrayInt *ret1=0;
1944 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1945 PyObject *ret=PyTuple_New(2);
1946 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1947 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1953 class DataArrayDoubleTuple;
1955 class DataArrayDoubleIterator
1958 DataArrayDoubleIterator(DataArrayDouble *da);
1959 ~DataArrayDoubleIterator();
1964 DataArrayDoubleTuple *ret=self->nextt();
1966 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1969 PyErr_SetString(PyExc_StopIteration,"No more data.");
1976 class DataArrayDoubleTuple
1979 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1980 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1983 std::string __str__() const throw(INTERP_KERNEL::Exception)
1985 return self->repr();
1988 double __float__() const throw(INTERP_KERNEL::Exception)
1990 return self->doubleValue();
1993 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
1995 return self->buildDADouble(1,self->getNumberOfCompo());
1998 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2000 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2001 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2002 Py_XINCREF(trueSelf);
2006 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2008 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2009 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2010 Py_XINCREF(trueSelf);
2014 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2016 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2017 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2018 Py_XINCREF(trueSelf);
2022 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2024 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2025 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2026 Py_XINCREF(trueSelf);
2030 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2032 return PyInt_FromLong(self->getNumberOfCompo());
2035 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2037 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2040 std::vector<int> multiVal;
2041 std::pair<int, std::pair<int,int> > slic;
2042 MEDCoupling::DataArrayInt *daIntTyypp=0;
2043 const double *pt=self->getConstPointer();
2044 int nbc=self->getNumberOfCompo();
2045 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2052 std::ostringstream oss;
2053 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2054 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2058 return PyFloat_FromDouble(pt[singleVal]);
2062 return PyFloat_FromDouble(pt[nbc+singleVal]);
2065 std::ostringstream oss;
2066 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2067 throw INTERP_KERNEL::Exception(oss.str().c_str());
2073 PyObject *t=PyTuple_New(multiVal.size());
2074 for(int j=0;j<(int)multiVal.size();j++)
2076 int cid=multiVal[j];
2079 std::ostringstream oss;
2080 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2081 throw INTERP_KERNEL::Exception(oss.str().c_str());
2083 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2089 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2090 PyObject *t=PyTuple_New(sz);
2091 for(int j=0;j<sz;j++)
2092 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2096 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2100 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2102 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2103 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2106 std::vector<double> multiValV;
2107 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2108 int nbc=self->getNumberOfCompo();
2109 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2111 std::vector<int> multiVal;
2112 std::pair<int, std::pair<int,int> > slic;
2113 MEDCoupling::DataArrayInt *daIntTyypp=0;
2114 double *pt=self->getPointer();
2115 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2122 std::ostringstream oss;
2123 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2124 throw INTERP_KERNEL::Exception(oss.str().c_str());
2130 pt[singleVal]=singleValV;
2135 if(multiValV.size()!=1)
2137 std::ostringstream oss;
2138 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2139 throw INTERP_KERNEL::Exception(oss.str().c_str());
2141 pt[singleVal]=multiValV[0];
2146 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2150 throw INTERP_KERNEL::Exception(msg);
2159 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2163 std::ostringstream oss;
2164 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2165 throw INTERP_KERNEL::Exception(oss.str().c_str());
2173 if(multiVal.size()!=multiValV.size())
2175 std::ostringstream oss;
2176 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2177 throw INTERP_KERNEL::Exception(oss.str().c_str());
2179 for(int i=0;i<(int)multiVal.size();i++)
2181 int pos=multiVal[i];
2184 std::ostringstream oss;
2185 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2186 throw INTERP_KERNEL::Exception(oss.str().c_str());
2188 pt[multiVal[i]]=multiValV[i];
2194 const double *ptV=daIntTyyppV->getConstPointer();
2195 if(nbc>daIntTyyppV->getNumberOfCompo())
2197 std::ostringstream oss;
2198 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2199 throw INTERP_KERNEL::Exception(oss.str().c_str());
2201 std::copy(ptV,ptV+nbc,pt);
2205 throw INTERP_KERNEL::Exception(msg);
2210 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2215 for(int j=0;j<sz;j++)
2216 pt[slic.first+j*slic.second.second]=singleValV;
2221 if(sz!=(int)multiValV.size())
2223 std::ostringstream oss;
2224 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2225 throw INTERP_KERNEL::Exception(oss.str().c_str());
2227 for(int j=0;j<sz;j++)
2228 pt[slic.first+j*slic.second.second]=multiValV[j];
2233 const double *ptV=daIntTyyppV->getConstPointer();
2234 if(sz>daIntTyyppV->getNumberOfCompo())
2236 std::ostringstream oss;
2237 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2238 throw INTERP_KERNEL::Exception(oss.str().c_str());
2240 for(int j=0;j<sz;j++)
2241 pt[slic.first+j*slic.second.second]=ptV[j];
2245 throw INTERP_KERNEL::Exception(msg);
2249 throw INTERP_KERNEL::Exception(msg);
2255 class DataArrayIntIterator;
2257 class DataArrayInt : public DataArray
2260 static DataArrayInt *New();
2261 int intValue() const throw(INTERP_KERNEL::Exception);
2262 int getHashCode() const throw(INTERP_KERNEL::Exception);
2263 bool empty() const throw(INTERP_KERNEL::Exception);
2264 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2265 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2266 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2267 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2268 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2269 int popBackSilent() throw(INTERP_KERNEL::Exception);
2270 void pack() const throw(INTERP_KERNEL::Exception);
2271 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2272 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2273 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2274 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2275 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2276 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2277 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2278 void reverse() throw(INTERP_KERNEL::Exception);
2279 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2280 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2281 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2282 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2283 void fillWithZero() throw(INTERP_KERNEL::Exception);
2284 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2285 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2286 std::string repr() const throw(INTERP_KERNEL::Exception);
2287 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2288 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2289 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2290 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2291 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2292 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2293 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2294 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2295 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2296 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2297 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2298 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2299 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2300 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2301 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2302 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2303 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2304 void transpose() throw(INTERP_KERNEL::Exception);
2305 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2306 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2307 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2308 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2309 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2310 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2311 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2312 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2313 int front() const throw(INTERP_KERNEL::Exception);
2314 int back() const throw(INTERP_KERNEL::Exception);
2315 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2316 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2317 int *getPointer() throw(INTERP_KERNEL::Exception);
2318 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2319 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2320 const int *begin() const throw(INTERP_KERNEL::Exception);
2321 const int *end() const throw(INTERP_KERNEL::Exception);
2322 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2323 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2324 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2325 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2326 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2327 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2328 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2329 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2330 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2331 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2332 int count(int value) const throw(INTERP_KERNEL::Exception);
2333 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2334 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2335 int getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
2336 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2337 void abs() throw(INTERP_KERNEL::Exception);
2338 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2339 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2340 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2341 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2342 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2343 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2344 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2345 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2346 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2347 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2348 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2349 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2350 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2351 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2352 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2353 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2354 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2355 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2356 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2357 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2358 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2359 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2361 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2362 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2363 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2364 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2365 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2366 void computeOffsets() throw(INTERP_KERNEL::Exception);
2367 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2368 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2369 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2370 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2371 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2372 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2373 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2375 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2377 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2378 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2379 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2380 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2381 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2382 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2383 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2384 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2385 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2386 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2387 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2388 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2389 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2390 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2391 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2392 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2393 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2395 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2398 DataArrayInt() throw(INTERP_KERNEL::Exception)
2400 return DataArrayInt::New();
2403 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2405 const char *msgBase="MEDCoupling::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)";
2406 std::string msg(msgBase);
2408 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2411 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2415 if(PyInt_Check(nbOfTuples))
2417 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2419 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2422 if(PyInt_Check(nbOfComp))
2423 {//DataArrayInt.New([1,3,4,5],2,2)
2424 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2426 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2427 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2428 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2429 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2433 throw INTERP_KERNEL::Exception(msg.c_str());
2436 {//DataArrayInt.New([1,3,4],3)
2437 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2439 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2440 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2445 throw INTERP_KERNEL::Exception(msg.c_str());
2448 {// DataArrayInt.New([1,3,4])
2449 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2450 int tmpp1=-1,tmpp2=-1;
2451 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2452 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2456 else if(PyInt_Check(elt0))
2458 int nbOfTuples1=PyInt_AS_LONG(elt0);
2460 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2465 if(PyInt_Check(nbOfTuples))
2466 {//DataArrayInt.New(5,2)
2467 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2469 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2470 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2471 ret->alloc(nbOfTuples1,nbOfCompo);
2475 throw INTERP_KERNEL::Exception(msg.c_str());
2478 throw INTERP_KERNEL::Exception(msg.c_str());
2481 {//DataArrayInt.New(5)
2482 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2483 ret->alloc(nbOfTuples1,1);
2488 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2489 {//DataArrayInt.New(numpyArray)
2490 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2494 throw INTERP_KERNEL::Exception(msg.c_str());
2495 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2498 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2500 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2503 std::string __str__() const throw(INTERP_KERNEL::Exception)
2505 return self->reprNotTooLong();
2508 int __len__() const throw(INTERP_KERNEL::Exception)
2510 if(self->isAllocated())
2512 return self->getNumberOfTuples();
2516 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2520 int __int__() const throw(INTERP_KERNEL::Exception)
2522 return self->intValue();
2525 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2527 return self->iterator();
2530 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2532 int sz=self->getNumberOfComponents();
2533 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2534 self->accumulate(tmp);
2535 return convertIntArrToPyList(tmp,sz);
2538 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2541 std::vector<int> val2;
2542 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2543 return self->accumulatePerChunck(bg,bg+sz);
2546 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2549 std::vector<int> val2;
2550 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2551 return self->findIdsEqualTuple(bg,bg+sz);
2554 DataArrayInt *findIdForEach(PyObject *vals) const throw(INTERP_KERNEL::Exception)
2557 std::vector<int> val2;
2558 const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
2559 MCAuto<DataArrayInt> ret(self->findIdForEach(bg,bg+sz));
2563 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2565 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2566 PyObject *ret=PyList_New(slcs.size());
2567 for(std::size_t i=0;i<slcs.size();i++)
2568 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2572 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2574 if(!PySlice_Check(slic))
2575 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2576 Py_ssize_t strt=2,stp=2,step=2;
2577 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2578 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2579 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 !");
2580 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2583 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2586 self->getMinMaxValues(a,b);
2587 PyObject *ret=PyTuple_New(2);
2588 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2589 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2593 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2595 int newNbOfTuples=-1;
2596 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2597 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2598 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2599 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2600 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2601 PyObject *ret=PyTuple_New(2);
2602 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2603 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2607 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2609 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2610 int szArr,sw,iTypppArr;
2611 std::vector<int> stdvecTyyppArr;
2612 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2613 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2614 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2618 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2620 const char *msg="MEDCoupling::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 !";
2621 if(PyList_Check(li) || PyTuple_Check(li))
2623 if(nbOfTuples && nbOfTuples != Py_None)
2625 if(PyInt_Check(nbOfTuples))
2627 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2629 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2630 if(nbOfComp && nbOfComp != Py_None)
2632 if(PyInt_Check(nbOfComp))
2633 {//DataArrayInt.setValues([1,3,4,5],2,2)
2634 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2636 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2637 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2638 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2641 throw INTERP_KERNEL::Exception(msg);
2644 {//DataArrayInt.setValues([1,3,4],3)
2646 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2647 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2651 throw INTERP_KERNEL::Exception(msg);
2654 {// DataArrayInt.setValues([1,3,4])
2655 int tmpp1=-1,tmpp2=-1;
2656 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2657 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2661 throw INTERP_KERNEL::Exception(msg);
2664 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2666 const int *vals=self->getConstPointer();
2667 return convertIntArrToPyList(vals,self->getNbOfElems());
2671 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2673 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2677 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2680 bool ret0=self->isEqualIfNotWhy(other,ret1);
2681 PyObject *ret=PyTuple_New(2);
2682 PyObject *ret0Py=ret0?Py_True:Py_False;
2684 PyTuple_SetItem(ret,0,ret0Py);
2685 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2689 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2691 const int *vals=self->getConstPointer();
2692 int nbOfComp=self->getNumberOfComponents();
2693 int nbOfTuples=self->getNumberOfTuples();
2694 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2697 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2699 std::vector<const DataArrayInt *> groups;
2700 std::vector< std::vector<int> > fidsOfGroups;
2701 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2702 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2703 PyObject *ret = PyList_New(2);
2704 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2705 int sz=fidsOfGroups.size();
2706 PyObject *ret1 = PyList_New(sz);
2707 for(int i=0;i<sz;i++)
2708 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2709 PyList_SetItem(ret,1,ret1);
2713 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2716 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2717 if (!SWIG_IsOK(res1))
2719 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2722 MapII *m=reinterpret_cast<MapII *>(da);
2723 self->transformWithIndArr(*m);
2728 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2729 self->transformWithIndArr(tmp,tmp+size);
2734 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2735 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2739 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2743 std::vector<int> multiVal;
2744 std::pair<int, std::pair<int,int> > slic;
2745 MEDCoupling::DataArrayInt *daIntTyypp=0;
2746 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2750 return self->findIdsEqualList(&singleVal,&singleVal+1);
2752 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2754 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2756 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2760 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2764 std::vector<int> multiVal;
2765 std::pair<int, std::pair<int,int> > slic;
2766 MEDCoupling::DataArrayInt *daIntTyypp=0;
2767 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2771 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2773 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2775 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2777 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2781 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2783 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2785 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2786 if (!SWIG_IsOK(res1))
2789 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2790 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2794 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2796 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2797 da2->checkAllocated();
2798 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2800 PyObject *ret = PyList_New(3);
2801 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2802 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2803 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2807 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2810 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2811 if (!SWIG_IsOK(res1))
2814 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2815 return self->transformWithIndArrR(tmp,tmp+size);
2819 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2820 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2824 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2827 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2828 if (!SWIG_IsOK(res1))
2831 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2832 if(size!=self->getNumberOfTuples())
2834 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2836 return self->renumberAndReduce(tmp,newNbOfTuple);
2840 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2842 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2843 da2->checkAllocated();
2844 int size=self->getNumberOfTuples();
2845 if(size!=self->getNumberOfTuples())
2847 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2849 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2853 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2856 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2857 if (!SWIG_IsOK(res1))
2860 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2861 if(size!=self->getNumberOfTuples())
2863 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2865 return self->renumber(tmp);
2869 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2871 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2872 da2->checkAllocated();
2873 int size=self->getNumberOfTuples();
2874 if(size!=self->getNumberOfTuples())
2876 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2878 return self->renumber(da2->getConstPointer());
2882 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2885 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2886 if (!SWIG_IsOK(res1))
2889 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2890 if(size!=self->getNumberOfTuples())
2892 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2894 return self->renumberR(tmp);
2898 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2900 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2901 da2->checkAllocated();
2902 int size=self->getNumberOfTuples();
2903 if(size!=self->getNumberOfTuples())
2905 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2907 return self->renumberR(da2->getConstPointer());
2911 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2913 std::vector<int> tmp;
2914 convertPyToNewIntArr3(li,tmp);
2915 self->setSelectedComponents(a,tmp);
2918 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2920 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2921 std::size_t sz(retCpp.size());
2922 PyObject *res(PyList_New(sz));
2923 for(std::size_t i=0;i<sz;i++)
2924 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2928 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2930 int sz=self->getNumberOfComponents();
2931 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2932 self->getTuple(tupleId,tmp);
2933 return convertIntArrToPyList(tmp,sz);
2936 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2938 DataArrayInt *arr=0;
2939 DataArrayInt *arrI=0;
2940 self->changeSurjectiveFormat(targetNb,arr,arrI);
2941 PyObject *res = PyList_New(2);
2942 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2943 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2947 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2949 std::vector<const DataArrayInt *> tmp;
2950 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2951 return DataArrayInt::Meld(tmp);
2954 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2956 std::vector<const DataArrayInt *> tmp;
2957 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2958 return DataArrayInt::Aggregate(tmp);
2961 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2963 std::vector<const DataArrayInt *> tmp;
2964 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2965 return DataArrayInt::AggregateIndexes(tmp);
2968 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2970 std::vector<const DataArrayInt *> tmp;
2971 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2972 return DataArrayInt::BuildUnion(tmp);
2975 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2977 std::vector<const DataArrayInt *> tmp;
2978 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2979 return DataArrayInt::BuildIntersection(tmp);
2982 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2985 int r1=self->getMaxValue(tmp);
2986 PyObject *ret=PyTuple_New(2);
2987 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2988 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2992 PyObject *getMaxAbsValue(std::size_t& tupleId) const throw(INTERP_KERNEL::Exception)
2995 int r1=self->getMaxAbsValue(tmp);
2996 PyObject *ret=PyTuple_New(2);
2997 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2998 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3002 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3005 int r1=self->getMinValue(tmp);
3006 PyObject *ret=PyTuple_New(2);
3007 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3008 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3012 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3014 int nbOfCompo=self->getNumberOfComponents();
3019 if(PyInt_Check(obj))
3021 int val=(int)PyInt_AS_LONG(obj);
3022 return self->findIdFirstEqual(val);
3025 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3029 std::vector<int> arr;
3030 convertPyToNewIntArr3(obj,arr);
3031 return self->findIdFirstEqualTuple(arr);
3036 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3038 int nbOfCompo=self->getNumberOfComponents();
3045 if(PyInt_Check(obj))
3047 int val=(int)PyInt_AS_LONG(obj);
3048 return self->presenceOfValue(val);
3051 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3055 std::vector<int> arr;
3056 convertPyToNewIntArr3(obj,arr);
3057 return self->presenceOfTuple(arr);
3062 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3064 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3065 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3066 self->checkAllocated();
3067 int nbOfTuples=self->getNumberOfTuples();
3068 int nbOfComponents=self->getNumberOfComponents();
3070 std::vector<int> vt1,vc1;
3071 std::pair<int, std::pair<int,int> > pt1,pc1;
3072 DataArrayInt *dt1=0,*dc1=0;
3074 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3075 MCAuto<DataArrayInt> ret;
3080 if(nbOfComponents==1)
3081 return PyInt_FromLong(self->getIJSafe(it1,0));
3082 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3085 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3087 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3089 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3091 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3094 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3095 std::vector<int> v2(1,ic1);
3096 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3100 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3101 std::vector<int> v2(1,ic1);
3102 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3106 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3107 std::vector<int> v2(1,ic1);
3108 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3112 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3113 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3117 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3118 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3122 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3123 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3127 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3132 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3133 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3134 std::vector<int> v2(nbOfComp);
3135 for(int i=0;i<nbOfComp;i++)
3136 v2[i]=pc1.first+i*pc1.second.second;
3137 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3141 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3142 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3143 std::vector<int> v2(nbOfComp);
3144 for(int i=0;i<nbOfComp;i++)
3145 v2[i]=pc1.first+i*pc1.second.second;
3146 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3150 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3151 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3152 std::vector<int> v2(nbOfComp);
3153 for(int i=0;i<nbOfComp;i++)
3154 v2[i]=pc1.first+i*pc1.second.second;
3155 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3159 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3160 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3161 std::vector<int> v2(nbOfComp);
3162 for(int i=0;i<nbOfComp;i++)
3163 v2[i]=pc1.first+i*pc1.second.second;
3164 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3167 throw INTERP_KERNEL::Exception(msg);
3171 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3173 self->checkAllocated();
3174 const char msg[]="Unexpected situation in __setitem__ !";
3175 int nbOfTuples=self->getNumberOfTuples();
3176 int nbOfComponents=self->getNumberOfComponents();
3179 std::vector<int> v1;
3181 DataArrayIntTuple *dd1=0;
3182 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3184 std::vector<int> vt1,vc1;
3185 std::pair<int, std::pair<int,int> > pt1,pc1;
3186 DataArrayInt *dt1=0,*dc1=0;
3187 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3188 MCAuto<DataArrayInt> tmp;
3196 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3199 tmp=DataArrayInt::New();
3200 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3201 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3204 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3207 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3208 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3211 throw INTERP_KERNEL::Exception(msg);
3220 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3223 tmp=DataArrayInt::New();
3224 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3225 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3228 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3231 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3232 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3235 throw INTERP_KERNEL::Exception(msg);
3244 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3247 tmp=DataArrayInt::New();
3248 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3249 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3252 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3255 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3256 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3259 throw INTERP_KERNEL::Exception(msg);
3268 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3271 tmp=DataArrayInt::New();
3272 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3273 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3276 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3279 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3280 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3283 throw INTERP_KERNEL::Exception(msg);
3292 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3295 tmp=DataArrayInt::New();
3296 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3297 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3300 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3303 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3304 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3307 throw INTERP_KERNEL::Exception(msg);
3316 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3319 tmp=DataArrayInt::New();
3320 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3321 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3324 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3327 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3328 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3331 throw INTERP_KERNEL::Exception(msg);
3340 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3343 tmp=DataArrayInt::New();
3344 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3345 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3348 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3351 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3352 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3355 throw INTERP_KERNEL::Exception(msg);
3364 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3367 tmp=DataArrayInt::New();
3368 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3369 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3372 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3375 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3376 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3379 throw INTERP_KERNEL::Exception(msg);
3388 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3391 tmp=DataArrayInt::New();
3392 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3393 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3396 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3399 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3400 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3403 throw INTERP_KERNEL::Exception(msg);
3412 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3415 tmp=DataArrayInt::New();
3416 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3417 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3420 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3423 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3424 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3427 throw INTERP_KERNEL::Exception(msg);
3436 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3439 tmp=DataArrayInt::New();
3440 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3441 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3444 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3447 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3448 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3451 throw INTERP_KERNEL::Exception(msg);
3460 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3463 tmp=DataArrayInt::New();
3464 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3465 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3468 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3471 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3472 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3475 throw INTERP_KERNEL::Exception(msg);
3484 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3487 tmp=DataArrayInt::New();
3488 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3489 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3492 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3495 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3496 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3499 throw INTERP_KERNEL::Exception(msg);
3508 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3511 tmp=DataArrayInt::New();
3512 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3513 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3516 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3519 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3520 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3523 throw INTERP_KERNEL::Exception(msg);
3532 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3535 tmp=DataArrayInt::New();
3536 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3537 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3540 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3543 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3544 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3547 throw INTERP_KERNEL::Exception(msg);
3556 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3559 tmp=DataArrayInt::New();
3560 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3561 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3564 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3567 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3568 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3571 throw INTERP_KERNEL::Exception(msg);
3576 throw INTERP_KERNEL::Exception(msg);
3581 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3583 return self->negate();
3586 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3588 const char msg[]="Unexpected situation in __add__ !";
3591 std::vector<int> aa;
3592 DataArrayIntTuple *aaa;
3594 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3599 MCAuto<DataArrayInt> ret=self->deepCopy();
3600 ret->applyLin(1,val);
3605 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3606 return DataArrayInt::Add(self,aaaa);
3610 return DataArrayInt::Add(self,a);
3614 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3615 return DataArrayInt::Add(self,aaaa);
3618 throw INTERP_KERNEL::Exception(msg);
3622 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3624 const char msg[]="Unexpected situation in __radd__ !";
3627 std::vector<int> aa;
3628 DataArrayIntTuple *aaa;
3630 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3635 MCAuto<DataArrayInt> ret=self->deepCopy();
3636 ret->applyLin(1,val);
3641 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3642 return DataArrayInt::Add(self,aaaa);
3646 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3647 return DataArrayInt::Add(self,aaaa);
3650 throw INTERP_KERNEL::Exception(msg);
3654 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3656 const char msg[]="Unexpected situation in __iadd__ !";
3659 std::vector<int> aa;
3660 DataArrayIntTuple *aaa;
3662 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3667 self->applyLin(1,val);
3668 Py_XINCREF(trueSelf);
3673 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3675 Py_XINCREF(trueSelf);
3681 Py_XINCREF(trueSelf);
3686 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3687 self->addEqual(aaaa);
3688 Py_XINCREF(trueSelf);
3692 throw INTERP_KERNEL::Exception(msg);
3696 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3698 const char msg[]="Unexpected situation in __sub__ !";
3701 std::vector<int> aa;
3702 DataArrayIntTuple *aaa;
3704 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3709 MCAuto<DataArrayInt> ret=self->deepCopy();
3710 ret->applyLin(1,-val);
3715 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3716 return DataArrayInt::Substract(self,aaaa);
3720 return DataArrayInt::Substract(self,a);
3724 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3725 return DataArrayInt::Substract(self,aaaa);
3728 throw INTERP_KERNEL::Exception(msg);
3732 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3734 const char msg[]="Unexpected situation in __rsub__ !";
3737 std::vector<int> aa;
3738 DataArrayIntTuple *aaa;
3740 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3745 MCAuto<DataArrayInt> ret=self->deepCopy();
3746 ret->applyLin(-1,val);
3751 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3752 return DataArrayInt::Substract(aaaa,self);
3756 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3757 return DataArrayInt::Substract(aaaa,self);
3760 throw INTERP_KERNEL::Exception(msg);
3764 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3766 const char msg[]="Unexpected situation in __isub__ !";
3769 std::vector<int> aa;
3770 DataArrayIntTuple *aaa;
3772 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3777 self->applyLin(1,-val);
3778 Py_XINCREF(trueSelf);
3783 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3784 self->substractEqual(bb);
3785 Py_XINCREF(trueSelf);
3790 self->substractEqual(a);
3791 Py_XINCREF(trueSelf);
3796 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3797 self->substractEqual(aaaa);
3798 Py_XINCREF(trueSelf);
3802 throw INTERP_KERNEL::Exception(msg);
3806 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3808 const char msg[]="Unexpected situation in __mul__ !";
3811 std::vector<int> aa;
3812 DataArrayIntTuple *aaa;
3814 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3819 MCAuto<DataArrayInt> ret=self->deepCopy();
3820 ret->applyLin(val,0);
3825 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3826 return DataArrayInt::Multiply(self,aaaa);
3830 return DataArrayInt::Multiply(self,a);
3834 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3835 return DataArrayInt::Multiply(self,aaaa);
3838 throw INTERP_KERNEL::Exception(msg);
3842 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3844 const char msg[]="Unexpected situation in __rmul__ !";
3847 std::vector<int> aa;
3848 DataArrayIntTuple *aaa;
3850 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3855 MCAuto<DataArrayInt> ret=self->deepCopy();
3856 ret->applyLin(val,0);
3861 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3862 return DataArrayInt::Multiply(self,aaaa);
3866 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3867 return DataArrayInt::Multiply(self,aaaa);
3870 throw INTERP_KERNEL::Exception(msg);
3874 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3876 const char msg[]="Unexpected situation in __imul__ !";
3879 std::vector<int> aa;
3880 DataArrayIntTuple *aaa;
3882 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3887 self->applyLin(val,0);
3888 Py_XINCREF(trueSelf);
3893 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3894 self->multiplyEqual(bb);
3895 Py_XINCREF(trueSelf);
3900 self->multiplyEqual(a);
3901 Py_XINCREF(trueSelf);
3906 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3907 self->multiplyEqual(aaaa);
3908 Py_XINCREF(trueSelf);
3912 throw INTERP_KERNEL::Exception(msg);
3916 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3918 const char msg[]="Unexpected situation in __div__ !";
3921 std::vector<int> aa;
3922 DataArrayIntTuple *aaa;
3924 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3929 MCAuto<DataArrayInt> ret=self->deepCopy();
3930 ret->applyDivideBy(val);
3935 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3936 return DataArrayInt::Divide(self,aaaa);
3940 return DataArrayInt::Divide(self,a);
3944 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3945 return DataArrayInt::Divide(self,aaaa);
3948 throw INTERP_KERNEL::Exception(msg);
3952 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3954 const char msg[]="Unexpected situation in __rdiv__ !";
3957 std::vector<int> aa;
3958 DataArrayIntTuple *aaa;
3960 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3965 MCAuto<DataArrayInt> ret=self->deepCopy();
3971 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3972 return DataArrayInt::Divide(aaaa,self);
3976 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3977 return DataArrayInt::Divide(aaaa,self);
3980 throw INTERP_KERNEL::Exception(msg);
3984 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3986 const char msg[]="Unexpected situation in __idiv__ !";
3989 std::vector<int> aa;
3990 DataArrayIntTuple *aaa;
3992 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3997 self->applyDivideBy(val);
3998 Py_XINCREF(trueSelf);
4003 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4004 self->divideEqual(bb);
4005 Py_XINCREF(trueSelf);
4010 self->divideEqual(a);
4011 Py_XINCREF(trueSelf);
4016 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4017 self->divideEqual(aaaa);
4018 Py_XINCREF(trueSelf);
4022 throw INTERP_KERNEL::Exception(msg);
4026 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4028 const char msg[]="Unexpected situation in __mod__ !";
4031 std::vector<int> aa;
4032 DataArrayIntTuple *aaa;
4034 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4039 MCAuto<DataArrayInt> ret=self->deepCopy();
4040 ret->applyModulus(val);
4045 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4046 return DataArrayInt::Modulus(self,aaaa);
4050 return DataArrayInt::Modulus(self,a);
4054 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4055 return DataArrayInt::Modulus(self,aaaa);
4058 throw INTERP_KERNEL::Exception(msg);
4062 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4064 const char msg[]="Unexpected situation in __rmod__ !";
4067 std::vector<int> aa;
4068 DataArrayIntTuple *aaa;
4070 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4075 MCAuto<DataArrayInt> ret=self->deepCopy();
4076 ret->applyRModulus(val);
4081 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4082 return DataArrayInt::Modulus(aaaa,self);
4086 return DataArrayInt::Modulus(a,self);
4090 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4091 return DataArrayInt::Modulus(aaaa,self);
4094 throw INTERP_KERNEL::Exception(msg);
4098 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4100 const char msg[]="Unexpected situation in __imod__ !";
4103 std::vector<int> aa;
4104 DataArrayIntTuple *aaa;
4106 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4111 self->applyModulus(val);
4112 Py_XINCREF(trueSelf);
4117 self->modulusEqual(a);
4118 Py_XINCREF(trueSelf);
4123 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4124 self->modulusEqual(aaaa);
4125 Py_XINCREF(trueSelf);
4129 throw INTERP_KERNEL::Exception(msg);
4133 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4135 const char msg[]="Unexpected situation in __pow__ !";
4138 std::vector<int> aa;
4139 DataArrayIntTuple *aaa;
4141 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4146 MCAuto<DataArrayInt> ret=self->deepCopy();
4152 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4153 return DataArrayInt::Pow(self,aaaa);
4157 return DataArrayInt::Pow(self,a);
4161 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4162 return DataArrayInt::Pow(self,aaaa);
4165 throw INTERP_KERNEL::Exception(msg);
4169 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4171 const char msg[]="Unexpected situation in __rpow__ !";
4174 std::vector<int> aa;
4175 DataArrayIntTuple *aaa;
4177 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4182 MCAuto<DataArrayInt> ret=self->deepCopy();
4183 ret->applyRPow(val);
4188 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4189 return DataArrayInt::Pow(aaaa,self);
4193 return DataArrayInt::Pow(a,self);
4197 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4198 return DataArrayInt::Pow(aaaa,self);
4201 throw INTERP_KERNEL::Exception(msg);
4205 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4207 const char msg[]="Unexpected situation in __ipow__ !";
4210 std::vector<int> aa;
4211 DataArrayIntTuple *aaa;
4213 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4218 self->applyPow(val);
4219 Py_XINCREF(trueSelf);
4225 Py_XINCREF(trueSelf);
4230 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4231 self->powEqual(aaaa);
4232 Py_XINCREF(trueSelf);
4236 throw INTERP_KERNEL::Exception(msg);
4240 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4242 std::ostringstream oss;
4243 self->reprQuickOverview(oss);
4247 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4249 int szArr,sw,iTypppArr;
4250 std::vector<int> stdvecTyyppArr;
4251 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4252 self->pushBackValsSilent(tmp,tmp+szArr);
4255 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4257 std::vector<int> ret1;
4258 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4259 std::size_t sz=ret0.size();
4260 PyObject *pyRet=PyTuple_New(2);
4261 PyObject *pyRet0=PyList_New((int)sz);
4262 PyObject *pyRet1=PyList_New((int)sz);
4263 for(std::size_t i=0;i<sz;i++)
4265 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4266 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4268 PyTuple_SetItem(pyRet,0,pyRet0);
4269 PyTuple_SetItem(pyRet,1,pyRet1);
4273 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4275 DataArrayInt *ret0=0,*ret1=0;
4276 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4277 PyObject *pyRet=PyTuple_New(2);
4278 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4279 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4283 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4286 bool ret(self->isRange(a,b,c));
4287 PyObject *pyRet=PyTuple_New(2);
4288 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4290 PyTuple_SetItem(pyRet,0,ret0Py);
4292 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4298 PyTuple_SetItem(pyRet,1,ret1Py);
4304 class DataArrayIntTuple;
4306 class DataArrayIntIterator
4309 DataArrayIntIterator(DataArrayInt *da);
4310 ~DataArrayIntIterator();
4315 DataArrayIntTuple *ret=self->nextt();
4317 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4320 PyErr_SetString(PyExc_StopIteration,"No more data.");
4327 class DataArrayIntTuple
4330 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4331 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4334 std::string __str__() const throw(INTERP_KERNEL::Exception)
4336 return self->repr();
4339 int __int__() const throw(INTERP_KERNEL::Exception)
4341 return self->intValue();
4344 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4346 return self->buildDAInt(1,self->getNumberOfCompo());
4349 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4351 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4352 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4353 Py_XINCREF(trueSelf);
4357 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4359 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4360 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4361 Py_XINCREF(trueSelf);
4365 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4367 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4368 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4369 Py_XINCREF(trueSelf);
4372 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4374 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4375 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4376 Py_XINCREF(trueSelf);
4380 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4382 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4383 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4384 Py_XINCREF(trueSelf);
4388 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4390 return PyInt_FromLong(self->getNumberOfCompo());
4393 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4395 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4398 std::vector<int> multiVal;
4399 std::pair<int, std::pair<int,int> > slic;
4400 MEDCoupling::DataArrayInt *daIntTyypp=0;
4401 const int *pt=self->getConstPointer();
4402 int nbc=self->getNumberOfCompo();
4403 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4410 std::ostringstream oss;
4411 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4412 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4416 return PyInt_FromLong(pt[singleVal]);
4420 return PyInt_FromLong(pt[nbc+singleVal]);
4423 std::ostringstream oss;
4424 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4425 throw INTERP_KERNEL::Exception(oss.str().c_str());
4431 PyObject *t=PyTuple_New(multiVal.size());
4432 for(int j=0;j<(int)multiVal.size();j++)
4434 int cid=multiVal[j];
4437 std::ostringstream oss;
4438 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4439 throw INTERP_KERNEL::Exception(oss.str().c_str());
4441 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4447 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4448 PyObject *t=PyTuple_New(sz);
4449 for(int j=0;j<sz;j++)
4450 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4454 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4458 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4460 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4461 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4464 std::vector<int> multiValV;
4465 std::pair<int, std::pair<int,int> > slicV;
4466 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4467 int nbc=self->getNumberOfCompo();
4468 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4470 std::vector<int> multiVal;
4471 std::pair<int, std::pair<int,int> > slic;
4472 MEDCoupling::DataArrayInt *daIntTyypp=0;
4473 int *pt=self->getPointer();
4474 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4481 std::ostringstream oss;
4482 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4483 throw INTERP_KERNEL::Exception(oss.str().c_str());
4489 pt[singleVal]=singleValV;
4494 if(multiValV.size()!=1)
4496 std::ostringstream oss;
4497 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4498 throw INTERP_KERNEL::Exception(oss.str().c_str());
4500 pt[singleVal]=multiValV[0];
4505 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4509 throw INTERP_KERNEL::Exception(msg);
4518 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4522 std::ostringstream oss;
4523 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4524 throw INTERP_KERNEL::Exception(oss.str().c_str());
4532 if(multiVal.size()!=multiValV.size())
4534 std::ostringstream oss;
4535 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4536 throw INTERP_KERNEL::Exception(oss.str().c_str());
4538 for(int i=0;i<(int)multiVal.size();i++)
4540 int pos=multiVal[i];
4543 std::ostringstream oss;
4544 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4545 throw INTERP_KERNEL::Exception(oss.str().c_str());
4547 pt[multiVal[i]]=multiValV[i];
4553 const int *ptV=daIntTyyppV->getConstPointer();
4554 if(nbc>daIntTyyppV->getNumberOfCompo())
4556 std::ostringstream oss;
4557 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4558 throw INTERP_KERNEL::Exception(oss.str().c_str());
4560 std::copy(ptV,ptV+nbc,pt);
4564 throw INTERP_KERNEL::Exception(msg);
4569 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4574 for(int j=0;j<sz;j++)
4575 pt[slic.first+j*slic.second.second]=singleValV;
4580 if(sz!=(int)multiValV.size())
4582 std::ostringstream oss;
4583 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4584 throw INTERP_KERNEL::Exception(oss.str().c_str());
4586 for(int j=0;j<sz;j++)
4587 pt[slic.first+j*slic.second.second]=multiValV[j];
4592 const int *ptV=daIntTyyppV->getConstPointer();
4593 if(sz>daIntTyyppV->getNumberOfCompo())
4595 std::ostringstream oss;
4596 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4597 throw INTERP_KERNEL::Exception(oss.str().c_str());
4599 for(int j=0;j<sz;j++)
4600 pt[slic.first+j*slic.second.second]=ptV[j];
4604 throw INTERP_KERNEL::Exception(msg);
4608 throw INTERP_KERNEL::Exception(msg);
4614 class DataArrayChar : public DataArray
4617 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4618 int getHashCode() const throw(INTERP_KERNEL::Exception);
4619 bool empty() const throw(INTERP_KERNEL::Exception);
4620 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4621 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4622 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4623 char popBackSilent() throw(INTERP_KERNEL::Exception);
4624 void pack() const throw(INTERP_KERNEL::Exception);
4625 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4626 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4627 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4628 void reverse() throw(INTERP_KERNEL::Exception);
4629 void fillWithZero() throw(INTERP_KERNEL::Exception);
4630 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4631 std::string repr() const throw(INTERP_KERNEL::Exception);
4632 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4633 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4634 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4635 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4636 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4637 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4638 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4639 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4640 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4641 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4642 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4643 char front() const throw(INTERP_KERNEL::Exception);
4644 char back() const throw(INTERP_KERNEL::Exception);
4645 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4646 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4647 char *getPointer() throw(INTERP_KERNEL::Exception);
4648 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4649 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4650 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4651 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4652 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4653 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4654 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4655 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4656 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4657 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4658 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4661 int __len__() const throw(INTERP_KERNEL::Exception)
4663 if(self->isAllocated())
4665 return self->getNumberOfTuples();
4669 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4673 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4676 bool ret0=self->isEqualIfNotWhy(other,ret1);
4677 PyObject *ret=PyTuple_New(2);
4678 PyObject *ret0Py=ret0?Py_True:Py_False;
4680 PyTuple_SetItem(ret,0,ret0Py);
4681 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4685 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4688 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4689 if (!SWIG_IsOK(res1))
4692 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4693 if(size!=self->getNumberOfTuples())
4695 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4697 return self->renumber(tmp);
4701 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4703 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4704 da2->checkAllocated();
4705 int size=self->getNumberOfTuples();
4706 if(size!=self->getNumberOfTuples())
4708 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4710 return self->renumber(da2->getConstPointer());
4714 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4717 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4718 if (!SWIG_IsOK(res1))
4721 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4722 if(size!=self->getNumberOfTuples())
4724 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4726 return self->renumberR(tmp);
4730 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4732 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4733 da2->checkAllocated();
4734 int size=self->getNumberOfTuples();
4735 if(size!=self->getNumberOfTuples())
4737 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4739 return self->renumberR(da2->getConstPointer());
4743 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4746 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4747 if (!SWIG_IsOK(res1))
4750 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4751 if(size!=self->getNumberOfTuples())
4753 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4755 return self->renumberAndReduce(tmp,newNbOfTuple);
4759 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4761 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4762 da2->checkAllocated();
4763 int size=self->getNumberOfTuples();
4764 if(size!=self->getNumberOfTuples())
4766 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4768 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4772 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4774 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4775 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4776 return DataArrayChar::Aggregate(tmp);
4779 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4781 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4782 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4783 return DataArrayChar::Meld(tmp);
4788 class DataArrayByteIterator;
4790 class DataArrayByte : public DataArrayChar
4793 static DataArrayByte *New();
4794 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4795 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4796 char byteValue() const throw(INTERP_KERNEL::Exception);
4799 DataArrayByte() throw(INTERP_KERNEL::Exception)
4801 return DataArrayByte::New();
4804 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4806 const char *msg="MEDCoupling::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) !";
4807 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4811 if(PyInt_Check(nbOfTuples))
4813 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4815 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4818 if(PyInt_Check(nbOfComp))
4819 {//DataArrayByte.New([1,3,4,5],2,2)
4820 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4822 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4823 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4824 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4825 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4829 throw INTERP_KERNEL::Exception(msg);
4832 {//DataArrayByte.New([1,3,4],3)
4833 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4835 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4836 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4841 throw INTERP_KERNEL::Exception(msg);
4844 {// DataArrayByte.New([1,3,4])
4845 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4846 int tmpp1=-1,tmpp2=-1;
4847 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4848 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4852 else if(PyInt_Check(elt0))
4854 int nbOfTuples1=PyInt_AS_LONG(elt0);
4856 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4861 if(PyInt_Check(nbOfTuples))
4862 {//DataArrayByte.New(5,2)
4863 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4865 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4866 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4867 ret->alloc(nbOfTuples1,nbOfCompo);
4871 throw INTERP_KERNEL::Exception(msg);
4874 throw INTERP_KERNEL::Exception(msg);
4877 {//DataArrayByte.New(5)
4878 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4879 ret->alloc(nbOfTuples1,1);
4884 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4885 {//DataArrayDouble.New(numpyArray)
4886 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4890 throw INTERP_KERNEL::Exception(msg);
4893 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4895 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4898 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4900 std::ostringstream oss;
4901 self->reprQuickOverview(oss);
4905 int __int__() const throw(INTERP_KERNEL::Exception)
4907 return (int) self->byteValue();
4910 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4912 return self->iterator();
4915 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4917 return (int)self->getIJ(tupleId,compoId);
4920 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4922 return (int)self->getIJSafe(tupleId,compoId);
4925 std::string __str__() const throw(INTERP_KERNEL::Exception)
4927 return self->repr();
4930 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4932 const char *vals=self->getConstPointer();
4933 int nbOfComp=self->getNumberOfComponents();
4934 int nbOfTuples=self->getNumberOfTuples();
4935 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4938 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4941 int ival=-1; std::vector<int> ivval;
4942 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4943 std::vector<char> vals(sz);
4944 std::copy(pt,pt+sz,vals.begin());
4945 return self->presenceOfTuple(vals);
4948 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4951 int ival=-1; std::vector<int> ivval;
4952 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4953 std::vector<char> vals2(sz);
4954 std::copy(pt,pt+sz,vals2.begin());
4955 return self->presenceOfValue(vals2);
4958 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4961 int ival=-1; std::vector<int> ivval;
4962 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4963 std::vector<char> vals2(sz);
4964 std::copy(pt,pt+sz,vals2.begin());
4965 return self->findIdFirstEqual(vals2);
4968 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4971 int ival=-1; std::vector<int> ivval;
4972 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4973 std::vector<char> vals(sz);
4974 std::copy(pt,pt+sz,vals.begin());
4975 return self->findIdFirstEqualTuple(vals);
4978 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4981 int ival=-1; std::vector<int> ivval;
4982 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
4983 std::vector<char> vals(sz);
4984 std::copy(pt,pt+sz,vals.begin());
4985 return self->findIdSequence(vals);
4988 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4990 int sz=self->getNumberOfComponents();
4991 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4992 self->getTuple(tupleId,tmp);
4993 PyObject *ret=PyTuple_New(sz);
4994 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4998 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5001 int r1=(int)self->getMaxValue(tmp);
5002 PyObject *ret=PyTuple_New(2);
5003 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5004 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5008 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5011 int r1=(int)self->getMinValue(tmp);
5012 PyObject *ret=PyTuple_New(2);
5013 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5014 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5018 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5020 int nbOfCompo=self->getNumberOfComponents();
5025 if(PyInt_Check(obj))
5027 int val=(int)PyInt_AS_LONG(obj);
5028 return self->findIdFirstEqual(val);
5031 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5034 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5038 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5040 int nbOfCompo=self->getNumberOfComponents();
5047 if(PyInt_Check(obj))
5049 int val=(int)PyInt_AS_LONG(obj);
5050 return self->presenceOfValue(val);
5053 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5056 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5061 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5063 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5067 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5069 self->checkAllocated();
5070 const char msg[]="Unexpected situation in __setitem__ !";
5071 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5074 std::vector<int> v1;
5076 DataArrayIntTuple *dd1=0;
5077 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5079 std::vector<int> vt1,vc1;
5080 std::pair<int, std::pair<int,int> > pt1,pc1;
5081 DataArrayInt *dt1=0,*dc1=0;
5082 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5083 MCAuto<DataArrayInt> tmp;
5091 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5094 throw INTERP_KERNEL::Exception(msg);
5103 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5106 throw INTERP_KERNEL::Exception(msg);
5115 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5118 throw INTERP_KERNEL::Exception(msg);
5127 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5130 throw INTERP_KERNEL::Exception(msg);
5139 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5142 throw INTERP_KERNEL::Exception(msg);
5151 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5154 throw INTERP_KERNEL::Exception(msg);
5163 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5166 throw INTERP_KERNEL::Exception(msg);
5175 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5178 throw INTERP_KERNEL::Exception(msg);
5187 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5190 throw INTERP_KERNEL::Exception(msg);
5199 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5202 throw INTERP_KERNEL::Exception(msg);
5211 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5214 throw INTERP_KERNEL::Exception(msg);
5223 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5226 throw INTERP_KERNEL::Exception(msg);
5235 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5238 throw INTERP_KERNEL::Exception(msg);
5247 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5250 throw INTERP_KERNEL::Exception(msg);
5259 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5262 throw INTERP_KERNEL::Exception(msg);
5271 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5274 throw INTERP_KERNEL::Exception(msg);
5279 throw INTERP_KERNEL::Exception(msg);
5286 class DataArrayByteTuple;
5288 class DataArrayByteIterator
5291 DataArrayByteIterator(DataArrayByte *da);
5292 ~DataArrayByteIterator();
5295 class DataArrayByteTuple
5298 std::string repr() const throw(INTERP_KERNEL::Exception);
5299 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5302 std::string __str__() const throw(INTERP_KERNEL::Exception)
5304 return self->repr();
5307 char __int__() const throw(INTERP_KERNEL::Exception)
5309 return self->byteValue();
5312 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5314 return self->buildDAByte(1,self->getNumberOfCompo());
5319 class DataArrayAsciiCharIterator;
5321 class DataArrayAsciiChar : public DataArrayChar
5324 static DataArrayAsciiChar *New();
5325 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5326 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5327 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5330 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5332 return DataArrayAsciiChar::New();
5335 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5337 const char *msg="MEDCoupling::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) !";
5338 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5342 if(PyInt_Check(nbOfTuples))
5344 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5346 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5349 if(PyInt_Check(nbOfComp))
5350 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5351 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5353 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5354 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5355 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5356 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5360 throw INTERP_KERNEL::Exception(msg);
5363 {//DataArrayAsciiChar.New([1,3,4],3)
5364 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5366 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5367 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5371 else if(PyString_Check(nbOfTuples))
5373 if(PyString_Size(nbOfTuples)!=1)
5374 throw INTERP_KERNEL::Exception(msg);
5375 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5376 std::vector<std::string> tmp;
5377 if(fillStringVector(elt0,tmp))
5378 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5380 throw INTERP_KERNEL::Exception(msg);
5382 %#if PY_VERSION_HEX >= 0x03000000
5383 else if(PyUnicode_Check(nbOfTuples))
5385 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5386 throw INTERP_KERNEL::Exception(msg);
5387 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5388 std::vector<std::string> tmp;
5389 if(fillStringVector(elt0,tmp))
5390 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5392 throw INTERP_KERNEL::Exception(msg);
5396 throw INTERP_KERNEL::Exception(msg);
5400 std::vector<std::string> tmmp;
5401 if(fillStringVector(elt0,tmmp))
5402 //DataArrayAsciiChar.New(["abc","de","fghi"])
5403 return DataArrayAsciiChar::New(tmmp,' ');
5406 // DataArrayAsciiChar.New([1,3,4])
5407 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5408 int tmpp1=-1,tmpp2=-1;
5409 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5410 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5415 else if(PyInt_Check(elt0))
5417 int nbOfTuples1=PyInt_AS_LONG(elt0);
5419 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5424 if(PyInt_Check(nbOfTuples))
5425 {//DataArrayAsciiChar.New(5,2)
5426 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5428 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5429 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5430 ret->alloc(nbOfTuples1,nbOfCompo);
5434 throw INTERP_KERNEL::Exception(msg);
5437 throw INTERP_KERNEL::Exception(msg);
5440 {//DataArrayAsciiChar.New(5)
5441 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5442 ret->alloc(nbOfTuples1,1);
5447 throw INTERP_KERNEL::Exception(msg);
5450 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5452 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5455 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5457 std::ostringstream oss;
5458 self->reprQuickOverview(oss);
5462 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5464 return self->iterator();
5467 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5469 char tmp[2]; tmp[1]='\0';
5470 tmp[0]=self->getIJ(tupleId,compoId);
5471 return std::string(tmp);
5474 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5476 char tmp[2]; tmp[1]='\0';
5477 tmp[0]=self->getIJSafe(tupleId,compoId);
5478 return std::string(tmp);
5481 std::string __str__() const throw(INTERP_KERNEL::Exception)
5483 return self->repr();
5486 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5488 const char *vals=self->getConstPointer();
5489 int nbOfComp=self->getNumberOfComponents();
5490 int nbOfTuples=self->getNumberOfTuples();
5491 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5494 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5496 if(PyString_Check(tupl))
5498 Py_ssize_t sz=PyString_Size(tupl);
5499 std::vector<char> vals(sz);
5500 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5501 return self->presenceOfTuple(vals);
5503 %#if PY_VERSION_HEX >= 0x03000000
5504 else if(PyUnicode_Check(tupl))
5506 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5507 std::vector<char> vals(sz);
5508 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5509 return self->presenceOfTuple(vals);
5513 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5516 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5518 if(PyString_Check(vals))
5520 Py_ssize_t sz=PyString_Size(vals);
5521 std::vector<char> vals2(sz);
5522 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5523 return self->presenceOfValue(vals2);
5525 %#if PY_VERSION_HEX >= 0x03000000
5526 if(PyUnicode_Check(vals))
5528 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5529 std::vector<char> vals2(sz);
5530 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5531 return self->presenceOfValue(vals2);
5535 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5538 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5540 if(PyString_Check(vals))
5542 Py_ssize_t sz=PyString_Size(vals);
5543 std::vector<char> vals2(sz);
5544 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5545 return self->findIdFirstEqual(vals2);
5547 %#if PY_VERSION_HEX >= 0x03000000
5548 if(PyUnicode_Check(vals))
5550 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5551 std::vector<char> vals2(sz);
5552 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5553 return self->findIdFirstEqual(vals2);
5557 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5560 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5562 if(PyString_Check(tupl))
5564 Py_ssize_t sz=PyString_Size(tupl);
5565 std::vector<char> vals(sz);
5566 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5567 return self->findIdFirstEqualTuple(vals);
5569 %#if PY_VERSION_HEX >= 0x03000000
5570 if(PyUnicode_Check(tupl))
5572 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5573 std::vector<char> vals(sz);
5574 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5575 return self->findIdFirstEqualTuple(vals);
5579 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5582 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5584 if(PyString_Check(strOrListOfInt))
5586 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5587 std::vector<char> vals(sz);
5588 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5589 return self->findIdSequence(vals);
5591 %#if PY_VERSION_HEX >= 0x03000000
5592 else if(PyUnicode_Check(strOrListOfInt))
5594 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5595 std::vector<char> vals(sz);
5596 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5597 return self->findIdSequence(vals);
5601 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5604 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5606 int sz=self->getNumberOfComponents();
5607 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5608 self->getTuple(tupleId,tmp);
5609 return PyString_FromString(tmp);
5612 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5615 char tmp2[2]; tmp2[1]='\0';
5616 tmp2[0]=self->getMaxValue(tmp);
5617 PyObject *ret=PyTuple_New(2);
5618 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5619 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5623 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5626 char tmp2[2]; tmp2[1]='\0';
5627 tmp2[0]=self->getMinValue(tmp);
5628 PyObject *ret=PyTuple_New(2);
5629 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5630 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5634 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5636 int nbOfCompo=self->getNumberOfComponents();
5641 if(PyString_Check(obj))
5643 Py_ssize_t sz=PyString_Size(obj);
5644 char *pt=PyString_AsString(obj);
5646 return self->findIdFirstEqual(pt[0]);
5648 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5650 %#if PY_VERSION_HEX >= 0x03000000
5651 if(PyUnicode_Check(obj))
5654 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5656 return self->findIdFirstEqual(pt[0]);
5658 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5662 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5665 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5669 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5671 int nbOfCompo=self->getNumberOfComponents();
5678 if(PyString_Check(obj))
5680 Py_ssize_t sz=PyString_Size(obj);
5681 char *pt=PyString_AsString(obj);
5683 return self->presenceOfValue(pt[0]);
5685 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5687 %#if PY_VERSION_HEX >= 0x03000000
5688 if(PyUnicode_Check(obj))
5691 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5693 return self->presenceOfValue(pt[0]);
5695 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5699 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5702 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5706 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5709 std::vector<int> stdvecTyyppArr;
5710 std::pair<int, std::pair<int,int> > sTyyppArr;
5711 MEDCoupling::DataArrayInt *daIntTyypp=0;
5712 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5716 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5718 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5720 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5722 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5724 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5728 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5730 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.";
5732 std::vector<int> stdvecTyyppArr;
5733 std::pair<int, std::pair<int,int> > sTyyppArr;
5734 MEDCoupling::DataArrayInt *daIntTyypp=0;
5735 int nbOfCompo=self->getNumberOfComponents();
5736 int nbOfTuples=self->getNumberOfTuples();
5737 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5739 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5740 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5749 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5755 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5756 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5759 //value vector<string>
5762 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5763 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5766 //value DataArrayChar
5769 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5773 throw INTERP_KERNEL::Exception(msg);
5777 {//obj list-tuple[int]
5783 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5789 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5790 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5793 //value vector<string>
5796 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5797 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5800 //value DataArrayChar
5803 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5807 throw INTERP_KERNEL::Exception(msg);
5818 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5824 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5825 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5828 //value vector<string>
5831 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5832 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5835 //value DataArrayChar
5838 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5842 throw INTERP_KERNEL::Exception(msg);
5853 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5859 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5860 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5863 //value vector<string>
5866 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5867 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5870 //value DataArrayChar
5873 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5877 throw INTERP_KERNEL::Exception(msg);
5882 throw INTERP_KERNEL::Exception(msg);
5888 class DataArrayAsciiCharTuple;
5890 class DataArrayAsciiCharIterator
5893 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5894 ~DataArrayAsciiCharIterator();
5899 DataArrayAsciiCharTuple *ret=self->nextt();
5901 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5904 PyErr_SetString(PyExc_StopIteration,"No more data.");
5911 class DataArrayAsciiCharTuple
5914 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5915 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5918 std::string __str__() const throw(INTERP_KERNEL::Exception)
5920 return self->repr();
5923 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5925 return self->buildDAAsciiChar(1,self->getNumberOfCompo());
5932 def MEDCouplingStdReduceFunct(cls,params):
5934 ret=object.__new__(cls)
5939 def MEDCouplingDataArrayDoubleReduce(self):
5940 if not MEDCouplingHasNumPyBindings():
5941 raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5942 return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
5944 def MEDCouplingDataArrayIntReduce(self):
5945 if not MEDCouplingHasNumPyBindings():
5946 raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5947 return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
5949 def MEDCouplingDataArrayByteReduce(self):
5950 if not MEDCouplingHasNumPyBindings():
5951 raise InterpKernelException("PyWrap of DataArrayByte.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5952 return MEDCouplingStdReduceFunct,(DataArrayByte,((self.toNumPyArray(),),(self.__getstate__()),))
5954 def MEDCouplingDataArrayFloatReduce(self):
5955 if not MEDCouplingHasNumPyBindings():
5956 raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5957 return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))