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::sumPerTuple;
97 %newobject MEDCoupling::DataArrayInt::negate;
98 %newobject MEDCoupling::DataArrayInt::computeAbs;
99 %newobject MEDCoupling::DataArrayInt::findIdsInRange;
100 %newobject MEDCoupling::DataArrayInt::findIdsNotInRange;
101 %newobject MEDCoupling::DataArrayInt::findIdsStrictlyNegative;
102 %newobject MEDCoupling::DataArrayInt::Aggregate;
103 %newobject MEDCoupling::DataArrayInt::AggregateIndexes;
104 %newobject MEDCoupling::DataArrayInt::Meld;
105 %newobject MEDCoupling::DataArrayInt::Add;
106 %newobject MEDCoupling::DataArrayInt::Substract;
107 %newobject MEDCoupling::DataArrayInt::Multiply;
108 %newobject MEDCoupling::DataArrayInt::Divide;
109 %newobject MEDCoupling::DataArrayInt::Pow;
110 %newobject MEDCoupling::DataArrayInt::BuildUnion;
111 %newobject MEDCoupling::DataArrayInt::BuildIntersection;
112 %newobject MEDCoupling::DataArrayInt::Range;
113 %newobject MEDCoupling::DataArrayInt::indicesOfSubPart;
114 %newobject MEDCoupling::DataArrayInt::fromNoInterlace;
115 %newobject MEDCoupling::DataArrayInt::toNoInterlace;
116 %newobject MEDCoupling::DataArrayInt::buildComplement;
117 %newobject MEDCoupling::DataArrayInt::buildUnion;
118 %newobject MEDCoupling::DataArrayInt::buildSubstraction;
119 %newobject MEDCoupling::DataArrayInt::buildSubstractionOptimized;
120 %newobject MEDCoupling::DataArrayInt::buildIntersection;
121 %newobject MEDCoupling::DataArrayInt::buildUnique;
122 %newobject MEDCoupling::DataArrayInt::buildUniqueNotSorted;
123 %newobject MEDCoupling::DataArrayInt::deltaShiftIndex;
124 %newobject MEDCoupling::DataArrayInt::buildExplicitArrByRanges;
125 %newobject MEDCoupling::DataArrayInt::buildExplicitArrOfSliceOnScaledArr;
126 %newobject MEDCoupling::DataArrayInt::findRangeIdForEachTuple;
127 %newobject MEDCoupling::DataArrayInt::findIdInRangeForEachTuple;
128 %newobject MEDCoupling::DataArrayInt::duplicateEachTupleNTimes;
129 %newobject MEDCoupling::DataArrayInt::buildPermutationArr;
130 %newobject MEDCoupling::DataArrayInt::buildPermArrPerLevel;
131 %newobject MEDCoupling::DataArrayInt::getDifferentValues;
132 %newobject MEDCoupling::DataArrayInt::FindPermutationFromFirstToSecond;
133 %newobject MEDCoupling::DataArrayInt::CheckAndPreparePermutation;
134 %newobject MEDCoupling::DataArrayInt::__neg__;
135 %newobject MEDCoupling::DataArrayInt::__add__;
136 %newobject MEDCoupling::DataArrayInt::__radd__;
137 %newobject MEDCoupling::DataArrayInt::__sub__;
138 %newobject MEDCoupling::DataArrayInt::__rsub__;
139 %newobject MEDCoupling::DataArrayInt::__mul__;
140 %newobject MEDCoupling::DataArrayInt::__rmul__;
141 %newobject MEDCoupling::DataArrayInt::__div__;
142 %newobject MEDCoupling::DataArrayInt::__rdiv__;
143 %newobject MEDCoupling::DataArrayInt::__mod__;
144 %newobject MEDCoupling::DataArrayInt::__rmod__;
145 %newobject MEDCoupling::DataArrayInt::__pow__;
146 %newobject MEDCoupling::DataArrayInt::__rpow__;
147 %newobject MEDCoupling::DataArrayIntTuple::buildDAInt;
148 %newobject MEDCoupling::DataArrayChar::convertToIntArr;
149 %newobject MEDCoupling::DataArrayChar::renumber;
150 %newobject MEDCoupling::DataArrayChar::renumberR;
151 %newobject MEDCoupling::DataArrayChar::renumberAndReduce;
152 %newobject MEDCoupling::DataArrayChar::changeNbOfComponents;
153 %newobject MEDCoupling::DataArrayChar::findIdsEqual;
154 %newobject MEDCoupling::DataArrayChar::findIdsNotEqual;
155 %newobject MEDCoupling::DataArrayChar::Aggregate;
156 %newobject MEDCoupling::DataArrayChar::Meld;
157 %newobject MEDCoupling::DataArrayByte::New;
158 %newobject MEDCoupling::DataArrayByte::__iter__;
159 %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef;
160 %newobject MEDCoupling::DataArrayByteTuple::buildDAByte;
161 %newobject MEDCoupling::DataArrayChar::subArray;
162 %newobject MEDCoupling::DataArrayAsciiChar::New;
163 %newobject MEDCoupling::DataArrayAsciiChar::__iter__;
164 %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef;
165 %newobject MEDCoupling::DataArrayAsciiCharTuple::buildDAAsciiChar;
166 %newobject MEDCoupling::DataArrayDouble::New;
167 %newobject MEDCoupling::DataArrayDouble::__iter__;
168 %newobject MEDCoupling::DataArrayDouble::performCopyOrIncrRef;
169 %newobject MEDCoupling::DataArrayDouble::Aggregate;
170 %newobject MEDCoupling::DataArrayDouble::Meld;
171 %newobject MEDCoupling::DataArrayDouble::Dot;
172 %newobject MEDCoupling::DataArrayDouble::CrossProduct;
173 %newobject MEDCoupling::DataArrayDouble::Add;
174 %newobject MEDCoupling::DataArrayDouble::Substract;
175 %newobject MEDCoupling::DataArrayDouble::Multiply;
176 %newobject MEDCoupling::DataArrayDouble::Divide;
177 %newobject MEDCoupling::DataArrayDouble::Pow;
178 %newobject MEDCoupling::DataArrayDouble::symmetry3DPlane;
179 %newobject MEDCoupling::DataArrayDouble::subArray;
180 %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents;
181 %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck;
182 %newobject MEDCoupling::DataArrayDouble::findIdsInRange;
183 %newobject MEDCoupling::DataArrayDouble::findIdsNotInRange;
184 %newobject MEDCoupling::DataArrayDouble::findIdsStrictlyNegative;
185 %newobject MEDCoupling::DataArrayDouble::negate;
186 %newobject MEDCoupling::DataArrayDouble::computeAbs;
187 %newobject MEDCoupling::DataArrayDouble::applyFunc;
188 %newobject MEDCoupling::DataArrayDouble::applyFuncCompo;
189 %newobject MEDCoupling::DataArrayDouble::applyFuncNamedCompo;
190 %newobject MEDCoupling::DataArrayDouble::doublyContractedProduct;
191 %newobject MEDCoupling::DataArrayDouble::determinant;
192 %newobject MEDCoupling::DataArrayDouble::eigenValues;
193 %newobject MEDCoupling::DataArrayDouble::eigenVectors;
194 %newobject MEDCoupling::DataArrayDouble::inverse;
195 %newobject MEDCoupling::DataArrayDouble::trace;
196 %newobject MEDCoupling::DataArrayDouble::deviator;
197 %newobject MEDCoupling::DataArrayDouble::magnitude;
198 %newobject MEDCoupling::DataArrayDouble::maxPerTuple;
199 %newobject MEDCoupling::DataArrayDouble::sumPerTuple;
200 %newobject MEDCoupling::DataArrayDouble::computeBBoxPerTuple;
201 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrix;
202 %newobject MEDCoupling::DataArrayDouble::buildEuclidianDistanceDenseMatrixWith;
203 %newobject MEDCoupling::DataArrayDouble::renumber;
204 %newobject MEDCoupling::DataArrayDouble::renumberR;
205 %newobject MEDCoupling::DataArrayDouble::renumberAndReduce;
206 %newobject MEDCoupling::DataArrayDouble::fromNoInterlace;
207 %newobject MEDCoupling::DataArrayDouble::toNoInterlace;
208 %newobject MEDCoupling::DataArrayDouble::fromPolarToCart;
209 %newobject MEDCoupling::DataArrayDouble::fromCylToCart;
210 %newobject MEDCoupling::DataArrayDouble::fromSpherToCart;
211 %newobject MEDCoupling::DataArrayDouble::fromCartToPolar;
212 %newobject MEDCoupling::DataArrayDouble::fromCartToCyl;
213 %newobject MEDCoupling::DataArrayDouble::fromCartToSpher;
214 %newobject MEDCoupling::DataArrayDouble::fromCartToCylGiven;
215 %newobject MEDCoupling::DataArrayDouble::cartesianize;
216 %newobject MEDCoupling::DataArrayDouble::getDifferentValues;
217 %newobject MEDCoupling::DataArrayDouble::findClosestTupleId;
218 %newobject MEDCoupling::DataArrayDouble::computeNbOfInteractionsWith;
219 %newobject MEDCoupling::DataArrayDouble::duplicateEachTupleNTimes;
220 %newobject MEDCoupling::DataArrayDouble::__neg__;
221 %newobject MEDCoupling::DataArrayDouble::__radd__;
222 %newobject MEDCoupling::DataArrayDouble::__rsub__;
223 %newobject MEDCoupling::DataArrayDouble::__rmul__;
224 %newobject MEDCoupling::DataArrayDouble::__rdiv__;
225 %newobject MEDCoupling::DataArrayDouble::__pow__;
226 %newobject MEDCoupling::DataArrayDouble::__rpow__;
227 %newobject MEDCoupling::DataArrayDoubleTuple::buildDADouble;
229 %newobject MEDCoupling::PartDefinition::New;
230 %newobject MEDCoupling::PartDefinition::toDAI;
231 %newobject MEDCoupling::PartDefinition::__add__;
232 %newobject MEDCoupling::PartDefinition::composeWith;
233 %newobject MEDCoupling::PartDefinition::tryToSimplify;
234 %newobject MEDCoupling::DataArrayPartDefinition::New;
235 %newobject MEDCoupling::SlicePartDefinition::New;
238 %feature("unref") DataArray "$this->decrRef();"
239 %feature("unref") DataArrayDouble "$this->decrRef();"
240 %feature("unref") DataArrayInt "$this->decrRef();"
241 %feature("unref") DataArrayChar "$this->decrRef();"
242 %feature("unref") DataArrayAsciiChar "$this->decrRef();"
243 %feature("unref") DataArrayByte "$this->decrRef();"
245 %feature("unref") MapII "$this->decrRef();"
246 %feature("unref") PartDefinition "$this->decrRef();"
247 %feature("unref") DataArrayPartDefinition "$this->decrRef();"
248 %feature("unref") SlicePartDefinition "$this->decrRef();"
250 namespace MEDCoupling
257 } MEDCouplingAxisType;
261 class MapII : public RefCountObject, public TimeLabel
264 static MCAuto< MapII > New();
267 class PartDefinition : public RefCountObject, public TimeLabel
270 static PartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
271 static PartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
272 virtual DataArrayInt *toDAI() const throw(INTERP_KERNEL::Exception);
273 virtual int getNumberOfElems() const throw(INTERP_KERNEL::Exception);
274 virtual std::string getRepr() const throw(INTERP_KERNEL::Exception);
275 virtual PartDefinition *composeWith(const PartDefinition *other) const throw(INTERP_KERNEL::Exception);
276 virtual void checkConsistencyLight() const throw(INTERP_KERNEL::Exception);
277 virtual PartDefinition *tryToSimplify() const throw(INTERP_KERNEL::Exception);
280 virtual PartDefinition *__add__(const PartDefinition& other) const throw(INTERP_KERNEL::Exception)
282 return (*self)+other;
285 virtual PyObject *isEqual(const PartDefinition *other) const throw(INTERP_KERNEL::Exception)
288 bool ret0(self->isEqual(other,ret1));
289 PyObject *ret=PyTuple_New(2);
290 PyObject *ret0Py=ret0?Py_True:Py_False;
292 PyTuple_SetItem(ret,0,ret0Py);
293 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
297 virtual PyObject *deepCopy() const throw(INTERP_KERNEL::Exception)
299 return convertPartDefinition(self->deepCopy(),SWIG_POINTER_OWN | 0);
303 virtual ~PartDefinition();
306 class DataArrayPartDefinition : public PartDefinition
309 static DataArrayPartDefinition *New(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception);
312 DataArrayPartDefinition(DataArrayInt *listOfIds) throw(INTERP_KERNEL::Exception)
314 return DataArrayPartDefinition::New(listOfIds);
317 std::string __str__() const throw(INTERP_KERNEL::Exception)
319 return self->getRepr();
322 std::string __repr__() const throw(INTERP_KERNEL::Exception)
324 std::ostringstream oss; oss << "DataArrayPartDefinition C++ instance at " << self << "." << std::endl;
325 oss << self->getRepr();
330 virtual ~DataArrayPartDefinition();
333 class SlicePartDefinition : public PartDefinition
336 static SlicePartDefinition *New(int start, int stop, int step) throw(INTERP_KERNEL::Exception);
337 int getEffectiveStop() const throw(INTERP_KERNEL::Exception);
340 SlicePartDefinition(int start, int stop, int step) throw(INTERP_KERNEL::Exception)
342 return SlicePartDefinition::New(start,stop,step);
345 PyObject *getSlice() const throw(INTERP_KERNEL::Exception)
348 self->getSlice(a,b,c);
349 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
352 std::string __str__() const throw(INTERP_KERNEL::Exception)
354 return self->getRepr();
357 std::string __repr__() const throw(INTERP_KERNEL::Exception)
359 std::ostringstream oss; oss << "SlicePartDefinition C++ instance at " << self << "." << std::endl;
360 oss << self->getRepr();
365 virtual ~SlicePartDefinition();
368 class DataArray : public RefCountObject, public TimeLabel
371 void setName(const std::string& name);
372 void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
373 void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
374 void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
375 bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
376 bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
377 std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
378 std::string getName() const;
379 void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
380 void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
381 std::vector<std::string> getVarsOnComponent() const throw(INTERP_KERNEL::Exception);
382 std::vector<std::string> getUnitsOnComponent() const throw(INTERP_KERNEL::Exception);
383 std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
384 std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
385 std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
386 void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
387 int getNumberOfComponents() const;
388 virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
389 virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
390 virtual bool isAllocated() const throw(INTERP_KERNEL::Exception);
391 virtual void checkAllocated() const throw(INTERP_KERNEL::Exception);
392 virtual void desallocate() throw(INTERP_KERNEL::Exception);
393 virtual int getNumberOfTuples() const throw(INTERP_KERNEL::Exception);
394 virtual std::size_t getNbOfElems() const throw(INTERP_KERNEL::Exception);
395 virtual std::size_t getNbOfElemAllocated() const throw(INTERP_KERNEL::Exception);
396 virtual DataArray *deepCopy() const throw(INTERP_KERNEL::Exception);
397 virtual DataArray *buildNewEmptyInstance() const throw(INTERP_KERNEL::Exception);
398 virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
399 virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
400 virtual void circularPermutation(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
401 virtual void circularPermutationPerTuple(int nbOfShift=1) throw(INTERP_KERNEL::Exception);
402 virtual void reversePerTuple() throw(INTERP_KERNEL::Exception);
403 void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
404 void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
405 void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
406 void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
407 void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
408 static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
409 static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
410 static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
411 static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
412 static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
413 static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit) throw(INTERP_KERNEL::Exception);
414 static std::string GetAxisTypeRepr(MEDCouplingAxisType at) throw(INTERP_KERNEL::Exception);
415 void updateTime() const;
418 PyObject *getInfoOnComponents() const throw(INTERP_KERNEL::Exception)
420 const std::vector<std::string>& comps=self->getInfoOnComponents();
421 PyObject *ret=PyList_New((int)comps.size());
422 for(int i=0;i<(int)comps.size();i++)
423 PyList_SetItem(ret,i,PyString_FromString(comps[i].c_str()));
427 void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
429 std::vector<int> tmp;
430 convertPyToNewIntArr3(li,tmp);
431 self->copyPartOfStringInfoFrom(other,tmp);
434 void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
436 std::vector<int> tmp;
437 convertPyToNewIntArr3(li,tmp);
438 self->copyPartOfStringInfoFrom2(tmp,other);
441 virtual void renumberInPlace(PyObject *li) throw(INTERP_KERNEL::Exception)
444 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
445 if (!SWIG_IsOK(res1))
448 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
449 if(size!=self->getNumberOfTuples())
451 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
453 self->renumberInPlace(tmp);
457 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
459 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
460 da2->checkAllocated();
461 int size=self->getNumberOfTuples();
462 if(size!=self->getNumberOfTuples())
464 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
466 self->renumberInPlace(da2->getConstPointer());
470 virtual void renumberInPlaceR(PyObject *li) throw(INTERP_KERNEL::Exception)
473 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
474 if (!SWIG_IsOK(res1))
477 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
478 if(size!=self->getNumberOfTuples())
480 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
482 self->renumberInPlaceR(tmp);
486 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
488 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
489 da2->checkAllocated();
490 int size=self->getNumberOfTuples();
491 if(size!=self->getNumberOfTuples())
493 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
495 self->renumberInPlaceR(da2->getConstPointer());
499 //tuplesSelec in PyObject * because DataArrayInt is not already existing !
500 virtual void setContigPartOfSelectedValues(int tupleIdStart, PyObject *aBase, PyObject *tuplesSelec) throw(INTERP_KERNEL::Exception)
502 static const char msg[]="DataArray::setContigPartOfSelectedValuesSlice : 4th parameter \"tuplesSelec\" should be of type DataArrayInt";
503 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 3rd parameter \"aBase\" should be of type DataArray");
504 DataArray *tuplesSelecPtr=CheckAndRetrieveDataArrayInstance(tuplesSelec,msg);
505 DataArrayInt *tuplesSelecPtr2=0;
508 tuplesSelecPtr2=dynamic_cast<DataArrayInt *>(tuplesSelecPtr);
510 throw INTERP_KERNEL::Exception(msg);
512 self->setContigPartOfSelectedValues(tupleIdStart,a,tuplesSelecPtr2);
515 virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, PyObject *aBase, int bg, int end2, int step) throw(INTERP_KERNEL::Exception)
517 DataArray *a=CheckAndRetrieveDataArrayInstance(aBase,"DataArray::setContigPartOfSelectedValuesSlice : 2nd parameter \"aBase\" should be of type DataArray");
518 self->setContigPartOfSelectedValuesSlice(tupleIdStart,a,bg,end2,step);
521 virtual DataArray *selectByTupleRanges(PyObject *li) const throw(INTERP_KERNEL::Exception)
523 std::vector<std::pair<int,int> > ranges;
524 convertPyToVectorPairInt(li,ranges);
525 return self->selectByTupleRanges(ranges);
528 virtual DataArray *selectByTupleId(PyObject *li) const throw(INTERP_KERNEL::Exception)
531 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
532 if (!SWIG_IsOK(res1))
535 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
536 return self->selectByTupleId(tmp,tmp+size);
540 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
542 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
543 da2->checkAllocated();
544 return self->selectByTupleId(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
548 virtual DataArray *selectByTupleIdSafe(PyObject *li) const throw(INTERP_KERNEL::Exception)
551 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
552 if (!SWIG_IsOK(res1))
555 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
556 return self->selectByTupleIdSafe(tmp,tmp+size);
560 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
562 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
563 da2->checkAllocated();
564 return self->selectByTupleIdSafe(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
568 virtual PyObject *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
570 std::vector<int> tmp;
571 convertPyToNewIntArr3(li,tmp);
572 DataArray *ret=self->keepSelectedComponents(tmp);
573 return convertDataArray(ret,SWIG_POINTER_OWN | 0 );
576 static PyObject *GetSlice(PyObject *slic, int sliceId, int nbOfSlices) throw(INTERP_KERNEL::Exception)
578 if(!PySlice_Check(slic))
579 throw INTERP_KERNEL::Exception("DataArray::GetSlice (wrap) : expecting a pyslice as second (first) parameter !");
580 Py_ssize_t strt=2,stp=2,step=2;
581 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetSlice (wrap) : the input slice is invalid !");
583 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
584 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
587 PyObject *getSlice(PyObject *slic, int sliceId, int nbOfSlices) const throw(INTERP_KERNEL::Exception)
589 if(!PySlice_Check(slic))
590 throw INTERP_KERNEL::Exception("DataArray::getSlice (wrap) : expecting a pyslice as second (first) parameter !");
591 Py_ssize_t strt=2,stp=2,step=2;
592 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getSlice (wrap) : the input slice is invalid !");
594 DataArray::GetSlice(strt,stp,step,sliceId,nbOfSlices,a,b);
595 return PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(step));
598 static int GetNumberOfItemGivenBES(PyObject *slic) throw(INTERP_KERNEL::Exception)
600 if(!PySlice_Check(slic))
601 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
602 Py_ssize_t strt=2,stp=2,step=2;
603 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBES (wrap) : the input slice is invalid !");
604 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
607 static int GetNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
609 if(!PySlice_Check(slic))
610 throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
611 Py_ssize_t strt=2,stp=2,step=2;
612 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArray::GetNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
613 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
616 static DataArray *Aggregate(PyObject *arrs) throw(INTERP_KERNEL::Exception)
618 std::vector<const DataArray *> tmp;
619 convertFromPyObjVectorOfObj<const MEDCoupling::DataArray *>(arrs,SWIGTYPE_p_MEDCoupling__DataArray,"DataArray",tmp);
620 return DataArray::Aggregate(tmp);
623 int getNumberOfItemGivenBES(PyObject *slic) const throw(INTERP_KERNEL::Exception)
625 if(!PySlice_Check(slic))
626 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBES (wrap) : expecting a pyslice as second (first) parameter !");
627 Py_ssize_t strt=2,stp=2,step=2;
628 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBES (wrap) : the input slice is invalid !");
629 return DataArray::GetNumberOfItemGivenBES(strt,stp,step,"");
632 int getNumberOfItemGivenBESRelative(PyObject *slic) throw(INTERP_KERNEL::Exception)
634 if(!PySlice_Check(slic))
635 throw INTERP_KERNEL::Exception("DataArray::getNumberOfItemGivenBESRelative (wrap) : expecting a pyslice as second (first) parameter !");
636 Py_ssize_t strt=2,stp=2,step=2;
637 GetIndicesOfSlice(slic,self->getNumberOfTuples(),&strt,&stp,&step,"DataArray::getNumberOfItemGivenBESRelative (wrap) : the input slice is invalid !");
638 return DataArray::GetNumberOfItemGivenBESRelative(strt,stp,step,"");
641 PyObject *__getstate__() const throw(INTERP_KERNEL::Exception)
643 PyObject *ret(PyTuple_New(2));
644 std::string a0(self->getName());
645 const std::vector<std::string> &a1(self->getInfoOnComponents());
646 PyTuple_SetItem(ret,0,PyString_FromString(a0.c_str()));
649 PyObject *ret1(PyList_New(sz));
650 for(int i=0;i<sz;i++)
651 PyList_SetItem(ret1,i,PyString_FromString(a1[i].c_str()));
652 PyTuple_SetItem(ret,1,ret1);
657 void __setstate__(PyObject *inp) throw(INTERP_KERNEL::Exception)
659 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 !";
660 if(!PyTuple_Check(inp))
661 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid input ! Invalid overwrite of __getstate__ ?");
662 int sz(PyTuple_Size(inp));
664 throw INTERP_KERNEL::Exception("DataArrayDouble.__setstate__ : invalid tuple in input ! Should be of size 2 ! Invalid overwrite of __getstate__ ?");
665 PyObject *a0(PyTuple_GetItem(inp,0));
666 self->setName(convertPyObjectToStr(a0,MSG));
667 PyObject *a1(PyTuple_GetItem(inp,1));
668 std::vector<std::string> a1cpp;
669 if(!fillStringVector(a1,a1cpp))
670 throw INTERP_KERNEL::Exception(MSG);
671 self->setInfoOnComponents(a1cpp);
676 class DataArrayDouble;
678 class DataArrayFloat : public DataArray
681 static DataArrayFloat *New();
682 void fillWithValue(float val) throw(INTERP_KERNEL::Exception);
683 bool isEqual(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
684 bool isEqualWithoutConsideringStr(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception);
685 bool isUniform(float val, float eps) const throw(INTERP_KERNEL::Exception);
686 void pushBackSilent(float val) throw(INTERP_KERNEL::Exception);
687 void iota(float init=0.) throw(INTERP_KERNEL::Exception);
688 DataArrayFloatIterator *iterator() throw(INTERP_KERNEL::Exception);
689 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
690 static DataArrayFloat *Meld(const DataArrayFloat *a1, const DataArrayFloat *a2) throw(INTERP_KERNEL::Exception);
693 DataArrayFloat() throw(INTERP_KERNEL::Exception)
695 return DataArrayFloat::New();
698 static DataArrayFloat *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
700 return DataArrayT_New<float>(elt0,nbOfTuples,elt2);
703 DataArrayFloat(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
705 return MEDCoupling_DataArrayFloat_New__SWIG_1(elt0,nbOfTuples,elt2);
708 DataArrayFloatIterator *__iter__() throw(INTERP_KERNEL::Exception)
710 return self->iterator();
713 std::string __repr__() const throw(INTERP_KERNEL::Exception)
715 std::ostringstream oss;
716 self->reprQuickOverview(oss);
720 std::string __str__() const throw(INTERP_KERNEL::Exception)
722 return self->reprNotTooLong();
725 int __len__() const throw(INTERP_KERNEL::Exception)
727 if(self->isAllocated())
729 return self->getNumberOfTuples();
733 throw INTERP_KERNEL::Exception("DataArrayFloat::__len__ : Instance is NOT allocated !");
737 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
739 const float *vals(self->begin());
740 return convertDblArrToPyList<float>(vals,self->getNbOfElems());
743 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
745 const float *vals(self->begin());
746 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
747 return convertDblArrToPyListOfTuple<float>(vals,nbOfComp,nbOfTuples);
750 PyObject *isEqualIfNotWhy(const DataArrayFloat& other, float prec) const throw(INTERP_KERNEL::Exception)
753 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
754 PyObject *ret=PyTuple_New(2);
755 PyObject *ret0Py=ret0?Py_True:Py_False;
757 PyTuple_SetItem(ret,0,ret0Py);
758 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
762 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
764 return DataArrayT__getitem<float>(self,obj);
767 DataArrayFloat *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
769 return DataArrayT__setitem__<float>(self,obj,value);
772 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
774 return DataArrayT_iadd<float>(trueSelf,obj,self);
777 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
779 return DataArrayT_isub<float>(trueSelf,obj,self);
782 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
784 return DataArrayT_imul<float>(trueSelf,obj,self);
787 DataArrayFloat *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
789 return DataArrayFPT_rmul<float>(self,obj);
792 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
794 return DataArrayT_idiv<float>(trueSelf,obj,self);
798 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
800 return ToNumPyArray<DataArrayFloat,float>(self,NPY_FLOAT,"DataArrayFloat");
806 class DataArrayFloatTuple;
808 class DataArrayFloatIterator
811 DataArrayFloatIterator(DataArrayFloat *da);
812 ~DataArrayFloatIterator();
817 DataArrayFloatTuple *ret=self->nextt();
819 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
822 PyErr_SetString(PyExc_StopIteration,"No more data.");
829 class DataArrayFloatTuple
832 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
833 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
836 std::string __str__() const throw(INTERP_KERNEL::Exception)
841 float __float__() const throw(INTERP_KERNEL::Exception)
843 return self->floatValue();
846 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
848 return self->buildDAFloat(1,self->getNumberOfCompo());
851 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
853 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
854 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
855 Py_XINCREF(trueSelf);
859 PyObject *__len__() throw(INTERP_KERNEL::Exception)
861 return PyInt_FromLong(self->getNumberOfCompo());
867 class DataArrayDoubleIterator;
869 class DataArrayDouble : public DataArray
872 static DataArrayDouble *New();
873 double doubleValue() const throw(INTERP_KERNEL::Exception);
874 bool empty() const throw(INTERP_KERNEL::Exception);
875 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
876 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
877 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
878 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
879 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
880 double popBackSilent() throw(INTERP_KERNEL::Exception);
881 void pack() const throw(INTERP_KERNEL::Exception);
882 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
883 void fillWithZero() throw(INTERP_KERNEL::Exception);
884 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
885 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
886 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
887 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
888 void reverse() throw(INTERP_KERNEL::Exception);
889 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
890 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
891 std::string repr() const throw(INTERP_KERNEL::Exception);
892 std::string reprZip() const throw(INTERP_KERNEL::Exception);
893 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
894 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
895 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
896 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
897 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
898 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
899 void transpose() throw(INTERP_KERNEL::Exception);
900 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
901 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
902 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
903 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
904 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
905 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
906 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
907 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
908 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
909 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
910 double front() const throw(INTERP_KERNEL::Exception);
911 double back() const throw(INTERP_KERNEL::Exception);
912 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
913 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
914 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
915 double *getPointer() throw(INTERP_KERNEL::Exception);
916 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
917 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
918 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
919 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
920 double getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
921 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
922 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
923 double getAverageValue() const throw(INTERP_KERNEL::Exception);
924 double norm2() const throw(INTERP_KERNEL::Exception);
925 double normMax() const throw(INTERP_KERNEL::Exception);
926 double normMin() const throw(INTERP_KERNEL::Exception);
927 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
928 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
929 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
930 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
931 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
947 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
948 void abs() throw(INTERP_KERNEL::Exception);
949 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
950 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
951 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
952 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
953 void applyPow(double val) throw(INTERP_KERNEL::Exception);
954 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
955 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
956 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
959 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
960 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
962 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
963 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
964 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
965 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
966 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
967 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
968 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
969 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
970 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
971 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
972 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
973 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
974 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
975 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
976 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
977 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
978 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
979 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
980 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
981 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
982 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
983 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
984 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
985 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
986 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
987 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
988 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
989 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
990 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
993 DataArrayDouble() throw(INTERP_KERNEL::Exception)
995 return DataArrayDouble::New();
998 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1000 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1003 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1005 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1008 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1011 std::vector<double> bb;
1013 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1014 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1015 self->pushBackValsSilent(tmp,tmp+nbTuples);
1018 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1020 std::ostringstream oss;
1021 self->reprQuickOverview(oss);
1025 std::string __str__() const throw(INTERP_KERNEL::Exception)
1027 return self->reprNotTooLong();
1030 double __float__() const throw(INTERP_KERNEL::Exception)
1032 return self->doubleValue();
1035 int __len__() const throw(INTERP_KERNEL::Exception)
1037 if(self->isAllocated())
1039 return self->getNumberOfTuples();
1043 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1047 PyObject *asArcOfCircle() const throw(INTERP_KERNEL::Exception)
1049 double center[2],radius,ang;
1050 self->asArcOfCircle(center,radius,ang);
1051 PyObject *ret(PyTuple_New(3));
1053 PyObject *ret0(PyList_New(2));
1054 PyList_SetItem(ret0,0,PyFloat_FromDouble(center[0]));
1055 PyList_SetItem(ret0,1,PyFloat_FromDouble(center[1]));
1056 PyTuple_SetItem(ret,0,ret0);
1058 PyTuple_SetItem(ret,1,PyFloat_FromDouble(radius));
1059 PyTuple_SetItem(ret,2,PyFloat_FromDouble(ang));
1063 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1065 return self->iterator();
1068 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1070 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 !";
1071 if(PyList_Check(li) || PyTuple_Check(li))
1075 if(PyInt_Check(nbOfTuples))
1077 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1079 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1082 if(PyInt_Check(nbOfComp))
1083 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1084 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1086 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1087 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1088 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1091 throw INTERP_KERNEL::Exception(msg);
1094 {//DataArrayDouble.setValues([1.,3.,4.],3)
1096 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1097 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1101 throw INTERP_KERNEL::Exception(msg);
1104 {// DataArrayDouble.setValues([1.,3.,4.])
1105 int tmpp1=-1,tmpp2=-1;
1106 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1107 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1111 throw INTERP_KERNEL::Exception(msg);
1114 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1116 const double *vals(self->begin());
1117 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1121 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1123 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1127 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1130 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1131 PyObject *ret=PyTuple_New(2);
1132 PyObject *ret0Py=ret0?Py_True:Py_False;
1134 PyTuple_SetItem(ret,0,ret0Py);
1135 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1139 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1141 const double *vals(self->begin());
1142 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1143 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1146 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1148 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1150 DataArrayDouble *a,*a2;
1151 DataArrayDoubleTuple *aa,*aa2;
1152 std::vector<double> bb,bb2;
1154 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1155 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1156 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1160 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1162 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1164 DataArrayDouble *a,*a2;
1165 DataArrayDoubleTuple *aa,*aa2;
1166 std::vector<double> bb,bb2;
1168 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1170 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1171 return convertDblArrToPyListOfTuple<double>(res,3,3);
1174 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1176 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1178 DataArrayDouble *a,*a2;
1179 DataArrayDoubleTuple *aa,*aa2;
1180 std::vector<double> bb,bb2;
1182 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1183 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1184 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1187 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1190 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1191 if (!SWIG_IsOK(res1))
1194 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1195 if(size!=self->getNumberOfTuples())
1197 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1199 return self->renumber(tmp);
1203 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1205 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1206 da2->checkAllocated();
1207 int size=self->getNumberOfTuples();
1208 if(size!=self->getNumberOfTuples())
1210 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1212 return self->renumber(da2->getConstPointer());
1216 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1219 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1220 if (!SWIG_IsOK(res1))
1223 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1224 if(size!=self->getNumberOfTuples())
1226 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1228 return self->renumberR(tmp);
1232 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1234 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1235 da2->checkAllocated();
1236 int size=self->getNumberOfTuples();
1237 if(size!=self->getNumberOfTuples())
1239 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1241 return self->renumberR(da2->getConstPointer());
1245 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1248 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1249 if (!SWIG_IsOK(res1))
1252 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1253 if(size!=self->getNumberOfTuples())
1255 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1257 return self->renumberAndReduce(tmp,newNbOfTuple);
1261 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1263 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1264 da2->checkAllocated();
1265 int size=self->getNumberOfTuples();
1266 if(size!=self->getNumberOfTuples())
1268 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1270 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1274 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1276 int thisTupleId,otherTupleId;
1277 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1278 PyObject *ret=PyTuple_New(3);
1279 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1280 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1281 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1285 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1288 double r1=self->getMaxValue(tmp);
1289 PyObject *ret=PyTuple_New(2);
1290 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1291 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1295 PyObject *getMaxAbsValue() const throw(INTERP_KERNEL::Exception)
1298 double r1=self->getMaxAbsValue(tmp);
1299 PyObject *ret=PyTuple_New(2);
1300 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1301 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1305 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1308 double r1=self->getMaxValue2(tmp);
1309 PyObject *ret=PyTuple_New(2);
1310 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1311 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1315 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1318 double r1=self->getMinValue(tmp);
1319 PyObject *ret=PyTuple_New(2);
1320 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1321 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1325 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1328 double r1=self->getMinValue2(tmp);
1329 PyObject *ret=PyTuple_New(2);
1330 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1331 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1335 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1337 int nbOfCompo(self->getNumberOfComponents());
1338 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1339 self->getMinMaxPerComponent(tmp);
1340 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1344 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1346 int sz=self->getNumberOfComponents();
1347 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1348 self->accumulate(tmp);
1349 return convertDblArrToPyList<double>(tmp,sz);
1352 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1355 std::vector<int> val2;
1356 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1357 return self->accumulatePerChunck(bg,bg+sz);
1360 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1362 DataArrayInt *comm, *commIndex;
1363 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1364 PyObject *res = PyList_New(2);
1365 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1366 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1370 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1374 DataArrayDoubleTuple *aa;
1375 std::vector<double> bb;
1377 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1378 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1380 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1381 PyObject *ret=PyTuple_New(2);
1382 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1383 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1387 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1389 std::vector<int> tmp;
1390 convertPyToNewIntArr3(li,tmp);
1391 self->setSelectedComponents(a,tmp);
1394 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1396 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1397 std::size_t sz(retCpp.size());
1398 PyObject *res(PyList_New(sz));
1399 for(std::size_t i=0;i<sz;i++)
1400 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1404 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1406 int sz=self->getNumberOfComponents();
1407 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1408 self->getTuple(tupleId,tmp);
1409 return convertDblArrToPyList<double>(tmp,sz);
1412 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1414 std::vector<const DataArrayDouble *> tmp;
1415 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1416 return DataArrayDouble::Aggregate(tmp);
1419 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1421 std::vector<const DataArrayDouble *> tmp;
1422 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1423 return DataArrayDouble::Meld(tmp);
1426 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1430 DataArrayDoubleTuple *aa;
1431 std::vector<double> bb;
1433 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1434 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1435 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1436 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1437 DataArrayInt *c=0,*cI=0;
1438 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1439 PyObject *ret=PyTuple_New(2);
1440 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1441 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1445 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1447 DataArrayInt *ret1=0;
1448 bool ret0=self->areIncludedInMe(other,prec,ret1);
1449 PyObject *ret=PyTuple_New(2);
1450 PyObject *ret0Py=ret0?Py_True:Py_False;
1452 PyTuple_SetItem(ret,0,ret0Py);
1453 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1457 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1459 return DataArrayT__getitem<double>(self,obj);
1462 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1464 return DataArrayT__setitem__<double>(self,obj,value);
1467 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1469 return self->negate();
1472 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1474 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1477 DataArrayDoubleTuple *aa;
1478 std::vector<double> bb;
1481 #ifndef WITHOUT_AUTOFIELD
1483 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1485 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1488 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1489 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1491 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1494 throw INTERP_KERNEL::Exception(msg);
1498 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1503 MCAuto<DataArrayDouble> ret=self->deepCopy();
1504 ret->applyLin(1.,val);
1505 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1509 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1513 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1514 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1518 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1519 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1522 throw INTERP_KERNEL::Exception(msg);
1526 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1528 const char msg[]="Unexpected situation in __radd__ !";
1531 DataArrayDoubleTuple *aa;
1532 std::vector<double> bb;
1534 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1539 MCAuto<DataArrayDouble> ret=self->deepCopy();
1540 ret->applyLin(1.,val);
1545 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1546 return DataArrayDouble::Add(self,aaa);
1550 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1551 return DataArrayDouble::Add(self,aaa);
1554 throw INTERP_KERNEL::Exception(msg);
1558 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1560 return DataArrayT_iadd<double>(trueSelf,obj,self);
1563 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1565 const char msg[]="Unexpected situation in __sub__ !";
1568 DataArrayDoubleTuple *aa;
1569 std::vector<double> bb;
1572 #ifndef WITHOUT_AUTOFIELD
1574 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1576 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1579 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1580 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1582 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1585 throw INTERP_KERNEL::Exception(msg);
1589 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1594 MCAuto<DataArrayDouble> ret=self->deepCopy();
1595 ret->applyLin(1.,-val);
1596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1600 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1604 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1605 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1609 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1610 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1613 throw INTERP_KERNEL::Exception(msg);
1617 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1619 const char msg[]="Unexpected situation in __rsub__ !";
1622 DataArrayDoubleTuple *aa;
1623 std::vector<double> bb;
1625 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1630 MCAuto<DataArrayDouble> ret=self->deepCopy();
1631 ret->applyLin(-1.,val);
1636 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1637 return DataArrayDouble::Substract(aaa,self);
1641 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1642 return DataArrayDouble::Substract(aaa,self);
1645 throw INTERP_KERNEL::Exception(msg);
1649 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1651 return DataArrayT_isub<double>(trueSelf,obj,self);
1654 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1656 const char msg[]="Unexpected situation in __mul__ !";
1659 DataArrayDoubleTuple *aa;
1660 std::vector<double> bb;
1663 #ifndef WITHOUT_AUTOFIELD
1665 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1667 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1670 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1671 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1673 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1676 throw INTERP_KERNEL::Exception(msg);
1680 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1685 MCAuto<DataArrayDouble> ret=self->deepCopy();
1686 ret->applyLin(val,0.);
1687 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1691 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1695 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1696 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1700 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1701 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1704 throw INTERP_KERNEL::Exception(msg);
1708 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1710 return DataArrayFPT_rmul<double>(self,obj);
1713 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1715 return DataArrayT_imul<double>(trueSelf,obj,self);
1718 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1720 const char msg[]="Unexpected situation in __div__ !";
1723 DataArrayDoubleTuple *aa;
1724 std::vector<double> bb;
1727 #ifndef WITHOUT_AUTOFIELD
1729 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1731 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1734 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1735 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1737 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1740 throw INTERP_KERNEL::Exception(msg);
1744 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1750 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1751 MCAuto<DataArrayDouble> ret=self->deepCopy();
1752 ret->applyLin(1/val,0.);
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1757 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1761 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1762 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1766 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1767 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1770 throw INTERP_KERNEL::Exception(msg);
1774 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1776 const char msg[]="Unexpected situation in __rdiv__ !";
1779 DataArrayDoubleTuple *aa;
1780 std::vector<double> bb;
1782 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1787 MCAuto<DataArrayDouble> ret=self->deepCopy();
1793 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1794 return DataArrayDouble::Divide(aaa,self);
1798 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1799 return DataArrayDouble::Divide(aaa,self);
1802 throw INTERP_KERNEL::Exception(msg);
1806 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1808 return DataArrayT_idiv<double>(trueSelf,obj,self);
1811 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1813 const char msg[]="Unexpected situation in __pow__ !";
1816 DataArrayDoubleTuple *aa;
1817 std::vector<double> bb;
1819 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1824 MCAuto<DataArrayDouble> ret=self->deepCopy();
1830 return DataArrayDouble::Pow(self,a);
1834 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1835 return DataArrayDouble::Pow(self,aaa);
1839 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1840 return DataArrayDouble::Pow(self,aaa);
1843 throw INTERP_KERNEL::Exception(msg);
1847 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1849 const char msg[]="Unexpected situation in __rpow__ !";
1852 DataArrayDoubleTuple *aa;
1853 std::vector<double> bb;
1855 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1860 MCAuto<DataArrayDouble> ret=self->deepCopy();
1861 ret->applyRPow(val);
1866 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1867 return DataArrayDouble::Pow(aaa,self);
1871 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1872 return DataArrayDouble::Pow(aaa,self);
1875 throw INTERP_KERNEL::Exception(msg);
1879 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1881 const char msg[]="Unexpected situation in __ipow__ !";
1884 DataArrayDoubleTuple *aa;
1885 std::vector<double> bb;
1887 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1892 self->applyPow(val);
1893 Py_XINCREF(trueSelf);
1899 Py_XINCREF(trueSelf);
1904 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1905 self->powEqual(aaa);
1906 Py_XINCREF(trueSelf);
1911 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1912 self->powEqual(aaa);
1913 Py_XINCREF(trueSelf);
1917 throw INTERP_KERNEL::Exception(msg);
1921 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1923 DataArrayInt *c=0,*cI=0;
1925 self->computeTupleIdsNearTuples(other,eps,c,cI);
1926 PyObject *ret=PyTuple_New(2);
1927 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1928 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1932 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1934 DataArrayInt *ret1=0;
1935 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1936 PyObject *ret=PyTuple_New(2);
1937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1938 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1944 class DataArrayDoubleTuple;
1946 class DataArrayDoubleIterator
1949 DataArrayDoubleIterator(DataArrayDouble *da);
1950 ~DataArrayDoubleIterator();
1955 DataArrayDoubleTuple *ret=self->nextt();
1957 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1960 PyErr_SetString(PyExc_StopIteration,"No more data.");
1967 class DataArrayDoubleTuple
1970 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1971 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1974 std::string __str__() const throw(INTERP_KERNEL::Exception)
1976 return self->repr();
1979 double __float__() const throw(INTERP_KERNEL::Exception)
1981 return self->doubleValue();
1984 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
1986 return self->buildDADouble(1,self->getNumberOfCompo());
1989 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1991 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1992 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
1993 Py_XINCREF(trueSelf);
1997 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1999 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2000 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2001 Py_XINCREF(trueSelf);
2005 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2007 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2008 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2009 Py_XINCREF(trueSelf);
2013 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2015 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2016 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2017 Py_XINCREF(trueSelf);
2021 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2023 return PyInt_FromLong(self->getNumberOfCompo());
2026 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2028 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2031 std::vector<int> multiVal;
2032 std::pair<int, std::pair<int,int> > slic;
2033 MEDCoupling::DataArrayInt *daIntTyypp=0;
2034 const double *pt=self->getConstPointer();
2035 int nbc=self->getNumberOfCompo();
2036 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2043 std::ostringstream oss;
2044 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2045 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2049 return PyFloat_FromDouble(pt[singleVal]);
2053 return PyFloat_FromDouble(pt[nbc+singleVal]);
2056 std::ostringstream oss;
2057 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2058 throw INTERP_KERNEL::Exception(oss.str().c_str());
2064 PyObject *t=PyTuple_New(multiVal.size());
2065 for(int j=0;j<(int)multiVal.size();j++)
2067 int cid=multiVal[j];
2070 std::ostringstream oss;
2071 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2072 throw INTERP_KERNEL::Exception(oss.str().c_str());
2074 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2080 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2081 PyObject *t=PyTuple_New(sz);
2082 for(int j=0;j<sz;j++)
2083 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2087 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2091 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2093 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2094 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2097 std::vector<double> multiValV;
2098 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2099 int nbc=self->getNumberOfCompo();
2100 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2102 std::vector<int> multiVal;
2103 std::pair<int, std::pair<int,int> > slic;
2104 MEDCoupling::DataArrayInt *daIntTyypp=0;
2105 double *pt=self->getPointer();
2106 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2113 std::ostringstream oss;
2114 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2115 throw INTERP_KERNEL::Exception(oss.str().c_str());
2121 pt[singleVal]=singleValV;
2126 if(multiValV.size()!=1)
2128 std::ostringstream oss;
2129 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2130 throw INTERP_KERNEL::Exception(oss.str().c_str());
2132 pt[singleVal]=multiValV[0];
2137 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2141 throw INTERP_KERNEL::Exception(msg);
2150 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2154 std::ostringstream oss;
2155 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2156 throw INTERP_KERNEL::Exception(oss.str().c_str());
2164 if(multiVal.size()!=multiValV.size())
2166 std::ostringstream oss;
2167 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2168 throw INTERP_KERNEL::Exception(oss.str().c_str());
2170 for(int i=0;i<(int)multiVal.size();i++)
2172 int pos=multiVal[i];
2175 std::ostringstream oss;
2176 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2177 throw INTERP_KERNEL::Exception(oss.str().c_str());
2179 pt[multiVal[i]]=multiValV[i];
2185 const double *ptV=daIntTyyppV->getConstPointer();
2186 if(nbc>daIntTyyppV->getNumberOfCompo())
2188 std::ostringstream oss;
2189 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2190 throw INTERP_KERNEL::Exception(oss.str().c_str());
2192 std::copy(ptV,ptV+nbc,pt);
2196 throw INTERP_KERNEL::Exception(msg);
2201 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2206 for(int j=0;j<sz;j++)
2207 pt[slic.first+j*slic.second.second]=singleValV;
2212 if(sz!=(int)multiValV.size())
2214 std::ostringstream oss;
2215 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2216 throw INTERP_KERNEL::Exception(oss.str().c_str());
2218 for(int j=0;j<sz;j++)
2219 pt[slic.first+j*slic.second.second]=multiValV[j];
2224 const double *ptV=daIntTyyppV->getConstPointer();
2225 if(sz>daIntTyyppV->getNumberOfCompo())
2227 std::ostringstream oss;
2228 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2229 throw INTERP_KERNEL::Exception(oss.str().c_str());
2231 for(int j=0;j<sz;j++)
2232 pt[slic.first+j*slic.second.second]=ptV[j];
2236 throw INTERP_KERNEL::Exception(msg);
2240 throw INTERP_KERNEL::Exception(msg);
2246 class DataArrayIntIterator;
2248 class DataArrayInt : public DataArray
2251 static DataArrayInt *New();
2252 int intValue() const throw(INTERP_KERNEL::Exception);
2253 int getHashCode() const throw(INTERP_KERNEL::Exception);
2254 bool empty() const throw(INTERP_KERNEL::Exception);
2255 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2256 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2257 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2258 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2259 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2260 int popBackSilent() throw(INTERP_KERNEL::Exception);
2261 void pack() const throw(INTERP_KERNEL::Exception);
2262 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2263 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2264 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2265 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2266 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2267 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2268 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2269 void reverse() throw(INTERP_KERNEL::Exception);
2270 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2271 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2272 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2273 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2274 void fillWithZero() throw(INTERP_KERNEL::Exception);
2275 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2276 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2277 std::string repr() const throw(INTERP_KERNEL::Exception);
2278 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2279 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2280 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2281 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2282 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2283 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2284 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2285 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2286 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2287 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2288 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2289 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2290 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2291 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2292 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2293 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2294 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2295 void transpose() throw(INTERP_KERNEL::Exception);
2296 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2297 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2298 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2299 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2300 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2301 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2302 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2303 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2304 int front() const throw(INTERP_KERNEL::Exception);
2305 int back() const throw(INTERP_KERNEL::Exception);
2306 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2307 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2308 int *getPointer() throw(INTERP_KERNEL::Exception);
2309 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2310 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2311 const int *begin() const throw(INTERP_KERNEL::Exception);
2312 const int *end() const throw(INTERP_KERNEL::Exception);
2313 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2315 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2316 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2317 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2318 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2319 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2320 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2321 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2322 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2323 int count(int value) const throw(INTERP_KERNEL::Exception);
2324 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2325 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2326 int getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
2327 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2328 void abs() throw(INTERP_KERNEL::Exception);
2329 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2330 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2331 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2332 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2333 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2334 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2335 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2336 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2337 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2338 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2339 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2340 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2341 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2342 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2343 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2344 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2345 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2346 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2347 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2348 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2349 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2350 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2351 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2352 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2353 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2354 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2356 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2357 void computeOffsets() throw(INTERP_KERNEL::Exception);
2358 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2359 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2360 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2361 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2362 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2363 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2364 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2365 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2366 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2367 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2368 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2369 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2370 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2371 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2372 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2373 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2374 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2375 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2376 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2377 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2378 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2379 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2380 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2381 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2382 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2383 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2384 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2386 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2389 DataArrayInt() throw(INTERP_KERNEL::Exception)
2391 return DataArrayInt::New();
2394 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2396 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)";
2397 std::string msg(msgBase);
2399 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2402 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2406 if(PyInt_Check(nbOfTuples))
2408 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2410 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2413 if(PyInt_Check(nbOfComp))
2414 {//DataArrayInt.New([1,3,4,5],2,2)
2415 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2417 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2418 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2419 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2420 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2424 throw INTERP_KERNEL::Exception(msg.c_str());
2427 {//DataArrayInt.New([1,3,4],3)
2428 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2430 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2431 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2436 throw INTERP_KERNEL::Exception(msg.c_str());
2439 {// DataArrayInt.New([1,3,4])
2440 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2441 int tmpp1=-1,tmpp2=-1;
2442 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2443 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2447 else if(PyInt_Check(elt0))
2449 int nbOfTuples1=PyInt_AS_LONG(elt0);
2451 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2456 if(PyInt_Check(nbOfTuples))
2457 {//DataArrayInt.New(5,2)
2458 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2460 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2461 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2462 ret->alloc(nbOfTuples1,nbOfCompo);
2466 throw INTERP_KERNEL::Exception(msg.c_str());
2469 throw INTERP_KERNEL::Exception(msg.c_str());
2472 {//DataArrayInt.New(5)
2473 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2474 ret->alloc(nbOfTuples1,1);
2479 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2480 {//DataArrayInt.New(numpyArray)
2481 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2485 throw INTERP_KERNEL::Exception(msg.c_str());
2486 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2489 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2491 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2494 std::string __str__() const throw(INTERP_KERNEL::Exception)
2496 return self->reprNotTooLong();
2499 int __len__() const throw(INTERP_KERNEL::Exception)
2501 if(self->isAllocated())
2503 return self->getNumberOfTuples();
2507 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2511 int __int__() const throw(INTERP_KERNEL::Exception)
2513 return self->intValue();
2516 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2518 return self->iterator();
2521 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2523 int sz=self->getNumberOfComponents();
2524 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2525 self->accumulate(tmp);
2526 return convertIntArrToPyList(tmp,sz);
2529 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2532 std::vector<int> val2;
2533 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2534 return self->accumulatePerChunck(bg,bg+sz);
2537 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2540 std::vector<int> val2;
2541 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2542 return self->findIdsEqualTuple(bg,bg+sz);
2545 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2547 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2548 PyObject *ret=PyList_New(slcs.size());
2549 for(std::size_t i=0;i<slcs.size();i++)
2550 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2554 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2556 if(!PySlice_Check(slic))
2557 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2558 Py_ssize_t strt=2,stp=2,step=2;
2559 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2560 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2561 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 !");
2562 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2565 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2568 self->getMinMaxValues(a,b);
2569 PyObject *ret=PyTuple_New(2);
2570 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2571 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2575 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2577 int newNbOfTuples=-1;
2578 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2579 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2580 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2581 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2582 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2583 PyObject *ret=PyTuple_New(2);
2584 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2585 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2589 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2591 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2592 int szArr,sw,iTypppArr;
2593 std::vector<int> stdvecTyyppArr;
2594 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2595 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2596 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2600 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2602 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 !";
2603 if(PyList_Check(li) || PyTuple_Check(li))
2605 if(nbOfTuples && nbOfTuples != Py_None)
2607 if(PyInt_Check(nbOfTuples))
2609 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2611 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2612 if(nbOfComp && nbOfComp != Py_None)
2614 if(PyInt_Check(nbOfComp))
2615 {//DataArrayInt.setValues([1,3,4,5],2,2)
2616 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2618 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2619 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2620 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2623 throw INTERP_KERNEL::Exception(msg);
2626 {//DataArrayInt.setValues([1,3,4],3)
2628 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2629 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2633 throw INTERP_KERNEL::Exception(msg);
2636 {// DataArrayInt.setValues([1,3,4])
2637 int tmpp1=-1,tmpp2=-1;
2638 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2639 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2643 throw INTERP_KERNEL::Exception(msg);
2646 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2648 const int *vals=self->getConstPointer();
2649 return convertIntArrToPyList(vals,self->getNbOfElems());
2653 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2655 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2659 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2662 bool ret0=self->isEqualIfNotWhy(other,ret1);
2663 PyObject *ret=PyTuple_New(2);
2664 PyObject *ret0Py=ret0?Py_True:Py_False;
2666 PyTuple_SetItem(ret,0,ret0Py);
2667 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2671 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2673 const int *vals=self->getConstPointer();
2674 int nbOfComp=self->getNumberOfComponents();
2675 int nbOfTuples=self->getNumberOfTuples();
2676 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2679 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2681 std::vector<const DataArrayInt *> groups;
2682 std::vector< std::vector<int> > fidsOfGroups;
2683 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2684 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2685 PyObject *ret = PyList_New(2);
2686 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2687 int sz=fidsOfGroups.size();
2688 PyObject *ret1 = PyList_New(sz);
2689 for(int i=0;i<sz;i++)
2690 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2691 PyList_SetItem(ret,1,ret1);
2695 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2698 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2699 if (!SWIG_IsOK(res1))
2701 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2704 MapII *m=reinterpret_cast<MapII *>(da);
2705 self->transformWithIndArr(*m);
2710 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2711 self->transformWithIndArr(tmp,tmp+size);
2716 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2717 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2721 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2725 std::vector<int> multiVal;
2726 std::pair<int, std::pair<int,int> > slic;
2727 MEDCoupling::DataArrayInt *daIntTyypp=0;
2728 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2732 return self->findIdsEqualList(&singleVal,&singleVal+1);
2734 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2736 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2738 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2742 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2746 std::vector<int> multiVal;
2747 std::pair<int, std::pair<int,int> > slic;
2748 MEDCoupling::DataArrayInt *daIntTyypp=0;
2749 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2753 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2755 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2757 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2759 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2763 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2765 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2767 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2768 if (!SWIG_IsOK(res1))
2771 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2772 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2776 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2778 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2779 da2->checkAllocated();
2780 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2782 PyObject *ret = PyList_New(3);
2783 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2784 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2785 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2789 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2792 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2793 if (!SWIG_IsOK(res1))
2796 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2797 return self->transformWithIndArrR(tmp,tmp+size);
2801 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2802 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2806 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2809 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2810 if (!SWIG_IsOK(res1))
2813 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2814 if(size!=self->getNumberOfTuples())
2816 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2818 return self->renumberAndReduce(tmp,newNbOfTuple);
2822 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2824 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2825 da2->checkAllocated();
2826 int size=self->getNumberOfTuples();
2827 if(size!=self->getNumberOfTuples())
2829 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2831 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2835 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2838 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2839 if (!SWIG_IsOK(res1))
2842 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2843 if(size!=self->getNumberOfTuples())
2845 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2847 return self->renumber(tmp);
2851 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2853 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2854 da2->checkAllocated();
2855 int size=self->getNumberOfTuples();
2856 if(size!=self->getNumberOfTuples())
2858 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2860 return self->renumber(da2->getConstPointer());
2864 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2867 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2868 if (!SWIG_IsOK(res1))
2871 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2872 if(size!=self->getNumberOfTuples())
2874 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2876 return self->renumberR(tmp);
2880 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2882 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2883 da2->checkAllocated();
2884 int size=self->getNumberOfTuples();
2885 if(size!=self->getNumberOfTuples())
2887 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2889 return self->renumberR(da2->getConstPointer());
2893 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2895 std::vector<int> tmp;
2896 convertPyToNewIntArr3(li,tmp);
2897 self->setSelectedComponents(a,tmp);
2900 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2902 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2903 std::size_t sz(retCpp.size());
2904 PyObject *res(PyList_New(sz));
2905 for(std::size_t i=0;i<sz;i++)
2906 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2910 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2912 int sz=self->getNumberOfComponents();
2913 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2914 self->getTuple(tupleId,tmp);
2915 return convertIntArrToPyList(tmp,sz);
2918 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2920 DataArrayInt *arr=0;
2921 DataArrayInt *arrI=0;
2922 self->changeSurjectiveFormat(targetNb,arr,arrI);
2923 PyObject *res = PyList_New(2);
2924 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2925 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2929 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2931 std::vector<const DataArrayInt *> tmp;
2932 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2933 return DataArrayInt::Meld(tmp);
2936 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2938 std::vector<const DataArrayInt *> tmp;
2939 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2940 return DataArrayInt::Aggregate(tmp);
2943 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2945 std::vector<const DataArrayInt *> tmp;
2946 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2947 return DataArrayInt::AggregateIndexes(tmp);
2950 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2952 std::vector<const DataArrayInt *> tmp;
2953 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2954 return DataArrayInt::BuildUnion(tmp);
2957 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2959 std::vector<const DataArrayInt *> tmp;
2960 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2961 return DataArrayInt::BuildIntersection(tmp);
2964 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2967 int r1=self->getMaxValue(tmp);
2968 PyObject *ret=PyTuple_New(2);
2969 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2970 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2974 PyObject *getMaxAbsValue(std::size_t& tupleId) const throw(INTERP_KERNEL::Exception)
2977 int r1=self->getMaxAbsValue(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 *getMinValue() const throw(INTERP_KERNEL::Exception)
2987 int r1=self->getMinValue(tmp);
2988 PyObject *ret=PyTuple_New(2);
2989 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2990 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2994 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2996 int nbOfCompo=self->getNumberOfComponents();
3001 if(PyInt_Check(obj))
3003 int val=(int)PyInt_AS_LONG(obj);
3004 return self->findIdFirstEqual(val);
3007 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3011 std::vector<int> arr;
3012 convertPyToNewIntArr3(obj,arr);
3013 return self->findIdFirstEqualTuple(arr);
3018 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3020 int nbOfCompo=self->getNumberOfComponents();
3027 if(PyInt_Check(obj))
3029 int val=(int)PyInt_AS_LONG(obj);
3030 return self->presenceOfValue(val);
3033 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3037 std::vector<int> arr;
3038 convertPyToNewIntArr3(obj,arr);
3039 return self->presenceOfTuple(arr);
3044 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3046 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3047 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3048 self->checkAllocated();
3049 int nbOfTuples=self->getNumberOfTuples();
3050 int nbOfComponents=self->getNumberOfComponents();
3052 std::vector<int> vt1,vc1;
3053 std::pair<int, std::pair<int,int> > pt1,pc1;
3054 DataArrayInt *dt1=0,*dc1=0;
3056 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3057 MCAuto<DataArrayInt> ret;
3062 if(nbOfComponents==1)
3063 return PyInt_FromLong(self->getIJSafe(it1,0));
3064 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3067 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3069 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3071 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3073 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3076 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3077 std::vector<int> v2(1,ic1);
3078 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3082 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3083 std::vector<int> v2(1,ic1);
3084 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3088 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3089 std::vector<int> v2(1,ic1);
3090 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3094 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3095 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3099 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3100 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3104 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3105 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3109 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3110 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3114 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3115 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3116 std::vector<int> v2(nbOfComp);
3117 for(int i=0;i<nbOfComp;i++)
3118 v2[i]=pc1.first+i*pc1.second.second;
3119 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3123 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3124 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3125 std::vector<int> v2(nbOfComp);
3126 for(int i=0;i<nbOfComp;i++)
3127 v2[i]=pc1.first+i*pc1.second.second;
3128 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3132 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3133 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3134 std::vector<int> v2(nbOfComp);
3135 for(int i=0;i<nbOfComp;i++)
3136 v2[i]=pc1.first+i*pc1.second.second;
3137 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3141 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3142 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3143 std::vector<int> v2(nbOfComp);
3144 for(int i=0;i<nbOfComp;i++)
3145 v2[i]=pc1.first+i*pc1.second.second;
3146 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3149 throw INTERP_KERNEL::Exception(msg);
3153 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3155 self->checkAllocated();
3156 const char msg[]="Unexpected situation in __setitem__ !";
3157 int nbOfTuples=self->getNumberOfTuples();
3158 int nbOfComponents=self->getNumberOfComponents();
3161 std::vector<int> v1;
3163 DataArrayIntTuple *dd1=0;
3164 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3166 std::vector<int> vt1,vc1;
3167 std::pair<int, std::pair<int,int> > pt1,pc1;
3168 DataArrayInt *dt1=0,*dc1=0;
3169 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3170 MCAuto<DataArrayInt> tmp;
3178 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3181 tmp=DataArrayInt::New();
3182 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3183 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3186 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3189 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3190 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3193 throw INTERP_KERNEL::Exception(msg);
3202 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3205 tmp=DataArrayInt::New();
3206 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3207 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3210 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3213 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3214 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3217 throw INTERP_KERNEL::Exception(msg);
3226 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3229 tmp=DataArrayInt::New();
3230 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3231 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3234 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3237 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3238 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3241 throw INTERP_KERNEL::Exception(msg);
3250 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3253 tmp=DataArrayInt::New();
3254 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3255 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3258 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3261 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3262 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3265 throw INTERP_KERNEL::Exception(msg);
3274 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3277 tmp=DataArrayInt::New();
3278 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3279 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3282 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3285 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3286 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3289 throw INTERP_KERNEL::Exception(msg);
3298 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3301 tmp=DataArrayInt::New();
3302 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3303 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3306 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3309 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3310 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3313 throw INTERP_KERNEL::Exception(msg);
3322 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3325 tmp=DataArrayInt::New();
3326 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3327 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3330 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3333 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3334 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3337 throw INTERP_KERNEL::Exception(msg);
3346 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3349 tmp=DataArrayInt::New();
3350 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3351 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3354 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3357 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3358 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3361 throw INTERP_KERNEL::Exception(msg);
3370 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3373 tmp=DataArrayInt::New();
3374 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3375 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3378 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3381 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3382 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3385 throw INTERP_KERNEL::Exception(msg);
3394 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3397 tmp=DataArrayInt::New();
3398 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3399 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3402 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3405 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3406 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3409 throw INTERP_KERNEL::Exception(msg);
3418 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3421 tmp=DataArrayInt::New();
3422 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3423 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3426 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3429 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3430 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3433 throw INTERP_KERNEL::Exception(msg);
3442 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3445 tmp=DataArrayInt::New();
3446 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3447 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3450 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3453 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3454 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3457 throw INTERP_KERNEL::Exception(msg);
3466 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3469 tmp=DataArrayInt::New();
3470 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3471 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3474 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3477 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3478 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3481 throw INTERP_KERNEL::Exception(msg);
3490 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3493 tmp=DataArrayInt::New();
3494 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3495 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3498 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3501 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3502 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3505 throw INTERP_KERNEL::Exception(msg);
3514 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3517 tmp=DataArrayInt::New();
3518 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3519 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3522 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3525 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3526 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3529 throw INTERP_KERNEL::Exception(msg);
3538 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3541 tmp=DataArrayInt::New();
3542 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3543 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3546 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3549 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3550 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3553 throw INTERP_KERNEL::Exception(msg);
3558 throw INTERP_KERNEL::Exception(msg);
3563 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3565 return self->negate();
3568 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3570 const char msg[]="Unexpected situation in __add__ !";
3573 std::vector<int> aa;
3574 DataArrayIntTuple *aaa;
3576 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3581 MCAuto<DataArrayInt> ret=self->deepCopy();
3582 ret->applyLin(1,val);
3587 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3588 return DataArrayInt::Add(self,aaaa);
3592 return DataArrayInt::Add(self,a);
3596 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3597 return DataArrayInt::Add(self,aaaa);
3600 throw INTERP_KERNEL::Exception(msg);
3604 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3606 const char msg[]="Unexpected situation in __radd__ !";
3609 std::vector<int> aa;
3610 DataArrayIntTuple *aaa;
3612 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3617 MCAuto<DataArrayInt> ret=self->deepCopy();
3618 ret->applyLin(1,val);
3623 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3624 return DataArrayInt::Add(self,aaaa);
3628 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3629 return DataArrayInt::Add(self,aaaa);
3632 throw INTERP_KERNEL::Exception(msg);
3636 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3638 const char msg[]="Unexpected situation in __iadd__ !";
3641 std::vector<int> aa;
3642 DataArrayIntTuple *aaa;
3644 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3649 self->applyLin(1,val);
3650 Py_XINCREF(trueSelf);
3655 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3657 Py_XINCREF(trueSelf);
3663 Py_XINCREF(trueSelf);
3668 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3669 self->addEqual(aaaa);
3670 Py_XINCREF(trueSelf);
3674 throw INTERP_KERNEL::Exception(msg);
3678 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3680 const char msg[]="Unexpected situation in __sub__ !";
3683 std::vector<int> aa;
3684 DataArrayIntTuple *aaa;
3686 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3691 MCAuto<DataArrayInt> ret=self->deepCopy();
3692 ret->applyLin(1,-val);
3697 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3698 return DataArrayInt::Substract(self,aaaa);
3702 return DataArrayInt::Substract(self,a);
3706 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3707 return DataArrayInt::Substract(self,aaaa);
3710 throw INTERP_KERNEL::Exception(msg);
3714 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3716 const char msg[]="Unexpected situation in __rsub__ !";
3719 std::vector<int> aa;
3720 DataArrayIntTuple *aaa;
3722 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3727 MCAuto<DataArrayInt> ret=self->deepCopy();
3728 ret->applyLin(-1,val);
3733 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3734 return DataArrayInt::Substract(aaaa,self);
3738 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3739 return DataArrayInt::Substract(aaaa,self);
3742 throw INTERP_KERNEL::Exception(msg);
3746 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3748 const char msg[]="Unexpected situation in __isub__ !";
3751 std::vector<int> aa;
3752 DataArrayIntTuple *aaa;
3754 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3759 self->applyLin(1,-val);
3760 Py_XINCREF(trueSelf);
3765 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3766 self->substractEqual(bb);
3767 Py_XINCREF(trueSelf);
3772 self->substractEqual(a);
3773 Py_XINCREF(trueSelf);
3778 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3779 self->substractEqual(aaaa);
3780 Py_XINCREF(trueSelf);
3784 throw INTERP_KERNEL::Exception(msg);
3788 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3790 const char msg[]="Unexpected situation in __mul__ !";
3793 std::vector<int> aa;
3794 DataArrayIntTuple *aaa;
3796 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3801 MCAuto<DataArrayInt> ret=self->deepCopy();
3802 ret->applyLin(val,0);
3807 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3808 return DataArrayInt::Multiply(self,aaaa);
3812 return DataArrayInt::Multiply(self,a);
3816 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3817 return DataArrayInt::Multiply(self,aaaa);
3820 throw INTERP_KERNEL::Exception(msg);
3824 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3826 const char msg[]="Unexpected situation in __rmul__ !";
3829 std::vector<int> aa;
3830 DataArrayIntTuple *aaa;
3832 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3837 MCAuto<DataArrayInt> ret=self->deepCopy();
3838 ret->applyLin(val,0);
3843 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3844 return DataArrayInt::Multiply(self,aaaa);
3848 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3849 return DataArrayInt::Multiply(self,aaaa);
3852 throw INTERP_KERNEL::Exception(msg);
3856 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3858 const char msg[]="Unexpected situation in __imul__ !";
3861 std::vector<int> aa;
3862 DataArrayIntTuple *aaa;
3864 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3869 self->applyLin(val,0);
3870 Py_XINCREF(trueSelf);
3875 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3876 self->multiplyEqual(bb);
3877 Py_XINCREF(trueSelf);
3882 self->multiplyEqual(a);
3883 Py_XINCREF(trueSelf);
3888 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3889 self->multiplyEqual(aaaa);
3890 Py_XINCREF(trueSelf);
3894 throw INTERP_KERNEL::Exception(msg);
3898 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3900 const char msg[]="Unexpected situation in __div__ !";
3903 std::vector<int> aa;
3904 DataArrayIntTuple *aaa;
3906 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3911 MCAuto<DataArrayInt> ret=self->deepCopy();
3912 ret->applyDivideBy(val);
3917 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3918 return DataArrayInt::Divide(self,aaaa);
3922 return DataArrayInt::Divide(self,a);
3926 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3927 return DataArrayInt::Divide(self,aaaa);
3930 throw INTERP_KERNEL::Exception(msg);
3934 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3936 const char msg[]="Unexpected situation in __rdiv__ !";
3939 std::vector<int> aa;
3940 DataArrayIntTuple *aaa;
3942 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3947 MCAuto<DataArrayInt> ret=self->deepCopy();
3953 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3954 return DataArrayInt::Divide(aaaa,self);
3958 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3959 return DataArrayInt::Divide(aaaa,self);
3962 throw INTERP_KERNEL::Exception(msg);
3966 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3968 const char msg[]="Unexpected situation in __idiv__ !";
3971 std::vector<int> aa;
3972 DataArrayIntTuple *aaa;
3974 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3979 self->applyDivideBy(val);
3980 Py_XINCREF(trueSelf);
3985 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3986 self->divideEqual(bb);
3987 Py_XINCREF(trueSelf);
3992 self->divideEqual(a);
3993 Py_XINCREF(trueSelf);
3998 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3999 self->divideEqual(aaaa);
4000 Py_XINCREF(trueSelf);
4004 throw INTERP_KERNEL::Exception(msg);
4008 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4010 const char msg[]="Unexpected situation in __mod__ !";
4013 std::vector<int> aa;
4014 DataArrayIntTuple *aaa;
4016 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4021 MCAuto<DataArrayInt> ret=self->deepCopy();
4022 ret->applyModulus(val);
4027 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4028 return DataArrayInt::Modulus(self,aaaa);
4032 return DataArrayInt::Modulus(self,a);
4036 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4037 return DataArrayInt::Modulus(self,aaaa);
4040 throw INTERP_KERNEL::Exception(msg);
4044 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4046 const char msg[]="Unexpected situation in __rmod__ !";
4049 std::vector<int> aa;
4050 DataArrayIntTuple *aaa;
4052 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4057 MCAuto<DataArrayInt> ret=self->deepCopy();
4058 ret->applyRModulus(val);
4063 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4064 return DataArrayInt::Modulus(aaaa,self);
4068 return DataArrayInt::Modulus(a,self);
4072 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4073 return DataArrayInt::Modulus(aaaa,self);
4076 throw INTERP_KERNEL::Exception(msg);
4080 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4082 const char msg[]="Unexpected situation in __imod__ !";
4085 std::vector<int> aa;
4086 DataArrayIntTuple *aaa;
4088 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4093 self->applyModulus(val);
4094 Py_XINCREF(trueSelf);
4099 self->modulusEqual(a);
4100 Py_XINCREF(trueSelf);
4105 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4106 self->modulusEqual(aaaa);
4107 Py_XINCREF(trueSelf);
4111 throw INTERP_KERNEL::Exception(msg);
4115 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4117 const char msg[]="Unexpected situation in __pow__ !";
4120 std::vector<int> aa;
4121 DataArrayIntTuple *aaa;
4123 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4128 MCAuto<DataArrayInt> ret=self->deepCopy();
4134 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4135 return DataArrayInt::Pow(self,aaaa);
4139 return DataArrayInt::Pow(self,a);
4143 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4144 return DataArrayInt::Pow(self,aaaa);
4147 throw INTERP_KERNEL::Exception(msg);
4151 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4153 const char msg[]="Unexpected situation in __rpow__ !";
4156 std::vector<int> aa;
4157 DataArrayIntTuple *aaa;
4159 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4164 MCAuto<DataArrayInt> ret=self->deepCopy();
4165 ret->applyRPow(val);
4170 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4171 return DataArrayInt::Pow(aaaa,self);
4175 return DataArrayInt::Pow(a,self);
4179 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4180 return DataArrayInt::Pow(aaaa,self);
4183 throw INTERP_KERNEL::Exception(msg);
4187 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4189 const char msg[]="Unexpected situation in __ipow__ !";
4192 std::vector<int> aa;
4193 DataArrayIntTuple *aaa;
4195 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4200 self->applyPow(val);
4201 Py_XINCREF(trueSelf);
4207 Py_XINCREF(trueSelf);
4212 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4213 self->powEqual(aaaa);
4214 Py_XINCREF(trueSelf);
4218 throw INTERP_KERNEL::Exception(msg);
4222 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4224 std::ostringstream oss;
4225 self->reprQuickOverview(oss);
4229 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4231 int szArr,sw,iTypppArr;
4232 std::vector<int> stdvecTyyppArr;
4233 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4234 self->pushBackValsSilent(tmp,tmp+szArr);
4237 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4239 std::vector<int> ret1;
4240 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4241 std::size_t sz=ret0.size();
4242 PyObject *pyRet=PyTuple_New(2);
4243 PyObject *pyRet0=PyList_New((int)sz);
4244 PyObject *pyRet1=PyList_New((int)sz);
4245 for(std::size_t i=0;i<sz;i++)
4247 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4248 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4250 PyTuple_SetItem(pyRet,0,pyRet0);
4251 PyTuple_SetItem(pyRet,1,pyRet1);
4255 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4257 DataArrayInt *ret0=0,*ret1=0;
4258 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4259 PyObject *pyRet=PyTuple_New(2);
4260 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4261 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4265 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4268 bool ret(self->isRange(a,b,c));
4269 PyObject *pyRet=PyTuple_New(2);
4270 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4272 PyTuple_SetItem(pyRet,0,ret0Py);
4274 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4280 PyTuple_SetItem(pyRet,1,ret1Py);
4286 class DataArrayIntTuple;
4288 class DataArrayIntIterator
4291 DataArrayIntIterator(DataArrayInt *da);
4292 ~DataArrayIntIterator();
4297 DataArrayIntTuple *ret=self->nextt();
4299 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4302 PyErr_SetString(PyExc_StopIteration,"No more data.");
4309 class DataArrayIntTuple
4312 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4313 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4316 std::string __str__() const throw(INTERP_KERNEL::Exception)
4318 return self->repr();
4321 int __int__() const throw(INTERP_KERNEL::Exception)
4323 return self->intValue();
4326 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4328 return self->buildDAInt(1,self->getNumberOfCompo());
4331 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4333 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4334 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4335 Py_XINCREF(trueSelf);
4339 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4341 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4342 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4343 Py_XINCREF(trueSelf);
4347 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4349 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4350 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4351 Py_XINCREF(trueSelf);
4354 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4356 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4357 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4358 Py_XINCREF(trueSelf);
4362 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4364 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4365 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4366 Py_XINCREF(trueSelf);
4370 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4372 return PyInt_FromLong(self->getNumberOfCompo());
4375 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4377 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4380 std::vector<int> multiVal;
4381 std::pair<int, std::pair<int,int> > slic;
4382 MEDCoupling::DataArrayInt *daIntTyypp=0;
4383 const int *pt=self->getConstPointer();
4384 int nbc=self->getNumberOfCompo();
4385 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4392 std::ostringstream oss;
4393 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4394 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4398 return PyInt_FromLong(pt[singleVal]);
4402 return PyInt_FromLong(pt[nbc+singleVal]);
4405 std::ostringstream oss;
4406 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4407 throw INTERP_KERNEL::Exception(oss.str().c_str());
4413 PyObject *t=PyTuple_New(multiVal.size());
4414 for(int j=0;j<(int)multiVal.size();j++)
4416 int cid=multiVal[j];
4419 std::ostringstream oss;
4420 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4421 throw INTERP_KERNEL::Exception(oss.str().c_str());
4423 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4429 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4430 PyObject *t=PyTuple_New(sz);
4431 for(int j=0;j<sz;j++)
4432 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4436 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4440 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4442 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4443 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4446 std::vector<int> multiValV;
4447 std::pair<int, std::pair<int,int> > slicV;
4448 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4449 int nbc=self->getNumberOfCompo();
4450 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4452 std::vector<int> multiVal;
4453 std::pair<int, std::pair<int,int> > slic;
4454 MEDCoupling::DataArrayInt *daIntTyypp=0;
4455 int *pt=self->getPointer();
4456 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4463 std::ostringstream oss;
4464 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4465 throw INTERP_KERNEL::Exception(oss.str().c_str());
4471 pt[singleVal]=singleValV;
4476 if(multiValV.size()!=1)
4478 std::ostringstream oss;
4479 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4480 throw INTERP_KERNEL::Exception(oss.str().c_str());
4482 pt[singleVal]=multiValV[0];
4487 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4491 throw INTERP_KERNEL::Exception(msg);
4500 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4504 std::ostringstream oss;
4505 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4506 throw INTERP_KERNEL::Exception(oss.str().c_str());
4514 if(multiVal.size()!=multiValV.size())
4516 std::ostringstream oss;
4517 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4518 throw INTERP_KERNEL::Exception(oss.str().c_str());
4520 for(int i=0;i<(int)multiVal.size();i++)
4522 int pos=multiVal[i];
4525 std::ostringstream oss;
4526 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4527 throw INTERP_KERNEL::Exception(oss.str().c_str());
4529 pt[multiVal[i]]=multiValV[i];
4535 const int *ptV=daIntTyyppV->getConstPointer();
4536 if(nbc>daIntTyyppV->getNumberOfCompo())
4538 std::ostringstream oss;
4539 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4540 throw INTERP_KERNEL::Exception(oss.str().c_str());
4542 std::copy(ptV,ptV+nbc,pt);
4546 throw INTERP_KERNEL::Exception(msg);
4551 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4556 for(int j=0;j<sz;j++)
4557 pt[slic.first+j*slic.second.second]=singleValV;
4562 if(sz!=(int)multiValV.size())
4564 std::ostringstream oss;
4565 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4566 throw INTERP_KERNEL::Exception(oss.str().c_str());
4568 for(int j=0;j<sz;j++)
4569 pt[slic.first+j*slic.second.second]=multiValV[j];
4574 const int *ptV=daIntTyyppV->getConstPointer();
4575 if(sz>daIntTyyppV->getNumberOfCompo())
4577 std::ostringstream oss;
4578 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4579 throw INTERP_KERNEL::Exception(oss.str().c_str());
4581 for(int j=0;j<sz;j++)
4582 pt[slic.first+j*slic.second.second]=ptV[j];
4586 throw INTERP_KERNEL::Exception(msg);
4590 throw INTERP_KERNEL::Exception(msg);
4596 class DataArrayChar : public DataArray
4599 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4600 int getHashCode() const throw(INTERP_KERNEL::Exception);
4601 bool empty() const throw(INTERP_KERNEL::Exception);
4602 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4603 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4604 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4605 char popBackSilent() throw(INTERP_KERNEL::Exception);
4606 void pack() const throw(INTERP_KERNEL::Exception);
4607 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4608 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4609 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4610 void reverse() throw(INTERP_KERNEL::Exception);
4611 void fillWithZero() throw(INTERP_KERNEL::Exception);
4612 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4613 std::string repr() const throw(INTERP_KERNEL::Exception);
4614 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4615 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4616 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4617 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4618 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4619 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4620 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4621 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4622 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4623 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4624 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4625 char front() const throw(INTERP_KERNEL::Exception);
4626 char back() const throw(INTERP_KERNEL::Exception);
4627 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4628 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4629 char *getPointer() throw(INTERP_KERNEL::Exception);
4630 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4631 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4632 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4633 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4634 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4635 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4636 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4637 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4638 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4639 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4640 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4643 int __len__() const throw(INTERP_KERNEL::Exception)
4645 if(self->isAllocated())
4647 return self->getNumberOfTuples();
4651 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4655 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4658 bool ret0=self->isEqualIfNotWhy(other,ret1);
4659 PyObject *ret=PyTuple_New(2);
4660 PyObject *ret0Py=ret0?Py_True:Py_False;
4662 PyTuple_SetItem(ret,0,ret0Py);
4663 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4667 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4670 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4671 if (!SWIG_IsOK(res1))
4674 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4675 if(size!=self->getNumberOfTuples())
4677 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4679 return self->renumber(tmp);
4683 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4685 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4686 da2->checkAllocated();
4687 int size=self->getNumberOfTuples();
4688 if(size!=self->getNumberOfTuples())
4690 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4692 return self->renumber(da2->getConstPointer());
4696 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4699 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4700 if (!SWIG_IsOK(res1))
4703 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4704 if(size!=self->getNumberOfTuples())
4706 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4708 return self->renumberR(tmp);
4712 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4714 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4715 da2->checkAllocated();
4716 int size=self->getNumberOfTuples();
4717 if(size!=self->getNumberOfTuples())
4719 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4721 return self->renumberR(da2->getConstPointer());
4725 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4728 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4729 if (!SWIG_IsOK(res1))
4732 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4733 if(size!=self->getNumberOfTuples())
4735 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4737 return self->renumberAndReduce(tmp,newNbOfTuple);
4741 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4743 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4744 da2->checkAllocated();
4745 int size=self->getNumberOfTuples();
4746 if(size!=self->getNumberOfTuples())
4748 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4750 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4754 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4756 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4757 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4758 return DataArrayChar::Aggregate(tmp);
4761 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4763 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4764 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4765 return DataArrayChar::Meld(tmp);
4770 class DataArrayByteIterator;
4772 class DataArrayByte : public DataArrayChar
4775 static DataArrayByte *New();
4776 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4777 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4778 char byteValue() const throw(INTERP_KERNEL::Exception);
4781 DataArrayByte() throw(INTERP_KERNEL::Exception)
4783 return DataArrayByte::New();
4786 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4788 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) !";
4789 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4793 if(PyInt_Check(nbOfTuples))
4795 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4797 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4800 if(PyInt_Check(nbOfComp))
4801 {//DataArrayByte.New([1,3,4,5],2,2)
4802 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4804 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4805 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4806 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4807 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4811 throw INTERP_KERNEL::Exception(msg);
4814 {//DataArrayByte.New([1,3,4],3)
4815 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4817 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4818 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4823 throw INTERP_KERNEL::Exception(msg);
4826 {// DataArrayByte.New([1,3,4])
4827 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4828 int tmpp1=-1,tmpp2=-1;
4829 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4830 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4834 else if(PyInt_Check(elt0))
4836 int nbOfTuples1=PyInt_AS_LONG(elt0);
4838 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4843 if(PyInt_Check(nbOfTuples))
4844 {//DataArrayByte.New(5,2)
4845 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4847 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4848 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4849 ret->alloc(nbOfTuples1,nbOfCompo);
4853 throw INTERP_KERNEL::Exception(msg);
4856 throw INTERP_KERNEL::Exception(msg);
4859 {//DataArrayByte.New(5)
4860 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4861 ret->alloc(nbOfTuples1,1);
4866 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4867 {//DataArrayDouble.New(numpyArray)
4868 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4872 throw INTERP_KERNEL::Exception(msg);
4875 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4877 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4880 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4882 std::ostringstream oss;
4883 self->reprQuickOverview(oss);
4887 int __int__() const throw(INTERP_KERNEL::Exception)
4889 return (int) self->byteValue();
4892 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4894 return self->iterator();
4897 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4899 return (int)self->getIJ(tupleId,compoId);
4902 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4904 return (int)self->getIJSafe(tupleId,compoId);
4907 std::string __str__() const throw(INTERP_KERNEL::Exception)
4909 return self->repr();
4912 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4914 const char *vals=self->getConstPointer();
4915 int nbOfComp=self->getNumberOfComponents();
4916 int nbOfTuples=self->getNumberOfTuples();
4917 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4920 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4923 int ival=-1; std::vector<int> ivval;
4924 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4925 std::vector<char> vals(sz);
4926 std::copy(pt,pt+sz,vals.begin());
4927 return self->presenceOfTuple(vals);
4930 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4933 int ival=-1; std::vector<int> ivval;
4934 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4935 std::vector<char> vals2(sz);
4936 std::copy(pt,pt+sz,vals2.begin());
4937 return self->presenceOfValue(vals2);
4940 int findIdFirstEqual(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->findIdFirstEqual(vals2);
4950 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4953 int ival=-1; std::vector<int> ivval;
4954 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4955 std::vector<char> vals(sz);
4956 std::copy(pt,pt+sz,vals.begin());
4957 return self->findIdFirstEqualTuple(vals);
4960 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4963 int ival=-1; std::vector<int> ivval;
4964 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
4965 std::vector<char> vals(sz);
4966 std::copy(pt,pt+sz,vals.begin());
4967 return self->findIdSequence(vals);
4970 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4972 int sz=self->getNumberOfComponents();
4973 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4974 self->getTuple(tupleId,tmp);
4975 PyObject *ret=PyTuple_New(sz);
4976 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4980 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4983 int r1=(int)self->getMaxValue(tmp);
4984 PyObject *ret=PyTuple_New(2);
4985 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4986 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4990 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4993 int r1=(int)self->getMinValue(tmp);
4994 PyObject *ret=PyTuple_New(2);
4995 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4996 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5000 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5002 int nbOfCompo=self->getNumberOfComponents();
5007 if(PyInt_Check(obj))
5009 int val=(int)PyInt_AS_LONG(obj);
5010 return self->findIdFirstEqual(val);
5013 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5016 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5020 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5022 int nbOfCompo=self->getNumberOfComponents();
5029 if(PyInt_Check(obj))
5031 int val=(int)PyInt_AS_LONG(obj);
5032 return self->presenceOfValue(val);
5035 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5038 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5043 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5045 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5049 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5051 self->checkAllocated();
5052 const char msg[]="Unexpected situation in __setitem__ !";
5053 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5056 std::vector<int> v1;
5058 DataArrayIntTuple *dd1=0;
5059 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5061 std::vector<int> vt1,vc1;
5062 std::pair<int, std::pair<int,int> > pt1,pc1;
5063 DataArrayInt *dt1=0,*dc1=0;
5064 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5065 MCAuto<DataArrayInt> tmp;
5073 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5076 throw INTERP_KERNEL::Exception(msg);
5085 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5088 throw INTERP_KERNEL::Exception(msg);
5097 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5100 throw INTERP_KERNEL::Exception(msg);
5109 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5112 throw INTERP_KERNEL::Exception(msg);
5121 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5124 throw INTERP_KERNEL::Exception(msg);
5133 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5136 throw INTERP_KERNEL::Exception(msg);
5145 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5148 throw INTERP_KERNEL::Exception(msg);
5157 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5160 throw INTERP_KERNEL::Exception(msg);
5169 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5172 throw INTERP_KERNEL::Exception(msg);
5181 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5184 throw INTERP_KERNEL::Exception(msg);
5193 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5196 throw INTERP_KERNEL::Exception(msg);
5205 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5208 throw INTERP_KERNEL::Exception(msg);
5217 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5220 throw INTERP_KERNEL::Exception(msg);
5229 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5232 throw INTERP_KERNEL::Exception(msg);
5241 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5244 throw INTERP_KERNEL::Exception(msg);
5253 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5256 throw INTERP_KERNEL::Exception(msg);
5261 throw INTERP_KERNEL::Exception(msg);
5268 class DataArrayByteTuple;
5270 class DataArrayByteIterator
5273 DataArrayByteIterator(DataArrayByte *da);
5274 ~DataArrayByteIterator();
5277 class DataArrayByteTuple
5280 std::string repr() const throw(INTERP_KERNEL::Exception);
5281 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5284 std::string __str__() const throw(INTERP_KERNEL::Exception)
5286 return self->repr();
5289 char __int__() const throw(INTERP_KERNEL::Exception)
5291 return self->byteValue();
5294 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5296 return self->buildDAByte(1,self->getNumberOfCompo());
5301 class DataArrayAsciiCharIterator;
5303 class DataArrayAsciiChar : public DataArrayChar
5306 static DataArrayAsciiChar *New();
5307 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5308 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5309 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5312 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5314 return DataArrayAsciiChar::New();
5317 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5319 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) !";
5320 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5324 if(PyInt_Check(nbOfTuples))
5326 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5328 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5331 if(PyInt_Check(nbOfComp))
5332 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5333 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5335 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5336 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5337 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5338 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5342 throw INTERP_KERNEL::Exception(msg);
5345 {//DataArrayAsciiChar.New([1,3,4],3)
5346 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5348 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5349 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5353 else if(PyString_Check(nbOfTuples))
5355 if(PyString_Size(nbOfTuples)!=1)
5356 throw INTERP_KERNEL::Exception(msg);
5357 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5358 std::vector<std::string> tmp;
5359 if(fillStringVector(elt0,tmp))
5360 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5362 throw INTERP_KERNEL::Exception(msg);
5364 %#if PY_VERSION_HEX >= 0x03000000
5365 else if(PyUnicode_Check(nbOfTuples))
5367 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5368 throw INTERP_KERNEL::Exception(msg);
5369 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5370 std::vector<std::string> tmp;
5371 if(fillStringVector(elt0,tmp))
5372 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5374 throw INTERP_KERNEL::Exception(msg);
5378 throw INTERP_KERNEL::Exception(msg);
5382 std::vector<std::string> tmmp;
5383 if(fillStringVector(elt0,tmmp))
5384 //DataArrayAsciiChar.New(["abc","de","fghi"])
5385 return DataArrayAsciiChar::New(tmmp,' ');
5388 // DataArrayAsciiChar.New([1,3,4])
5389 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5390 int tmpp1=-1,tmpp2=-1;
5391 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5392 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5397 else if(PyInt_Check(elt0))
5399 int nbOfTuples1=PyInt_AS_LONG(elt0);
5401 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5406 if(PyInt_Check(nbOfTuples))
5407 {//DataArrayAsciiChar.New(5,2)
5408 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5410 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5411 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5412 ret->alloc(nbOfTuples1,nbOfCompo);
5416 throw INTERP_KERNEL::Exception(msg);
5419 throw INTERP_KERNEL::Exception(msg);
5422 {//DataArrayAsciiChar.New(5)
5423 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5424 ret->alloc(nbOfTuples1,1);
5429 throw INTERP_KERNEL::Exception(msg);
5432 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5434 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5437 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5439 std::ostringstream oss;
5440 self->reprQuickOverview(oss);
5444 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5446 return self->iterator();
5449 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5451 char tmp[2]; tmp[1]='\0';
5452 tmp[0]=self->getIJ(tupleId,compoId);
5453 return std::string(tmp);
5456 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5458 char tmp[2]; tmp[1]='\0';
5459 tmp[0]=self->getIJSafe(tupleId,compoId);
5460 return std::string(tmp);
5463 std::string __str__() const throw(INTERP_KERNEL::Exception)
5465 return self->repr();
5468 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5470 const char *vals=self->getConstPointer();
5471 int nbOfComp=self->getNumberOfComponents();
5472 int nbOfTuples=self->getNumberOfTuples();
5473 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5476 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5478 if(PyString_Check(tupl))
5480 Py_ssize_t sz=PyString_Size(tupl);
5481 std::vector<char> vals(sz);
5482 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5483 return self->presenceOfTuple(vals);
5485 %#if PY_VERSION_HEX >= 0x03000000
5486 else if(PyUnicode_Check(tupl))
5488 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5489 std::vector<char> vals(sz);
5490 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5491 return self->presenceOfTuple(vals);
5495 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5498 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5500 if(PyString_Check(vals))
5502 Py_ssize_t sz=PyString_Size(vals);
5503 std::vector<char> vals2(sz);
5504 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5505 return self->presenceOfValue(vals2);
5507 %#if PY_VERSION_HEX >= 0x03000000
5508 if(PyUnicode_Check(vals))
5510 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5511 std::vector<char> vals2(sz);
5512 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5513 return self->presenceOfValue(vals2);
5517 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5520 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5522 if(PyString_Check(vals))
5524 Py_ssize_t sz=PyString_Size(vals);
5525 std::vector<char> vals2(sz);
5526 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5527 return self->findIdFirstEqual(vals2);
5529 %#if PY_VERSION_HEX >= 0x03000000
5530 if(PyUnicode_Check(vals))
5532 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5533 std::vector<char> vals2(sz);
5534 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5535 return self->findIdFirstEqual(vals2);
5539 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5542 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5544 if(PyString_Check(tupl))
5546 Py_ssize_t sz=PyString_Size(tupl);
5547 std::vector<char> vals(sz);
5548 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5549 return self->findIdFirstEqualTuple(vals);
5551 %#if PY_VERSION_HEX >= 0x03000000
5552 if(PyUnicode_Check(tupl))
5554 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5555 std::vector<char> vals(sz);
5556 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5557 return self->findIdFirstEqualTuple(vals);
5561 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5564 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5566 if(PyString_Check(strOrListOfInt))
5568 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5569 std::vector<char> vals(sz);
5570 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5571 return self->findIdSequence(vals);
5573 %#if PY_VERSION_HEX >= 0x03000000
5574 else if(PyUnicode_Check(strOrListOfInt))
5576 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5577 std::vector<char> vals(sz);
5578 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5579 return self->findIdSequence(vals);
5583 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5586 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5588 int sz=self->getNumberOfComponents();
5589 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5590 self->getTuple(tupleId,tmp);
5591 return PyString_FromString(tmp);
5594 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5597 char tmp2[2]; tmp2[1]='\0';
5598 tmp2[0]=self->getMaxValue(tmp);
5599 PyObject *ret=PyTuple_New(2);
5600 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5601 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5605 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5608 char tmp2[2]; tmp2[1]='\0';
5609 tmp2[0]=self->getMinValue(tmp);
5610 PyObject *ret=PyTuple_New(2);
5611 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5612 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5616 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5618 int nbOfCompo=self->getNumberOfComponents();
5623 if(PyString_Check(obj))
5625 Py_ssize_t sz=PyString_Size(obj);
5626 char *pt=PyString_AsString(obj);
5628 return self->findIdFirstEqual(pt[0]);
5630 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5632 %#if PY_VERSION_HEX >= 0x03000000
5633 if(PyUnicode_Check(obj))
5636 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
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 !");
5644 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5647 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5651 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5653 int nbOfCompo=self->getNumberOfComponents();
5660 if(PyString_Check(obj))
5662 Py_ssize_t sz=PyString_Size(obj);
5663 char *pt=PyString_AsString(obj);
5665 return self->presenceOfValue(pt[0]);
5667 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5669 %#if PY_VERSION_HEX >= 0x03000000
5670 if(PyUnicode_Check(obj))
5673 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
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 !");
5681 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5684 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5688 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5691 std::vector<int> stdvecTyyppArr;
5692 std::pair<int, std::pair<int,int> > sTyyppArr;
5693 MEDCoupling::DataArrayInt *daIntTyypp=0;
5694 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5698 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5700 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5702 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5704 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5706 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5710 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5712 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.";
5714 std::vector<int> stdvecTyyppArr;
5715 std::pair<int, std::pair<int,int> > sTyyppArr;
5716 MEDCoupling::DataArrayInt *daIntTyypp=0;
5717 int nbOfCompo=self->getNumberOfComponents();
5718 int nbOfTuples=self->getNumberOfTuples();
5719 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5721 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5722 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5731 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5737 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5738 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5741 //value vector<string>
5744 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5745 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5748 //value DataArrayChar
5751 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5755 throw INTERP_KERNEL::Exception(msg);
5759 {//obj list-tuple[int]
5765 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5771 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5772 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5775 //value vector<string>
5778 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5779 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5782 //value DataArrayChar
5785 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5789 throw INTERP_KERNEL::Exception(msg);
5800 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5806 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5807 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5810 //value vector<string>
5813 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5814 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5817 //value DataArrayChar
5820 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5824 throw INTERP_KERNEL::Exception(msg);
5835 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5841 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5842 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5845 //value vector<string>
5848 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5849 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5852 //value DataArrayChar
5855 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5859 throw INTERP_KERNEL::Exception(msg);
5864 throw INTERP_KERNEL::Exception(msg);
5870 class DataArrayAsciiCharTuple;
5872 class DataArrayAsciiCharIterator
5875 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5876 ~DataArrayAsciiCharIterator();
5881 DataArrayAsciiCharTuple *ret=self->nextt();
5883 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5886 PyErr_SetString(PyExc_StopIteration,"No more data.");
5893 class DataArrayAsciiCharTuple
5896 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5897 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5900 std::string __str__() const throw(INTERP_KERNEL::Exception)
5902 return self->repr();
5905 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5907 return self->buildDAAsciiChar(1,self->getNumberOfCompo());
5914 def MEDCouplingStdReduceFunct(cls,params):
5916 ret=object.__new__(cls)
5921 def MEDCouplingDataArrayDoubleReduce(self):
5922 if not MEDCouplingHasNumPyBindings():
5923 raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5924 return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
5926 def MEDCouplingDataArrayIntReduce(self):
5927 if not MEDCouplingHasNumPyBindings():
5928 raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5929 return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
5931 def MEDCouplingDataArrayByteReduce(self):
5932 if not MEDCouplingHasNumPyBindings():
5933 raise InterpKernelException("PyWrap of DataArrayByte.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5934 return MEDCouplingStdReduceFunct,(DataArrayByte,((self.toNumPyArray(),),(self.__getstate__()),))
5936 def MEDCouplingDataArrayFloatReduce(self):
5937 if not MEDCouplingHasNumPyBindings():
5938 raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5939 return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))