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 *accumulate() const throw(INTERP_KERNEL::Exception)
1347 int sz=self->getNumberOfComponents();
1348 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1349 self->accumulate(tmp);
1350 return convertDblArrToPyList<double>(tmp,sz);
1353 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1356 std::vector<int> val2;
1357 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1358 return self->accumulatePerChunck(bg,bg+sz);
1361 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1363 DataArrayInt *comm, *commIndex;
1364 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1365 PyObject *res = PyList_New(2);
1366 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1367 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1371 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1375 DataArrayDoubleTuple *aa;
1376 std::vector<double> bb;
1378 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1379 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1381 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1382 PyObject *ret=PyTuple_New(2);
1383 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1384 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1388 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1390 std::vector<int> tmp;
1391 convertPyToNewIntArr3(li,tmp);
1392 self->setSelectedComponents(a,tmp);
1395 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1397 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1398 std::size_t sz(retCpp.size());
1399 PyObject *res(PyList_New(sz));
1400 for(std::size_t i=0;i<sz;i++)
1401 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1405 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1407 int sz=self->getNumberOfComponents();
1408 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1409 self->getTuple(tupleId,tmp);
1410 return convertDblArrToPyList<double>(tmp,sz);
1413 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1415 std::vector<const DataArrayDouble *> tmp;
1416 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1417 return DataArrayDouble::Aggregate(tmp);
1420 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1422 std::vector<const DataArrayDouble *> tmp;
1423 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1424 return DataArrayDouble::Meld(tmp);
1427 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1431 DataArrayDoubleTuple *aa;
1432 std::vector<double> bb;
1434 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1435 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1436 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1437 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1438 DataArrayInt *c=0,*cI=0;
1439 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1440 PyObject *ret=PyTuple_New(2);
1441 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1442 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1446 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1448 DataArrayInt *ret1=0;
1449 bool ret0=self->areIncludedInMe(other,prec,ret1);
1450 PyObject *ret=PyTuple_New(2);
1451 PyObject *ret0Py=ret0?Py_True:Py_False;
1453 PyTuple_SetItem(ret,0,ret0Py);
1454 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1458 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1460 return DataArrayT__getitem<double>(self,obj);
1463 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1465 return DataArrayT__setitem__<double>(self,obj,value);
1468 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1470 return self->negate();
1473 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1475 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1478 DataArrayDoubleTuple *aa;
1479 std::vector<double> bb;
1482 #ifndef WITHOUT_AUTOFIELD
1484 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1486 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1489 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1490 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1492 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1495 throw INTERP_KERNEL::Exception(msg);
1499 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1504 MCAuto<DataArrayDouble> ret=self->deepCopy();
1505 ret->applyLin(1.,val);
1506 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1510 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1514 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1515 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1519 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1520 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1523 throw INTERP_KERNEL::Exception(msg);
1527 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1529 const char msg[]="Unexpected situation in __radd__ !";
1532 DataArrayDoubleTuple *aa;
1533 std::vector<double> bb;
1535 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1540 MCAuto<DataArrayDouble> ret=self->deepCopy();
1541 ret->applyLin(1.,val);
1546 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1547 return DataArrayDouble::Add(self,aaa);
1551 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1552 return DataArrayDouble::Add(self,aaa);
1555 throw INTERP_KERNEL::Exception(msg);
1559 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1561 return DataArrayT_iadd<double>(trueSelf,obj,self);
1564 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1566 const char msg[]="Unexpected situation in __sub__ !";
1569 DataArrayDoubleTuple *aa;
1570 std::vector<double> bb;
1573 #ifndef WITHOUT_AUTOFIELD
1575 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1577 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1580 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1581 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1583 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1586 throw INTERP_KERNEL::Exception(msg);
1590 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1595 MCAuto<DataArrayDouble> ret=self->deepCopy();
1596 ret->applyLin(1.,-val);
1597 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1601 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1605 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1606 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1610 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1611 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1614 throw INTERP_KERNEL::Exception(msg);
1618 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1620 const char msg[]="Unexpected situation in __rsub__ !";
1623 DataArrayDoubleTuple *aa;
1624 std::vector<double> bb;
1626 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1631 MCAuto<DataArrayDouble> ret=self->deepCopy();
1632 ret->applyLin(-1.,val);
1637 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1638 return DataArrayDouble::Substract(aaa,self);
1642 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1643 return DataArrayDouble::Substract(aaa,self);
1646 throw INTERP_KERNEL::Exception(msg);
1650 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1652 return DataArrayT_isub<double>(trueSelf,obj,self);
1655 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1657 const char msg[]="Unexpected situation in __mul__ !";
1660 DataArrayDoubleTuple *aa;
1661 std::vector<double> bb;
1664 #ifndef WITHOUT_AUTOFIELD
1666 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1668 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1671 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1672 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1674 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1677 throw INTERP_KERNEL::Exception(msg);
1681 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1686 MCAuto<DataArrayDouble> ret=self->deepCopy();
1687 ret->applyLin(val,0.);
1688 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1692 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1696 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1697 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1701 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1702 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1705 throw INTERP_KERNEL::Exception(msg);
1709 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1711 return DataArrayFPT_rmul<double>(self,obj);
1714 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1716 return DataArrayT_imul<double>(trueSelf,obj,self);
1719 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1721 const char msg[]="Unexpected situation in __div__ !";
1724 DataArrayDoubleTuple *aa;
1725 std::vector<double> bb;
1728 #ifndef WITHOUT_AUTOFIELD
1730 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1732 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1735 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1736 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1738 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1741 throw INTERP_KERNEL::Exception(msg);
1745 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1751 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1752 MCAuto<DataArrayDouble> ret=self->deepCopy();
1753 ret->applyLin(1/val,0.);
1754 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1758 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1762 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1763 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1767 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1768 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1771 throw INTERP_KERNEL::Exception(msg);
1775 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1777 const char msg[]="Unexpected situation in __rdiv__ !";
1780 DataArrayDoubleTuple *aa;
1781 std::vector<double> bb;
1783 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1788 MCAuto<DataArrayDouble> ret=self->deepCopy();
1794 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1795 return DataArrayDouble::Divide(aaa,self);
1799 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1800 return DataArrayDouble::Divide(aaa,self);
1803 throw INTERP_KERNEL::Exception(msg);
1807 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1809 return DataArrayT_idiv<double>(trueSelf,obj,self);
1812 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1814 const char msg[]="Unexpected situation in __pow__ !";
1817 DataArrayDoubleTuple *aa;
1818 std::vector<double> bb;
1820 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1825 MCAuto<DataArrayDouble> ret=self->deepCopy();
1831 return DataArrayDouble::Pow(self,a);
1835 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1836 return DataArrayDouble::Pow(self,aaa);
1840 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1841 return DataArrayDouble::Pow(self,aaa);
1844 throw INTERP_KERNEL::Exception(msg);
1848 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1850 const char msg[]="Unexpected situation in __rpow__ !";
1853 DataArrayDoubleTuple *aa;
1854 std::vector<double> bb;
1856 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1861 MCAuto<DataArrayDouble> ret=self->deepCopy();
1862 ret->applyRPow(val);
1867 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1868 return DataArrayDouble::Pow(aaa,self);
1872 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1873 return DataArrayDouble::Pow(aaa,self);
1876 throw INTERP_KERNEL::Exception(msg);
1880 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1882 const char msg[]="Unexpected situation in __ipow__ !";
1885 DataArrayDoubleTuple *aa;
1886 std::vector<double> bb;
1888 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1893 self->applyPow(val);
1894 Py_XINCREF(trueSelf);
1900 Py_XINCREF(trueSelf);
1905 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1906 self->powEqual(aaa);
1907 Py_XINCREF(trueSelf);
1912 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1913 self->powEqual(aaa);
1914 Py_XINCREF(trueSelf);
1918 throw INTERP_KERNEL::Exception(msg);
1922 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1924 DataArrayInt *c=0,*cI=0;
1926 self->computeTupleIdsNearTuples(other,eps,c,cI);
1927 PyObject *ret=PyTuple_New(2);
1928 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1929 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1933 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1935 DataArrayInt *ret1=0;
1936 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1937 PyObject *ret=PyTuple_New(2);
1938 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1939 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1945 class DataArrayDoubleTuple;
1947 class DataArrayDoubleIterator
1950 DataArrayDoubleIterator(DataArrayDouble *da);
1951 ~DataArrayDoubleIterator();
1956 DataArrayDoubleTuple *ret=self->nextt();
1958 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1961 PyErr_SetString(PyExc_StopIteration,"No more data.");
1968 class DataArrayDoubleTuple
1971 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1972 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1975 std::string __str__() const throw(INTERP_KERNEL::Exception)
1977 return self->repr();
1980 double __float__() const throw(INTERP_KERNEL::Exception)
1982 return self->doubleValue();
1985 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
1987 return self->buildDADouble(1,self->getNumberOfCompo());
1990 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1992 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1993 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
1994 Py_XINCREF(trueSelf);
1998 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2000 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2001 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2002 Py_XINCREF(trueSelf);
2006 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2008 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2009 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2010 Py_XINCREF(trueSelf);
2014 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2016 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2017 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2018 Py_XINCREF(trueSelf);
2022 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2024 return PyInt_FromLong(self->getNumberOfCompo());
2027 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2029 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2032 std::vector<int> multiVal;
2033 std::pair<int, std::pair<int,int> > slic;
2034 MEDCoupling::DataArrayInt *daIntTyypp=0;
2035 const double *pt=self->getConstPointer();
2036 int nbc=self->getNumberOfCompo();
2037 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2044 std::ostringstream oss;
2045 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2046 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2050 return PyFloat_FromDouble(pt[singleVal]);
2054 return PyFloat_FromDouble(pt[nbc+singleVal]);
2057 std::ostringstream oss;
2058 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2059 throw INTERP_KERNEL::Exception(oss.str().c_str());
2065 PyObject *t=PyTuple_New(multiVal.size());
2066 for(int j=0;j<(int)multiVal.size();j++)
2068 int cid=multiVal[j];
2071 std::ostringstream oss;
2072 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2073 throw INTERP_KERNEL::Exception(oss.str().c_str());
2075 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2081 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2082 PyObject *t=PyTuple_New(sz);
2083 for(int j=0;j<sz;j++)
2084 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2088 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2092 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2094 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2095 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2098 std::vector<double> multiValV;
2099 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2100 int nbc=self->getNumberOfCompo();
2101 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2103 std::vector<int> multiVal;
2104 std::pair<int, std::pair<int,int> > slic;
2105 MEDCoupling::DataArrayInt *daIntTyypp=0;
2106 double *pt=self->getPointer();
2107 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2114 std::ostringstream oss;
2115 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2116 throw INTERP_KERNEL::Exception(oss.str().c_str());
2122 pt[singleVal]=singleValV;
2127 if(multiValV.size()!=1)
2129 std::ostringstream oss;
2130 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2131 throw INTERP_KERNEL::Exception(oss.str().c_str());
2133 pt[singleVal]=multiValV[0];
2138 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2142 throw INTERP_KERNEL::Exception(msg);
2151 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2155 std::ostringstream oss;
2156 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2157 throw INTERP_KERNEL::Exception(oss.str().c_str());
2165 if(multiVal.size()!=multiValV.size())
2167 std::ostringstream oss;
2168 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2169 throw INTERP_KERNEL::Exception(oss.str().c_str());
2171 for(int i=0;i<(int)multiVal.size();i++)
2173 int pos=multiVal[i];
2176 std::ostringstream oss;
2177 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2178 throw INTERP_KERNEL::Exception(oss.str().c_str());
2180 pt[multiVal[i]]=multiValV[i];
2186 const double *ptV=daIntTyyppV->getConstPointer();
2187 if(nbc>daIntTyyppV->getNumberOfCompo())
2189 std::ostringstream oss;
2190 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2191 throw INTERP_KERNEL::Exception(oss.str().c_str());
2193 std::copy(ptV,ptV+nbc,pt);
2197 throw INTERP_KERNEL::Exception(msg);
2202 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2207 for(int j=0;j<sz;j++)
2208 pt[slic.first+j*slic.second.second]=singleValV;
2213 if(sz!=(int)multiValV.size())
2215 std::ostringstream oss;
2216 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2217 throw INTERP_KERNEL::Exception(oss.str().c_str());
2219 for(int j=0;j<sz;j++)
2220 pt[slic.first+j*slic.second.second]=multiValV[j];
2225 const double *ptV=daIntTyyppV->getConstPointer();
2226 if(sz>daIntTyyppV->getNumberOfCompo())
2228 std::ostringstream oss;
2229 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2230 throw INTERP_KERNEL::Exception(oss.str().c_str());
2232 for(int j=0;j<sz;j++)
2233 pt[slic.first+j*slic.second.second]=ptV[j];
2237 throw INTERP_KERNEL::Exception(msg);
2241 throw INTERP_KERNEL::Exception(msg);
2247 class DataArrayIntIterator;
2249 class DataArrayInt : public DataArray
2252 static DataArrayInt *New();
2253 int intValue() const throw(INTERP_KERNEL::Exception);
2254 int getHashCode() const throw(INTERP_KERNEL::Exception);
2255 bool empty() const throw(INTERP_KERNEL::Exception);
2256 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2257 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2258 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2259 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2260 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2261 int popBackSilent() throw(INTERP_KERNEL::Exception);
2262 void pack() const throw(INTERP_KERNEL::Exception);
2263 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2264 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2265 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2266 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2267 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2268 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2269 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2270 void reverse() throw(INTERP_KERNEL::Exception);
2271 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2272 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2273 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2274 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2275 void fillWithZero() throw(INTERP_KERNEL::Exception);
2276 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2277 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2278 std::string repr() const throw(INTERP_KERNEL::Exception);
2279 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2280 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2281 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2282 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2283 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2284 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2285 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2286 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2287 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2288 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2289 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2290 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2291 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2292 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2293 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2294 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2295 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2296 void transpose() throw(INTERP_KERNEL::Exception);
2297 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2298 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2299 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2300 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2301 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2302 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2303 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2304 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2305 int front() const throw(INTERP_KERNEL::Exception);
2306 int back() const throw(INTERP_KERNEL::Exception);
2307 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2308 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2309 int *getPointer() throw(INTERP_KERNEL::Exception);
2310 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2311 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2312 const int *begin() const throw(INTERP_KERNEL::Exception);
2313 const int *end() const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2316 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2317 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2318 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2319 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2320 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2321 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2322 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2323 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2324 int count(int value) const throw(INTERP_KERNEL::Exception);
2325 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2326 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2327 int getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
2328 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2329 void abs() throw(INTERP_KERNEL::Exception);
2330 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2331 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2332 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2333 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2334 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2335 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2336 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2337 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2338 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2339 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2340 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2341 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2342 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2343 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2344 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2345 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2346 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2347 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2348 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2349 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2350 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2351 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2352 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2353 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2357 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2358 void computeOffsets() throw(INTERP_KERNEL::Exception);
2359 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2361 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2362 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2363 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2364 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2365 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2366 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2367 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2368 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2369 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2370 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2371 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2372 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2373 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2375 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2376 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2377 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2378 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2379 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2380 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2381 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2382 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2383 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2384 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2385 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2387 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2390 DataArrayInt() throw(INTERP_KERNEL::Exception)
2392 return DataArrayInt::New();
2395 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2397 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)";
2398 std::string msg(msgBase);
2400 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2403 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2407 if(PyInt_Check(nbOfTuples))
2409 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2411 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2414 if(PyInt_Check(nbOfComp))
2415 {//DataArrayInt.New([1,3,4,5],2,2)
2416 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2418 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2419 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2420 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2421 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2425 throw INTERP_KERNEL::Exception(msg.c_str());
2428 {//DataArrayInt.New([1,3,4],3)
2429 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2431 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2432 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2437 throw INTERP_KERNEL::Exception(msg.c_str());
2440 {// DataArrayInt.New([1,3,4])
2441 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2442 int tmpp1=-1,tmpp2=-1;
2443 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2444 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2448 else if(PyInt_Check(elt0))
2450 int nbOfTuples1=PyInt_AS_LONG(elt0);
2452 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2457 if(PyInt_Check(nbOfTuples))
2458 {//DataArrayInt.New(5,2)
2459 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2461 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2462 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2463 ret->alloc(nbOfTuples1,nbOfCompo);
2467 throw INTERP_KERNEL::Exception(msg.c_str());
2470 throw INTERP_KERNEL::Exception(msg.c_str());
2473 {//DataArrayInt.New(5)
2474 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2475 ret->alloc(nbOfTuples1,1);
2480 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2481 {//DataArrayInt.New(numpyArray)
2482 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2486 throw INTERP_KERNEL::Exception(msg.c_str());
2487 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2490 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2492 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2495 std::string __str__() const throw(INTERP_KERNEL::Exception)
2497 return self->reprNotTooLong();
2500 int __len__() const throw(INTERP_KERNEL::Exception)
2502 if(self->isAllocated())
2504 return self->getNumberOfTuples();
2508 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2512 int __int__() const throw(INTERP_KERNEL::Exception)
2514 return self->intValue();
2517 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2519 return self->iterator();
2522 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2524 int sz=self->getNumberOfComponents();
2525 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2526 self->accumulate(tmp);
2527 return convertIntArrToPyList(tmp,sz);
2530 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2533 std::vector<int> val2;
2534 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2535 return self->accumulatePerChunck(bg,bg+sz);
2538 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2541 std::vector<int> val2;
2542 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2543 return self->findIdsEqualTuple(bg,bg+sz);
2546 DataArrayInt *findIdForEach(PyObject *vals) const throw(INTERP_KERNEL::Exception)
2549 std::vector<int> val2;
2550 const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
2551 MCAuto<DataArrayInt> ret(self->findIdForEach(bg,bg+sz));
2555 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2557 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2558 PyObject *ret=PyList_New(slcs.size());
2559 for(std::size_t i=0;i<slcs.size();i++)
2560 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2564 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2566 if(!PySlice_Check(slic))
2567 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2568 Py_ssize_t strt=2,stp=2,step=2;
2569 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2570 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2571 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 !");
2572 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2575 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2578 self->getMinMaxValues(a,b);
2579 PyObject *ret=PyTuple_New(2);
2580 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2581 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2585 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2587 int newNbOfTuples=-1;
2588 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2589 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2590 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2591 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2592 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2593 PyObject *ret=PyTuple_New(2);
2594 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2595 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2599 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2601 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2602 int szArr,sw,iTypppArr;
2603 std::vector<int> stdvecTyyppArr;
2604 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2605 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2606 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2610 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2612 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 !";
2613 if(PyList_Check(li) || PyTuple_Check(li))
2615 if(nbOfTuples && nbOfTuples != Py_None)
2617 if(PyInt_Check(nbOfTuples))
2619 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2621 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2622 if(nbOfComp && nbOfComp != Py_None)
2624 if(PyInt_Check(nbOfComp))
2625 {//DataArrayInt.setValues([1,3,4,5],2,2)
2626 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2628 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2629 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2630 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2633 throw INTERP_KERNEL::Exception(msg);
2636 {//DataArrayInt.setValues([1,3,4],3)
2638 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2639 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2643 throw INTERP_KERNEL::Exception(msg);
2646 {// DataArrayInt.setValues([1,3,4])
2647 int tmpp1=-1,tmpp2=-1;
2648 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2649 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2653 throw INTERP_KERNEL::Exception(msg);
2656 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2658 const int *vals=self->getConstPointer();
2659 return convertIntArrToPyList(vals,self->getNbOfElems());
2663 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2665 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2669 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2672 bool ret0=self->isEqualIfNotWhy(other,ret1);
2673 PyObject *ret=PyTuple_New(2);
2674 PyObject *ret0Py=ret0?Py_True:Py_False;
2676 PyTuple_SetItem(ret,0,ret0Py);
2677 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2681 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2683 const int *vals=self->getConstPointer();
2684 int nbOfComp=self->getNumberOfComponents();
2685 int nbOfTuples=self->getNumberOfTuples();
2686 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2689 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2691 std::vector<const DataArrayInt *> groups;
2692 std::vector< std::vector<int> > fidsOfGroups;
2693 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2694 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2695 PyObject *ret = PyList_New(2);
2696 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2697 int sz=fidsOfGroups.size();
2698 PyObject *ret1 = PyList_New(sz);
2699 for(int i=0;i<sz;i++)
2700 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2701 PyList_SetItem(ret,1,ret1);
2705 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2708 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2709 if (!SWIG_IsOK(res1))
2711 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2714 MapII *m=reinterpret_cast<MapII *>(da);
2715 self->transformWithIndArr(*m);
2720 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2721 self->transformWithIndArr(tmp,tmp+size);
2726 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2727 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2731 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2735 std::vector<int> multiVal;
2736 std::pair<int, std::pair<int,int> > slic;
2737 MEDCoupling::DataArrayInt *daIntTyypp=0;
2738 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2742 return self->findIdsEqualList(&singleVal,&singleVal+1);
2744 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2746 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2748 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2752 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2756 std::vector<int> multiVal;
2757 std::pair<int, std::pair<int,int> > slic;
2758 MEDCoupling::DataArrayInt *daIntTyypp=0;
2759 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2763 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2765 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2767 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2769 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2773 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2775 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2777 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2778 if (!SWIG_IsOK(res1))
2781 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2782 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2786 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2788 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2789 da2->checkAllocated();
2790 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2792 PyObject *ret = PyList_New(3);
2793 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2794 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2795 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2799 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2802 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2803 if (!SWIG_IsOK(res1))
2806 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2807 return self->transformWithIndArrR(tmp,tmp+size);
2811 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2812 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2816 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2819 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2820 if (!SWIG_IsOK(res1))
2823 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2824 if(size!=self->getNumberOfTuples())
2826 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2828 return self->renumberAndReduce(tmp,newNbOfTuple);
2832 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2834 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2835 da2->checkAllocated();
2836 int size=self->getNumberOfTuples();
2837 if(size!=self->getNumberOfTuples())
2839 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2841 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2845 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2848 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2849 if (!SWIG_IsOK(res1))
2852 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2853 if(size!=self->getNumberOfTuples())
2855 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2857 return self->renumber(tmp);
2861 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2863 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2864 da2->checkAllocated();
2865 int size=self->getNumberOfTuples();
2866 if(size!=self->getNumberOfTuples())
2868 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2870 return self->renumber(da2->getConstPointer());
2874 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2877 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2878 if (!SWIG_IsOK(res1))
2881 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2882 if(size!=self->getNumberOfTuples())
2884 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2886 return self->renumberR(tmp);
2890 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2892 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2893 da2->checkAllocated();
2894 int size=self->getNumberOfTuples();
2895 if(size!=self->getNumberOfTuples())
2897 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2899 return self->renumberR(da2->getConstPointer());
2903 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2905 std::vector<int> tmp;
2906 convertPyToNewIntArr3(li,tmp);
2907 self->setSelectedComponents(a,tmp);
2910 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2912 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2913 std::size_t sz(retCpp.size());
2914 PyObject *res(PyList_New(sz));
2915 for(std::size_t i=0;i<sz;i++)
2916 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2920 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2922 int sz=self->getNumberOfComponents();
2923 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2924 self->getTuple(tupleId,tmp);
2925 return convertIntArrToPyList(tmp,sz);
2928 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2930 DataArrayInt *arr=0;
2931 DataArrayInt *arrI=0;
2932 self->changeSurjectiveFormat(targetNb,arr,arrI);
2933 PyObject *res = PyList_New(2);
2934 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2935 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2939 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2941 std::vector<const DataArrayInt *> tmp;
2942 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2943 return DataArrayInt::Meld(tmp);
2946 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2948 std::vector<const DataArrayInt *> tmp;
2949 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2950 return DataArrayInt::Aggregate(tmp);
2953 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2955 std::vector<const DataArrayInt *> tmp;
2956 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2957 return DataArrayInt::AggregateIndexes(tmp);
2960 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2962 std::vector<const DataArrayInt *> tmp;
2963 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2964 return DataArrayInt::BuildUnion(tmp);
2967 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2969 std::vector<const DataArrayInt *> tmp;
2970 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2971 return DataArrayInt::BuildIntersection(tmp);
2974 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2977 int r1=self->getMaxValue(tmp);
2978 PyObject *ret=PyTuple_New(2);
2979 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2980 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2984 PyObject *getMaxAbsValue(std::size_t& tupleId) const throw(INTERP_KERNEL::Exception)
2987 int r1=self->getMaxAbsValue(tmp);
2988 PyObject *ret=PyTuple_New(2);
2989 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2990 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2994 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2997 int r1=self->getMinValue(tmp);
2998 PyObject *ret=PyTuple_New(2);
2999 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3000 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3004 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3006 int nbOfCompo=self->getNumberOfComponents();
3011 if(PyInt_Check(obj))
3013 int val=(int)PyInt_AS_LONG(obj);
3014 return self->findIdFirstEqual(val);
3017 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3021 std::vector<int> arr;
3022 convertPyToNewIntArr3(obj,arr);
3023 return self->findIdFirstEqualTuple(arr);
3028 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3030 int nbOfCompo=self->getNumberOfComponents();
3037 if(PyInt_Check(obj))
3039 int val=(int)PyInt_AS_LONG(obj);
3040 return self->presenceOfValue(val);
3043 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3047 std::vector<int> arr;
3048 convertPyToNewIntArr3(obj,arr);
3049 return self->presenceOfTuple(arr);
3054 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3056 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3057 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3058 self->checkAllocated();
3059 int nbOfTuples=self->getNumberOfTuples();
3060 int nbOfComponents=self->getNumberOfComponents();
3062 std::vector<int> vt1,vc1;
3063 std::pair<int, std::pair<int,int> > pt1,pc1;
3064 DataArrayInt *dt1=0,*dc1=0;
3066 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3067 MCAuto<DataArrayInt> ret;
3072 if(nbOfComponents==1)
3073 return PyInt_FromLong(self->getIJSafe(it1,0));
3074 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3077 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3079 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3081 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3083 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3086 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3087 std::vector<int> v2(1,ic1);
3088 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3092 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3093 std::vector<int> v2(1,ic1);
3094 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3098 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3099 std::vector<int> v2(1,ic1);
3100 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3104 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3105 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3109 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3114 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3115 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3119 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3120 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3124 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3125 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3126 std::vector<int> v2(nbOfComp);
3127 for(int i=0;i<nbOfComp;i++)
3128 v2[i]=pc1.first+i*pc1.second.second;
3129 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3133 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3134 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3135 std::vector<int> v2(nbOfComp);
3136 for(int i=0;i<nbOfComp;i++)
3137 v2[i]=pc1.first+i*pc1.second.second;
3138 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3142 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3143 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3144 std::vector<int> v2(nbOfComp);
3145 for(int i=0;i<nbOfComp;i++)
3146 v2[i]=pc1.first+i*pc1.second.second;
3147 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3151 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3152 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3153 std::vector<int> v2(nbOfComp);
3154 for(int i=0;i<nbOfComp;i++)
3155 v2[i]=pc1.first+i*pc1.second.second;
3156 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3159 throw INTERP_KERNEL::Exception(msg);
3163 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3165 self->checkAllocated();
3166 const char msg[]="Unexpected situation in __setitem__ !";
3167 int nbOfTuples=self->getNumberOfTuples();
3168 int nbOfComponents=self->getNumberOfComponents();
3171 std::vector<int> v1;
3173 DataArrayIntTuple *dd1=0;
3174 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3176 std::vector<int> vt1,vc1;
3177 std::pair<int, std::pair<int,int> > pt1,pc1;
3178 DataArrayInt *dt1=0,*dc1=0;
3179 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3180 MCAuto<DataArrayInt> tmp;
3188 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3191 tmp=DataArrayInt::New();
3192 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3193 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3196 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3199 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3200 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3203 throw INTERP_KERNEL::Exception(msg);
3212 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3215 tmp=DataArrayInt::New();
3216 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3217 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3220 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3223 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3224 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3227 throw INTERP_KERNEL::Exception(msg);
3236 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3239 tmp=DataArrayInt::New();
3240 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3241 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3244 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3247 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3248 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3251 throw INTERP_KERNEL::Exception(msg);
3260 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3263 tmp=DataArrayInt::New();
3264 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3265 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3268 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3271 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3272 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3275 throw INTERP_KERNEL::Exception(msg);
3284 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3287 tmp=DataArrayInt::New();
3288 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3289 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3292 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3295 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3296 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3299 throw INTERP_KERNEL::Exception(msg);
3308 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3311 tmp=DataArrayInt::New();
3312 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3313 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3316 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3319 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3320 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3323 throw INTERP_KERNEL::Exception(msg);
3332 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3335 tmp=DataArrayInt::New();
3336 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3337 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3340 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3343 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3344 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3347 throw INTERP_KERNEL::Exception(msg);
3356 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3359 tmp=DataArrayInt::New();
3360 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3361 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3364 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3367 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3368 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3371 throw INTERP_KERNEL::Exception(msg);
3380 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3383 tmp=DataArrayInt::New();
3384 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3385 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3388 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3391 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3392 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3395 throw INTERP_KERNEL::Exception(msg);
3404 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3407 tmp=DataArrayInt::New();
3408 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3409 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3412 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3415 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3416 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3419 throw INTERP_KERNEL::Exception(msg);
3428 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3431 tmp=DataArrayInt::New();
3432 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3433 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3436 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3439 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3440 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3443 throw INTERP_KERNEL::Exception(msg);
3452 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3455 tmp=DataArrayInt::New();
3456 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3457 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3460 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3463 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3464 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3467 throw INTERP_KERNEL::Exception(msg);
3476 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3479 tmp=DataArrayInt::New();
3480 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3481 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3484 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3487 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3488 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3491 throw INTERP_KERNEL::Exception(msg);
3500 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3503 tmp=DataArrayInt::New();
3504 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3505 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3508 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3511 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3512 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3515 throw INTERP_KERNEL::Exception(msg);
3524 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3527 tmp=DataArrayInt::New();
3528 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3529 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3532 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3535 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3536 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3539 throw INTERP_KERNEL::Exception(msg);
3548 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3551 tmp=DataArrayInt::New();
3552 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3553 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3556 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3559 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3560 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3563 throw INTERP_KERNEL::Exception(msg);
3568 throw INTERP_KERNEL::Exception(msg);
3573 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3575 return self->negate();
3578 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3580 const char msg[]="Unexpected situation in __add__ !";
3583 std::vector<int> aa;
3584 DataArrayIntTuple *aaa;
3586 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3591 MCAuto<DataArrayInt> ret=self->deepCopy();
3592 ret->applyLin(1,val);
3597 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3598 return DataArrayInt::Add(self,aaaa);
3602 return DataArrayInt::Add(self,a);
3606 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3607 return DataArrayInt::Add(self,aaaa);
3610 throw INTERP_KERNEL::Exception(msg);
3614 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3616 const char msg[]="Unexpected situation in __radd__ !";
3619 std::vector<int> aa;
3620 DataArrayIntTuple *aaa;
3622 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3627 MCAuto<DataArrayInt> ret=self->deepCopy();
3628 ret->applyLin(1,val);
3633 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3634 return DataArrayInt::Add(self,aaaa);
3638 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3639 return DataArrayInt::Add(self,aaaa);
3642 throw INTERP_KERNEL::Exception(msg);
3646 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3648 const char msg[]="Unexpected situation in __iadd__ !";
3651 std::vector<int> aa;
3652 DataArrayIntTuple *aaa;
3654 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3659 self->applyLin(1,val);
3660 Py_XINCREF(trueSelf);
3665 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3667 Py_XINCREF(trueSelf);
3673 Py_XINCREF(trueSelf);
3678 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3679 self->addEqual(aaaa);
3680 Py_XINCREF(trueSelf);
3684 throw INTERP_KERNEL::Exception(msg);
3688 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3690 const char msg[]="Unexpected situation in __sub__ !";
3693 std::vector<int> aa;
3694 DataArrayIntTuple *aaa;
3696 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3701 MCAuto<DataArrayInt> ret=self->deepCopy();
3702 ret->applyLin(1,-val);
3707 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3708 return DataArrayInt::Substract(self,aaaa);
3712 return DataArrayInt::Substract(self,a);
3716 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3717 return DataArrayInt::Substract(self,aaaa);
3720 throw INTERP_KERNEL::Exception(msg);
3724 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3726 const char msg[]="Unexpected situation in __rsub__ !";
3729 std::vector<int> aa;
3730 DataArrayIntTuple *aaa;
3732 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3737 MCAuto<DataArrayInt> ret=self->deepCopy();
3738 ret->applyLin(-1,val);
3743 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3744 return DataArrayInt::Substract(aaaa,self);
3748 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3749 return DataArrayInt::Substract(aaaa,self);
3752 throw INTERP_KERNEL::Exception(msg);
3756 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3758 const char msg[]="Unexpected situation in __isub__ !";
3761 std::vector<int> aa;
3762 DataArrayIntTuple *aaa;
3764 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3769 self->applyLin(1,-val);
3770 Py_XINCREF(trueSelf);
3775 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3776 self->substractEqual(bb);
3777 Py_XINCREF(trueSelf);
3782 self->substractEqual(a);
3783 Py_XINCREF(trueSelf);
3788 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3789 self->substractEqual(aaaa);
3790 Py_XINCREF(trueSelf);
3794 throw INTERP_KERNEL::Exception(msg);
3798 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3800 const char msg[]="Unexpected situation in __mul__ !";
3803 std::vector<int> aa;
3804 DataArrayIntTuple *aaa;
3806 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3811 MCAuto<DataArrayInt> ret=self->deepCopy();
3812 ret->applyLin(val,0);
3817 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3818 return DataArrayInt::Multiply(self,aaaa);
3822 return DataArrayInt::Multiply(self,a);
3826 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3827 return DataArrayInt::Multiply(self,aaaa);
3830 throw INTERP_KERNEL::Exception(msg);
3834 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3836 const char msg[]="Unexpected situation in __rmul__ !";
3839 std::vector<int> aa;
3840 DataArrayIntTuple *aaa;
3842 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3847 MCAuto<DataArrayInt> ret=self->deepCopy();
3848 ret->applyLin(val,0);
3853 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3854 return DataArrayInt::Multiply(self,aaaa);
3858 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3859 return DataArrayInt::Multiply(self,aaaa);
3862 throw INTERP_KERNEL::Exception(msg);
3866 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3868 const char msg[]="Unexpected situation in __imul__ !";
3871 std::vector<int> aa;
3872 DataArrayIntTuple *aaa;
3874 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3879 self->applyLin(val,0);
3880 Py_XINCREF(trueSelf);
3885 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3886 self->multiplyEqual(bb);
3887 Py_XINCREF(trueSelf);
3892 self->multiplyEqual(a);
3893 Py_XINCREF(trueSelf);
3898 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3899 self->multiplyEqual(aaaa);
3900 Py_XINCREF(trueSelf);
3904 throw INTERP_KERNEL::Exception(msg);
3908 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3910 const char msg[]="Unexpected situation in __div__ !";
3913 std::vector<int> aa;
3914 DataArrayIntTuple *aaa;
3916 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3921 MCAuto<DataArrayInt> ret=self->deepCopy();
3922 ret->applyDivideBy(val);
3927 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3928 return DataArrayInt::Divide(self,aaaa);
3932 return DataArrayInt::Divide(self,a);
3936 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3937 return DataArrayInt::Divide(self,aaaa);
3940 throw INTERP_KERNEL::Exception(msg);
3944 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3946 const char msg[]="Unexpected situation in __rdiv__ !";
3949 std::vector<int> aa;
3950 DataArrayIntTuple *aaa;
3952 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3957 MCAuto<DataArrayInt> ret=self->deepCopy();
3963 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3964 return DataArrayInt::Divide(aaaa,self);
3968 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3969 return DataArrayInt::Divide(aaaa,self);
3972 throw INTERP_KERNEL::Exception(msg);
3976 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3978 const char msg[]="Unexpected situation in __idiv__ !";
3981 std::vector<int> aa;
3982 DataArrayIntTuple *aaa;
3984 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3989 self->applyDivideBy(val);
3990 Py_XINCREF(trueSelf);
3995 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3996 self->divideEqual(bb);
3997 Py_XINCREF(trueSelf);
4002 self->divideEqual(a);
4003 Py_XINCREF(trueSelf);
4008 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4009 self->divideEqual(aaaa);
4010 Py_XINCREF(trueSelf);
4014 throw INTERP_KERNEL::Exception(msg);
4018 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4020 const char msg[]="Unexpected situation in __mod__ !";
4023 std::vector<int> aa;
4024 DataArrayIntTuple *aaa;
4026 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4031 MCAuto<DataArrayInt> ret=self->deepCopy();
4032 ret->applyModulus(val);
4037 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4038 return DataArrayInt::Modulus(self,aaaa);
4042 return DataArrayInt::Modulus(self,a);
4046 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4047 return DataArrayInt::Modulus(self,aaaa);
4050 throw INTERP_KERNEL::Exception(msg);
4054 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4056 const char msg[]="Unexpected situation in __rmod__ !";
4059 std::vector<int> aa;
4060 DataArrayIntTuple *aaa;
4062 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4067 MCAuto<DataArrayInt> ret=self->deepCopy();
4068 ret->applyRModulus(val);
4073 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4074 return DataArrayInt::Modulus(aaaa,self);
4078 return DataArrayInt::Modulus(a,self);
4082 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4083 return DataArrayInt::Modulus(aaaa,self);
4086 throw INTERP_KERNEL::Exception(msg);
4090 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4092 const char msg[]="Unexpected situation in __imod__ !";
4095 std::vector<int> aa;
4096 DataArrayIntTuple *aaa;
4098 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4103 self->applyModulus(val);
4104 Py_XINCREF(trueSelf);
4109 self->modulusEqual(a);
4110 Py_XINCREF(trueSelf);
4115 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4116 self->modulusEqual(aaaa);
4117 Py_XINCREF(trueSelf);
4121 throw INTERP_KERNEL::Exception(msg);
4125 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4127 const char msg[]="Unexpected situation in __pow__ !";
4130 std::vector<int> aa;
4131 DataArrayIntTuple *aaa;
4133 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4138 MCAuto<DataArrayInt> ret=self->deepCopy();
4144 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4145 return DataArrayInt::Pow(self,aaaa);
4149 return DataArrayInt::Pow(self,a);
4153 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4154 return DataArrayInt::Pow(self,aaaa);
4157 throw INTERP_KERNEL::Exception(msg);
4161 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4163 const char msg[]="Unexpected situation in __rpow__ !";
4166 std::vector<int> aa;
4167 DataArrayIntTuple *aaa;
4169 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4174 MCAuto<DataArrayInt> ret=self->deepCopy();
4175 ret->applyRPow(val);
4180 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4181 return DataArrayInt::Pow(aaaa,self);
4185 return DataArrayInt::Pow(a,self);
4189 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4190 return DataArrayInt::Pow(aaaa,self);
4193 throw INTERP_KERNEL::Exception(msg);
4197 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4199 const char msg[]="Unexpected situation in __ipow__ !";
4202 std::vector<int> aa;
4203 DataArrayIntTuple *aaa;
4205 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4210 self->applyPow(val);
4211 Py_XINCREF(trueSelf);
4217 Py_XINCREF(trueSelf);
4222 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4223 self->powEqual(aaaa);
4224 Py_XINCREF(trueSelf);
4228 throw INTERP_KERNEL::Exception(msg);
4232 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4234 std::ostringstream oss;
4235 self->reprQuickOverview(oss);
4239 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4241 int szArr,sw,iTypppArr;
4242 std::vector<int> stdvecTyyppArr;
4243 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4244 self->pushBackValsSilent(tmp,tmp+szArr);
4247 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4249 std::vector<int> ret1;
4250 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4251 std::size_t sz=ret0.size();
4252 PyObject *pyRet=PyTuple_New(2);
4253 PyObject *pyRet0=PyList_New((int)sz);
4254 PyObject *pyRet1=PyList_New((int)sz);
4255 for(std::size_t i=0;i<sz;i++)
4257 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4258 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4260 PyTuple_SetItem(pyRet,0,pyRet0);
4261 PyTuple_SetItem(pyRet,1,pyRet1);
4265 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4267 DataArrayInt *ret0=0,*ret1=0;
4268 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4269 PyObject *pyRet=PyTuple_New(2);
4270 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4271 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4275 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4278 bool ret(self->isRange(a,b,c));
4279 PyObject *pyRet=PyTuple_New(2);
4280 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4282 PyTuple_SetItem(pyRet,0,ret0Py);
4284 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4290 PyTuple_SetItem(pyRet,1,ret1Py);
4296 class DataArrayIntTuple;
4298 class DataArrayIntIterator
4301 DataArrayIntIterator(DataArrayInt *da);
4302 ~DataArrayIntIterator();
4307 DataArrayIntTuple *ret=self->nextt();
4309 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4312 PyErr_SetString(PyExc_StopIteration,"No more data.");
4319 class DataArrayIntTuple
4322 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4323 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4326 std::string __str__() const throw(INTERP_KERNEL::Exception)
4328 return self->repr();
4331 int __int__() const throw(INTERP_KERNEL::Exception)
4333 return self->intValue();
4336 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4338 return self->buildDAInt(1,self->getNumberOfCompo());
4341 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4343 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4344 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4345 Py_XINCREF(trueSelf);
4349 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4351 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4352 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4353 Py_XINCREF(trueSelf);
4357 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4359 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4360 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4361 Py_XINCREF(trueSelf);
4364 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4366 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4367 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4368 Py_XINCREF(trueSelf);
4372 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4374 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4375 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4376 Py_XINCREF(trueSelf);
4380 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4382 return PyInt_FromLong(self->getNumberOfCompo());
4385 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4387 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4390 std::vector<int> multiVal;
4391 std::pair<int, std::pair<int,int> > slic;
4392 MEDCoupling::DataArrayInt *daIntTyypp=0;
4393 const int *pt=self->getConstPointer();
4394 int nbc=self->getNumberOfCompo();
4395 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4402 std::ostringstream oss;
4403 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4404 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4408 return PyInt_FromLong(pt[singleVal]);
4412 return PyInt_FromLong(pt[nbc+singleVal]);
4415 std::ostringstream oss;
4416 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4417 throw INTERP_KERNEL::Exception(oss.str().c_str());
4423 PyObject *t=PyTuple_New(multiVal.size());
4424 for(int j=0;j<(int)multiVal.size();j++)
4426 int cid=multiVal[j];
4429 std::ostringstream oss;
4430 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4431 throw INTERP_KERNEL::Exception(oss.str().c_str());
4433 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4439 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4440 PyObject *t=PyTuple_New(sz);
4441 for(int j=0;j<sz;j++)
4442 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4446 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4450 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4452 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4453 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4456 std::vector<int> multiValV;
4457 std::pair<int, std::pair<int,int> > slicV;
4458 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4459 int nbc=self->getNumberOfCompo();
4460 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4462 std::vector<int> multiVal;
4463 std::pair<int, std::pair<int,int> > slic;
4464 MEDCoupling::DataArrayInt *daIntTyypp=0;
4465 int *pt=self->getPointer();
4466 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4473 std::ostringstream oss;
4474 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4475 throw INTERP_KERNEL::Exception(oss.str().c_str());
4481 pt[singleVal]=singleValV;
4486 if(multiValV.size()!=1)
4488 std::ostringstream oss;
4489 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4490 throw INTERP_KERNEL::Exception(oss.str().c_str());
4492 pt[singleVal]=multiValV[0];
4497 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4501 throw INTERP_KERNEL::Exception(msg);
4510 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4514 std::ostringstream oss;
4515 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4516 throw INTERP_KERNEL::Exception(oss.str().c_str());
4524 if(multiVal.size()!=multiValV.size())
4526 std::ostringstream oss;
4527 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4528 throw INTERP_KERNEL::Exception(oss.str().c_str());
4530 for(int i=0;i<(int)multiVal.size();i++)
4532 int pos=multiVal[i];
4535 std::ostringstream oss;
4536 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4537 throw INTERP_KERNEL::Exception(oss.str().c_str());
4539 pt[multiVal[i]]=multiValV[i];
4545 const int *ptV=daIntTyyppV->getConstPointer();
4546 if(nbc>daIntTyyppV->getNumberOfCompo())
4548 std::ostringstream oss;
4549 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4550 throw INTERP_KERNEL::Exception(oss.str().c_str());
4552 std::copy(ptV,ptV+nbc,pt);
4556 throw INTERP_KERNEL::Exception(msg);
4561 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4566 for(int j=0;j<sz;j++)
4567 pt[slic.first+j*slic.second.second]=singleValV;
4572 if(sz!=(int)multiValV.size())
4574 std::ostringstream oss;
4575 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4576 throw INTERP_KERNEL::Exception(oss.str().c_str());
4578 for(int j=0;j<sz;j++)
4579 pt[slic.first+j*slic.second.second]=multiValV[j];
4584 const int *ptV=daIntTyyppV->getConstPointer();
4585 if(sz>daIntTyyppV->getNumberOfCompo())
4587 std::ostringstream oss;
4588 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4589 throw INTERP_KERNEL::Exception(oss.str().c_str());
4591 for(int j=0;j<sz;j++)
4592 pt[slic.first+j*slic.second.second]=ptV[j];
4596 throw INTERP_KERNEL::Exception(msg);
4600 throw INTERP_KERNEL::Exception(msg);
4606 class DataArrayChar : public DataArray
4609 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4610 int getHashCode() const throw(INTERP_KERNEL::Exception);
4611 bool empty() const throw(INTERP_KERNEL::Exception);
4612 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4613 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4614 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4615 char popBackSilent() throw(INTERP_KERNEL::Exception);
4616 void pack() const throw(INTERP_KERNEL::Exception);
4617 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4618 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4619 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4620 void reverse() throw(INTERP_KERNEL::Exception);
4621 void fillWithZero() throw(INTERP_KERNEL::Exception);
4622 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4623 std::string repr() const throw(INTERP_KERNEL::Exception);
4624 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4625 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4626 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4627 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4628 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4629 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4630 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4631 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4632 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4633 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4634 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4635 char front() const throw(INTERP_KERNEL::Exception);
4636 char back() const throw(INTERP_KERNEL::Exception);
4637 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4638 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4639 char *getPointer() throw(INTERP_KERNEL::Exception);
4640 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4641 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4642 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4643 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4644 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4645 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4646 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4647 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4648 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4649 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4650 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4653 int __len__() const throw(INTERP_KERNEL::Exception)
4655 if(self->isAllocated())
4657 return self->getNumberOfTuples();
4661 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4665 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4668 bool ret0=self->isEqualIfNotWhy(other,ret1);
4669 PyObject *ret=PyTuple_New(2);
4670 PyObject *ret0Py=ret0?Py_True:Py_False;
4672 PyTuple_SetItem(ret,0,ret0Py);
4673 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4677 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4680 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4681 if (!SWIG_IsOK(res1))
4684 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4685 if(size!=self->getNumberOfTuples())
4687 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4689 return self->renumber(tmp);
4693 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4695 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4696 da2->checkAllocated();
4697 int size=self->getNumberOfTuples();
4698 if(size!=self->getNumberOfTuples())
4700 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4702 return self->renumber(da2->getConstPointer());
4706 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4709 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4710 if (!SWIG_IsOK(res1))
4713 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4714 if(size!=self->getNumberOfTuples())
4716 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4718 return self->renumberR(tmp);
4722 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4724 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4725 da2->checkAllocated();
4726 int size=self->getNumberOfTuples();
4727 if(size!=self->getNumberOfTuples())
4729 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4731 return self->renumberR(da2->getConstPointer());
4735 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4738 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4739 if (!SWIG_IsOK(res1))
4742 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4743 if(size!=self->getNumberOfTuples())
4745 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4747 return self->renumberAndReduce(tmp,newNbOfTuple);
4751 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4753 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4754 da2->checkAllocated();
4755 int size=self->getNumberOfTuples();
4756 if(size!=self->getNumberOfTuples())
4758 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4760 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4764 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4766 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4767 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4768 return DataArrayChar::Aggregate(tmp);
4771 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4773 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4774 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4775 return DataArrayChar::Meld(tmp);
4780 class DataArrayByteIterator;
4782 class DataArrayByte : public DataArrayChar
4785 static DataArrayByte *New();
4786 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4787 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4788 char byteValue() const throw(INTERP_KERNEL::Exception);
4791 DataArrayByte() throw(INTERP_KERNEL::Exception)
4793 return DataArrayByte::New();
4796 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4798 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) !";
4799 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4803 if(PyInt_Check(nbOfTuples))
4805 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4807 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4810 if(PyInt_Check(nbOfComp))
4811 {//DataArrayByte.New([1,3,4,5],2,2)
4812 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4814 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4815 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4816 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4817 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4821 throw INTERP_KERNEL::Exception(msg);
4824 {//DataArrayByte.New([1,3,4],3)
4825 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4827 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4828 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4833 throw INTERP_KERNEL::Exception(msg);
4836 {// DataArrayByte.New([1,3,4])
4837 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4838 int tmpp1=-1,tmpp2=-1;
4839 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4840 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4844 else if(PyInt_Check(elt0))
4846 int nbOfTuples1=PyInt_AS_LONG(elt0);
4848 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4853 if(PyInt_Check(nbOfTuples))
4854 {//DataArrayByte.New(5,2)
4855 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4857 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4858 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4859 ret->alloc(nbOfTuples1,nbOfCompo);
4863 throw INTERP_KERNEL::Exception(msg);
4866 throw INTERP_KERNEL::Exception(msg);
4869 {//DataArrayByte.New(5)
4870 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4871 ret->alloc(nbOfTuples1,1);
4876 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4877 {//DataArrayDouble.New(numpyArray)
4878 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4882 throw INTERP_KERNEL::Exception(msg);
4885 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4887 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4890 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4892 std::ostringstream oss;
4893 self->reprQuickOverview(oss);
4897 int __int__() const throw(INTERP_KERNEL::Exception)
4899 return (int) self->byteValue();
4902 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4904 return self->iterator();
4907 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4909 return (int)self->getIJ(tupleId,compoId);
4912 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4914 return (int)self->getIJSafe(tupleId,compoId);
4917 std::string __str__() const throw(INTERP_KERNEL::Exception)
4919 return self->repr();
4922 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4924 const char *vals=self->getConstPointer();
4925 int nbOfComp=self->getNumberOfComponents();
4926 int nbOfTuples=self->getNumberOfTuples();
4927 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4930 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4933 int ival=-1; std::vector<int> ivval;
4934 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4935 std::vector<char> vals(sz);
4936 std::copy(pt,pt+sz,vals.begin());
4937 return self->presenceOfTuple(vals);
4940 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4943 int ival=-1; std::vector<int> ivval;
4944 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4945 std::vector<char> vals2(sz);
4946 std::copy(pt,pt+sz,vals2.begin());
4947 return self->presenceOfValue(vals2);
4950 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4953 int ival=-1; std::vector<int> ivval;
4954 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4955 std::vector<char> vals2(sz);
4956 std::copy(pt,pt+sz,vals2.begin());
4957 return self->findIdFirstEqual(vals2);
4960 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4963 int ival=-1; std::vector<int> ivval;
4964 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4965 std::vector<char> vals(sz);
4966 std::copy(pt,pt+sz,vals.begin());
4967 return self->findIdFirstEqualTuple(vals);
4970 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4973 int ival=-1; std::vector<int> ivval;
4974 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
4975 std::vector<char> vals(sz);
4976 std::copy(pt,pt+sz,vals.begin());
4977 return self->findIdSequence(vals);
4980 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4982 int sz=self->getNumberOfComponents();
4983 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4984 self->getTuple(tupleId,tmp);
4985 PyObject *ret=PyTuple_New(sz);
4986 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4990 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4993 int r1=(int)self->getMaxValue(tmp);
4994 PyObject *ret=PyTuple_New(2);
4995 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4996 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5000 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5003 int r1=(int)self->getMinValue(tmp);
5004 PyObject *ret=PyTuple_New(2);
5005 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5006 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5010 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5012 int nbOfCompo=self->getNumberOfComponents();
5017 if(PyInt_Check(obj))
5019 int val=(int)PyInt_AS_LONG(obj);
5020 return self->findIdFirstEqual(val);
5023 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5026 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5030 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5032 int nbOfCompo=self->getNumberOfComponents();
5039 if(PyInt_Check(obj))
5041 int val=(int)PyInt_AS_LONG(obj);
5042 return self->presenceOfValue(val);
5045 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5048 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5053 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5055 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5059 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5061 self->checkAllocated();
5062 const char msg[]="Unexpected situation in __setitem__ !";
5063 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5066 std::vector<int> v1;
5068 DataArrayIntTuple *dd1=0;
5069 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5071 std::vector<int> vt1,vc1;
5072 std::pair<int, std::pair<int,int> > pt1,pc1;
5073 DataArrayInt *dt1=0,*dc1=0;
5074 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5075 MCAuto<DataArrayInt> tmp;
5083 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5086 throw INTERP_KERNEL::Exception(msg);
5095 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5098 throw INTERP_KERNEL::Exception(msg);
5107 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5110 throw INTERP_KERNEL::Exception(msg);
5119 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5122 throw INTERP_KERNEL::Exception(msg);
5131 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5134 throw INTERP_KERNEL::Exception(msg);
5143 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5146 throw INTERP_KERNEL::Exception(msg);
5155 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5158 throw INTERP_KERNEL::Exception(msg);
5167 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5170 throw INTERP_KERNEL::Exception(msg);
5179 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5182 throw INTERP_KERNEL::Exception(msg);
5191 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5194 throw INTERP_KERNEL::Exception(msg);
5203 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5206 throw INTERP_KERNEL::Exception(msg);
5215 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5218 throw INTERP_KERNEL::Exception(msg);
5227 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5230 throw INTERP_KERNEL::Exception(msg);
5239 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5242 throw INTERP_KERNEL::Exception(msg);
5251 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5254 throw INTERP_KERNEL::Exception(msg);
5263 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5266 throw INTERP_KERNEL::Exception(msg);
5271 throw INTERP_KERNEL::Exception(msg);
5278 class DataArrayByteTuple;
5280 class DataArrayByteIterator
5283 DataArrayByteIterator(DataArrayByte *da);
5284 ~DataArrayByteIterator();
5287 class DataArrayByteTuple
5290 std::string repr() const throw(INTERP_KERNEL::Exception);
5291 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5294 std::string __str__() const throw(INTERP_KERNEL::Exception)
5296 return self->repr();
5299 char __int__() const throw(INTERP_KERNEL::Exception)
5301 return self->byteValue();
5304 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5306 return self->buildDAByte(1,self->getNumberOfCompo());
5311 class DataArrayAsciiCharIterator;
5313 class DataArrayAsciiChar : public DataArrayChar
5316 static DataArrayAsciiChar *New();
5317 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5318 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5319 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5322 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5324 return DataArrayAsciiChar::New();
5327 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5329 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) !";
5330 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5334 if(PyInt_Check(nbOfTuples))
5336 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5338 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5341 if(PyInt_Check(nbOfComp))
5342 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5343 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5345 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5346 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5347 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5348 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5352 throw INTERP_KERNEL::Exception(msg);
5355 {//DataArrayAsciiChar.New([1,3,4],3)
5356 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5358 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5359 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5363 else if(PyString_Check(nbOfTuples))
5365 if(PyString_Size(nbOfTuples)!=1)
5366 throw INTERP_KERNEL::Exception(msg);
5367 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5368 std::vector<std::string> tmp;
5369 if(fillStringVector(elt0,tmp))
5370 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5372 throw INTERP_KERNEL::Exception(msg);
5374 %#if PY_VERSION_HEX >= 0x03000000
5375 else if(PyUnicode_Check(nbOfTuples))
5377 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5378 throw INTERP_KERNEL::Exception(msg);
5379 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5380 std::vector<std::string> tmp;
5381 if(fillStringVector(elt0,tmp))
5382 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5384 throw INTERP_KERNEL::Exception(msg);
5388 throw INTERP_KERNEL::Exception(msg);
5392 std::vector<std::string> tmmp;
5393 if(fillStringVector(elt0,tmmp))
5394 //DataArrayAsciiChar.New(["abc","de","fghi"])
5395 return DataArrayAsciiChar::New(tmmp,' ');
5398 // DataArrayAsciiChar.New([1,3,4])
5399 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5400 int tmpp1=-1,tmpp2=-1;
5401 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5402 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5407 else if(PyInt_Check(elt0))
5409 int nbOfTuples1=PyInt_AS_LONG(elt0);
5411 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5416 if(PyInt_Check(nbOfTuples))
5417 {//DataArrayAsciiChar.New(5,2)
5418 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5420 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5421 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5422 ret->alloc(nbOfTuples1,nbOfCompo);
5426 throw INTERP_KERNEL::Exception(msg);
5429 throw INTERP_KERNEL::Exception(msg);
5432 {//DataArrayAsciiChar.New(5)
5433 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5434 ret->alloc(nbOfTuples1,1);
5439 throw INTERP_KERNEL::Exception(msg);
5442 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5444 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5447 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5449 std::ostringstream oss;
5450 self->reprQuickOverview(oss);
5454 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5456 return self->iterator();
5459 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5461 char tmp[2]; tmp[1]='\0';
5462 tmp[0]=self->getIJ(tupleId,compoId);
5463 return std::string(tmp);
5466 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5468 char tmp[2]; tmp[1]='\0';
5469 tmp[0]=self->getIJSafe(tupleId,compoId);
5470 return std::string(tmp);
5473 std::string __str__() const throw(INTERP_KERNEL::Exception)
5475 return self->repr();
5478 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5480 const char *vals=self->getConstPointer();
5481 int nbOfComp=self->getNumberOfComponents();
5482 int nbOfTuples=self->getNumberOfTuples();
5483 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5486 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5488 if(PyString_Check(tupl))
5490 Py_ssize_t sz=PyString_Size(tupl);
5491 std::vector<char> vals(sz);
5492 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5493 return self->presenceOfTuple(vals);
5495 %#if PY_VERSION_HEX >= 0x03000000
5496 else if(PyUnicode_Check(tupl))
5498 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5499 std::vector<char> vals(sz);
5500 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5501 return self->presenceOfTuple(vals);
5505 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5508 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5510 if(PyString_Check(vals))
5512 Py_ssize_t sz=PyString_Size(vals);
5513 std::vector<char> vals2(sz);
5514 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5515 return self->presenceOfValue(vals2);
5517 %#if PY_VERSION_HEX >= 0x03000000
5518 if(PyUnicode_Check(vals))
5520 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5521 std::vector<char> vals2(sz);
5522 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5523 return self->presenceOfValue(vals2);
5527 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5530 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5532 if(PyString_Check(vals))
5534 Py_ssize_t sz=PyString_Size(vals);
5535 std::vector<char> vals2(sz);
5536 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5537 return self->findIdFirstEqual(vals2);
5539 %#if PY_VERSION_HEX >= 0x03000000
5540 if(PyUnicode_Check(vals))
5542 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5543 std::vector<char> vals2(sz);
5544 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5545 return self->findIdFirstEqual(vals2);
5549 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5552 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5554 if(PyString_Check(tupl))
5556 Py_ssize_t sz=PyString_Size(tupl);
5557 std::vector<char> vals(sz);
5558 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5559 return self->findIdFirstEqualTuple(vals);
5561 %#if PY_VERSION_HEX >= 0x03000000
5562 if(PyUnicode_Check(tupl))
5564 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5565 std::vector<char> vals(sz);
5566 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5567 return self->findIdFirstEqualTuple(vals);
5571 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5574 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5576 if(PyString_Check(strOrListOfInt))
5578 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5579 std::vector<char> vals(sz);
5580 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5581 return self->findIdSequence(vals);
5583 %#if PY_VERSION_HEX >= 0x03000000
5584 else if(PyUnicode_Check(strOrListOfInt))
5586 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5587 std::vector<char> vals(sz);
5588 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5589 return self->findIdSequence(vals);
5593 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5596 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5598 int sz=self->getNumberOfComponents();
5599 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5600 self->getTuple(tupleId,tmp);
5601 return PyString_FromString(tmp);
5604 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5607 char tmp2[2]; tmp2[1]='\0';
5608 tmp2[0]=self->getMaxValue(tmp);
5609 PyObject *ret=PyTuple_New(2);
5610 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5611 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5615 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5618 char tmp2[2]; tmp2[1]='\0';
5619 tmp2[0]=self->getMinValue(tmp);
5620 PyObject *ret=PyTuple_New(2);
5621 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5622 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5626 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5628 int nbOfCompo=self->getNumberOfComponents();
5633 if(PyString_Check(obj))
5635 Py_ssize_t sz=PyString_Size(obj);
5636 char *pt=PyString_AsString(obj);
5638 return self->findIdFirstEqual(pt[0]);
5640 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5642 %#if PY_VERSION_HEX >= 0x03000000
5643 if(PyUnicode_Check(obj))
5646 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5648 return self->findIdFirstEqual(pt[0]);
5650 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5654 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5657 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5661 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5663 int nbOfCompo=self->getNumberOfComponents();
5670 if(PyString_Check(obj))
5672 Py_ssize_t sz=PyString_Size(obj);
5673 char *pt=PyString_AsString(obj);
5675 return self->presenceOfValue(pt[0]);
5677 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5679 %#if PY_VERSION_HEX >= 0x03000000
5680 if(PyUnicode_Check(obj))
5683 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5685 return self->presenceOfValue(pt[0]);
5687 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5691 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5694 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5698 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5701 std::vector<int> stdvecTyyppArr;
5702 std::pair<int, std::pair<int,int> > sTyyppArr;
5703 MEDCoupling::DataArrayInt *daIntTyypp=0;
5704 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5708 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5710 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5712 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5714 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5716 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5720 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5722 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.";
5724 std::vector<int> stdvecTyyppArr;
5725 std::pair<int, std::pair<int,int> > sTyyppArr;
5726 MEDCoupling::DataArrayInt *daIntTyypp=0;
5727 int nbOfCompo=self->getNumberOfComponents();
5728 int nbOfTuples=self->getNumberOfTuples();
5729 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5731 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5732 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5741 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5747 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5748 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5751 //value vector<string>
5754 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5755 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5758 //value DataArrayChar
5761 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5765 throw INTERP_KERNEL::Exception(msg);
5769 {//obj list-tuple[int]
5775 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5781 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5782 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5785 //value vector<string>
5788 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5789 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5792 //value DataArrayChar
5795 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5799 throw INTERP_KERNEL::Exception(msg);
5810 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5816 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5817 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5820 //value vector<string>
5823 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5824 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5827 //value DataArrayChar
5830 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5834 throw INTERP_KERNEL::Exception(msg);
5845 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5851 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5852 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5855 //value vector<string>
5858 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5859 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5862 //value DataArrayChar
5865 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5869 throw INTERP_KERNEL::Exception(msg);
5874 throw INTERP_KERNEL::Exception(msg);
5880 class DataArrayAsciiCharTuple;
5882 class DataArrayAsciiCharIterator
5885 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5886 ~DataArrayAsciiCharIterator();
5891 DataArrayAsciiCharTuple *ret=self->nextt();
5893 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5896 PyErr_SetString(PyExc_StopIteration,"No more data.");
5903 class DataArrayAsciiCharTuple
5906 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5907 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5910 std::string __str__() const throw(INTERP_KERNEL::Exception)
5912 return self->repr();
5915 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5917 return self->buildDAAsciiChar(1,self->getNumberOfCompo());
5924 def MEDCouplingStdReduceFunct(cls,params):
5926 ret=object.__new__(cls)
5931 def MEDCouplingDataArrayDoubleReduce(self):
5932 if not MEDCouplingHasNumPyBindings():
5933 raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5934 return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
5936 def MEDCouplingDataArrayIntReduce(self):
5937 if not MEDCouplingHasNumPyBindings():
5938 raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5939 return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
5941 def MEDCouplingDataArrayByteReduce(self):
5942 if not MEDCouplingHasNumPyBindings():
5943 raise InterpKernelException("PyWrap of DataArrayByte.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5944 return MEDCouplingStdReduceFunct,(DataArrayByte,((self.toNumPyArray(),),(self.__getstate__()),))
5946 def MEDCouplingDataArrayFloatReduce(self):
5947 if not MEDCouplingHasNumPyBindings():
5948 raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5949 return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))