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 getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
920 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
921 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
922 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
923 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
924 double getAverageValue() const throw(INTERP_KERNEL::Exception);
925 double norm2() const throw(INTERP_KERNEL::Exception);
926 double normMax() const throw(INTERP_KERNEL::Exception);
927 double normMin() const throw(INTERP_KERNEL::Exception);
928 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
929 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
930 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
931 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
932 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
933 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
934 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
935 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
936 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
937 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
938 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
939 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
940 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
941 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
943 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
944 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
945 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
946 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
947 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
948 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
949 void abs() throw(INTERP_KERNEL::Exception);
950 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
951 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
952 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
953 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
954 void applyPow(double val) throw(INTERP_KERNEL::Exception);
955 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
956 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
960 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
963 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
964 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
965 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
966 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
967 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
968 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
969 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
970 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
971 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
972 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
973 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
974 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
975 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
976 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
977 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
978 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
979 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
980 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
981 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
982 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
983 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
984 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
985 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
986 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
987 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
988 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
989 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
990 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
991 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
994 DataArrayDouble() throw(INTERP_KERNEL::Exception)
996 return DataArrayDouble::New();
999 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1001 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1004 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1006 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1009 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1012 std::vector<double> bb;
1014 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1015 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1016 self->pushBackValsSilent(tmp,tmp+nbTuples);
1019 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1021 std::ostringstream oss;
1022 self->reprQuickOverview(oss);
1026 std::string __str__() const throw(INTERP_KERNEL::Exception)
1028 return self->reprNotTooLong();
1031 double __float__() const throw(INTERP_KERNEL::Exception)
1033 return self->doubleValue();
1036 int __len__() const throw(INTERP_KERNEL::Exception)
1038 if(self->isAllocated())
1040 return self->getNumberOfTuples();
1044 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1048 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1050 return self->iterator();
1053 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1055 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 !";
1056 if(PyList_Check(li) || PyTuple_Check(li))
1060 if(PyInt_Check(nbOfTuples))
1062 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1064 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1067 if(PyInt_Check(nbOfComp))
1068 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1069 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1071 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1072 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1073 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1076 throw INTERP_KERNEL::Exception(msg);
1079 {//DataArrayDouble.setValues([1.,3.,4.],3)
1081 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1082 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1086 throw INTERP_KERNEL::Exception(msg);
1089 {// DataArrayDouble.setValues([1.,3.,4.])
1090 int tmpp1=-1,tmpp2=-1;
1091 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1092 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1096 throw INTERP_KERNEL::Exception(msg);
1099 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1101 const double *vals(self->begin());
1102 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1106 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1108 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1112 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1115 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1116 PyObject *ret=PyTuple_New(2);
1117 PyObject *ret0Py=ret0?Py_True:Py_False;
1119 PyTuple_SetItem(ret,0,ret0Py);
1120 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1124 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1126 const double *vals(self->begin());
1127 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1128 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1131 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1133 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1135 DataArrayDouble *a,*a2;
1136 DataArrayDoubleTuple *aa,*aa2;
1137 std::vector<double> bb,bb2;
1139 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1140 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1141 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1145 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1147 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1149 DataArrayDouble *a,*a2;
1150 DataArrayDoubleTuple *aa,*aa2;
1151 std::vector<double> bb,bb2;
1153 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1155 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1156 return convertDblArrToPyListOfTuple<double>(res,3,3);
1159 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1161 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1163 DataArrayDouble *a,*a2;
1164 DataArrayDoubleTuple *aa,*aa2;
1165 std::vector<double> bb,bb2;
1167 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1168 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1169 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1172 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1175 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1176 if (!SWIG_IsOK(res1))
1179 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1180 if(size!=self->getNumberOfTuples())
1182 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1184 return self->renumber(tmp);
1188 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1190 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1191 da2->checkAllocated();
1192 int size=self->getNumberOfTuples();
1193 if(size!=self->getNumberOfTuples())
1195 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1197 return self->renumber(da2->getConstPointer());
1201 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1204 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1205 if (!SWIG_IsOK(res1))
1208 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1209 if(size!=self->getNumberOfTuples())
1211 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1213 return self->renumberR(tmp);
1217 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1219 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1220 da2->checkAllocated();
1221 int size=self->getNumberOfTuples();
1222 if(size!=self->getNumberOfTuples())
1224 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1226 return self->renumberR(da2->getConstPointer());
1230 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1233 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1234 if (!SWIG_IsOK(res1))
1237 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1238 if(size!=self->getNumberOfTuples())
1240 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1242 return self->renumberAndReduce(tmp,newNbOfTuple);
1246 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1248 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1249 da2->checkAllocated();
1250 int size=self->getNumberOfTuples();
1251 if(size!=self->getNumberOfTuples())
1253 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1255 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1259 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1261 int thisTupleId,otherTupleId;
1262 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1263 PyObject *ret=PyTuple_New(3);
1264 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1265 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1266 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1270 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1273 double r1=self->getMaxValue(tmp);
1274 PyObject *ret=PyTuple_New(2);
1275 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1276 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1280 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1283 double r1=self->getMaxValue2(tmp);
1284 PyObject *ret=PyTuple_New(2);
1285 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1286 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1290 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1293 double r1=self->getMinValue(tmp);
1294 PyObject *ret=PyTuple_New(2);
1295 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1296 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1300 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1303 double r1=self->getMinValue2(tmp);
1304 PyObject *ret=PyTuple_New(2);
1305 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1306 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1310 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1312 int nbOfCompo(self->getNumberOfComponents());
1313 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1314 self->getMinMaxPerComponent(tmp);
1315 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1319 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1321 int sz=self->getNumberOfComponents();
1322 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1323 self->accumulate(tmp);
1324 return convertDblArrToPyList<double>(tmp,sz);
1327 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1330 std::vector<int> val2;
1331 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1332 return self->accumulatePerChunck(bg,bg+sz);
1335 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1337 DataArrayInt *comm, *commIndex;
1338 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1339 PyObject *res = PyList_New(2);
1340 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1341 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1345 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1349 DataArrayDoubleTuple *aa;
1350 std::vector<double> bb;
1352 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1353 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1355 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1356 PyObject *ret=PyTuple_New(2);
1357 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1358 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1362 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1364 std::vector<int> tmp;
1365 convertPyToNewIntArr3(li,tmp);
1366 self->setSelectedComponents(a,tmp);
1369 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1371 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1372 std::size_t sz(retCpp.size());
1373 PyObject *res(PyList_New(sz));
1374 for(std::size_t i=0;i<sz;i++)
1375 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1379 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1381 int sz=self->getNumberOfComponents();
1382 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1383 self->getTuple(tupleId,tmp);
1384 return convertDblArrToPyList<double>(tmp,sz);
1387 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1389 std::vector<const DataArrayDouble *> tmp;
1390 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1391 return DataArrayDouble::Aggregate(tmp);
1394 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1396 std::vector<const DataArrayDouble *> tmp;
1397 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1398 return DataArrayDouble::Meld(tmp);
1401 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1405 DataArrayDoubleTuple *aa;
1406 std::vector<double> bb;
1408 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1409 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1410 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1411 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1412 DataArrayInt *c=0,*cI=0;
1413 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1414 PyObject *ret=PyTuple_New(2);
1415 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1416 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1420 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1422 DataArrayInt *ret1=0;
1423 bool ret0=self->areIncludedInMe(other,prec,ret1);
1424 PyObject *ret=PyTuple_New(2);
1425 PyObject *ret0Py=ret0?Py_True:Py_False;
1427 PyTuple_SetItem(ret,0,ret0Py);
1428 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1432 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1434 return DataArrayT__getitem<double>(self,obj);
1437 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1439 return DataArrayT__setitem__<double>(self,obj,value);
1442 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1444 return self->negate();
1447 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1449 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1452 DataArrayDoubleTuple *aa;
1453 std::vector<double> bb;
1456 #ifndef WITHOUT_AUTOFIELD
1458 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1460 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1463 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1464 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1466 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1469 throw INTERP_KERNEL::Exception(msg);
1473 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1478 MCAuto<DataArrayDouble> ret=self->deepCopy();
1479 ret->applyLin(1.,val);
1480 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1484 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1488 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1489 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1493 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1494 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1497 throw INTERP_KERNEL::Exception(msg);
1501 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1503 const char msg[]="Unexpected situation in __radd__ !";
1506 DataArrayDoubleTuple *aa;
1507 std::vector<double> bb;
1509 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1514 MCAuto<DataArrayDouble> ret=self->deepCopy();
1515 ret->applyLin(1.,val);
1520 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1521 return DataArrayDouble::Add(self,aaa);
1525 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1526 return DataArrayDouble::Add(self,aaa);
1529 throw INTERP_KERNEL::Exception(msg);
1533 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1535 return DataArrayT_iadd<double>(trueSelf,obj,self);
1538 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1540 const char msg[]="Unexpected situation in __sub__ !";
1543 DataArrayDoubleTuple *aa;
1544 std::vector<double> bb;
1547 #ifndef WITHOUT_AUTOFIELD
1549 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1551 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1554 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1555 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1557 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1560 throw INTERP_KERNEL::Exception(msg);
1564 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1569 MCAuto<DataArrayDouble> ret=self->deepCopy();
1570 ret->applyLin(1.,-val);
1571 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1575 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1579 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1580 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1584 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1585 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1588 throw INTERP_KERNEL::Exception(msg);
1592 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1594 const char msg[]="Unexpected situation in __rsub__ !";
1597 DataArrayDoubleTuple *aa;
1598 std::vector<double> bb;
1600 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1605 MCAuto<DataArrayDouble> ret=self->deepCopy();
1606 ret->applyLin(-1.,val);
1611 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1612 return DataArrayDouble::Substract(aaa,self);
1616 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1617 return DataArrayDouble::Substract(aaa,self);
1620 throw INTERP_KERNEL::Exception(msg);
1624 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1626 return DataArrayT_isub<double>(trueSelf,obj,self);
1629 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1631 const char msg[]="Unexpected situation in __mul__ !";
1634 DataArrayDoubleTuple *aa;
1635 std::vector<double> bb;
1638 #ifndef WITHOUT_AUTOFIELD
1640 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1642 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1645 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1646 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1648 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1651 throw INTERP_KERNEL::Exception(msg);
1655 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1660 MCAuto<DataArrayDouble> ret=self->deepCopy();
1661 ret->applyLin(val,0.);
1662 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1666 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1670 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1671 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1675 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1676 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1679 throw INTERP_KERNEL::Exception(msg);
1683 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1685 return DataArrayFPT_rmul<double>(self,obj);
1688 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1690 return DataArrayT_imul<double>(trueSelf,obj,self);
1693 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1695 const char msg[]="Unexpected situation in __div__ !";
1698 DataArrayDoubleTuple *aa;
1699 std::vector<double> bb;
1702 #ifndef WITHOUT_AUTOFIELD
1704 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1706 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1709 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1710 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1712 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1715 throw INTERP_KERNEL::Exception(msg);
1719 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1725 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1726 MCAuto<DataArrayDouble> ret=self->deepCopy();
1727 ret->applyLin(1/val,0.);
1728 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1732 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1736 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1737 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1741 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1742 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1745 throw INTERP_KERNEL::Exception(msg);
1749 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1751 const char msg[]="Unexpected situation in __rdiv__ !";
1754 DataArrayDoubleTuple *aa;
1755 std::vector<double> bb;
1757 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1762 MCAuto<DataArrayDouble> ret=self->deepCopy();
1768 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1769 return DataArrayDouble::Divide(aaa,self);
1773 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1774 return DataArrayDouble::Divide(aaa,self);
1777 throw INTERP_KERNEL::Exception(msg);
1781 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1783 return DataArrayT_idiv<double>(trueSelf,obj,self);
1786 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1788 const char msg[]="Unexpected situation in __pow__ !";
1791 DataArrayDoubleTuple *aa;
1792 std::vector<double> bb;
1794 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1799 MCAuto<DataArrayDouble> ret=self->deepCopy();
1805 return DataArrayDouble::Pow(self,a);
1809 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1810 return DataArrayDouble::Pow(self,aaa);
1814 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1815 return DataArrayDouble::Pow(self,aaa);
1818 throw INTERP_KERNEL::Exception(msg);
1822 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1824 const char msg[]="Unexpected situation in __rpow__ !";
1827 DataArrayDoubleTuple *aa;
1828 std::vector<double> bb;
1830 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1835 MCAuto<DataArrayDouble> ret=self->deepCopy();
1836 ret->applyRPow(val);
1841 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1842 return DataArrayDouble::Pow(aaa,self);
1846 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1847 return DataArrayDouble::Pow(aaa,self);
1850 throw INTERP_KERNEL::Exception(msg);
1854 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1856 const char msg[]="Unexpected situation in __ipow__ !";
1859 DataArrayDoubleTuple *aa;
1860 std::vector<double> bb;
1862 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1867 self->applyPow(val);
1868 Py_XINCREF(trueSelf);
1874 Py_XINCREF(trueSelf);
1879 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1880 self->powEqual(aaa);
1881 Py_XINCREF(trueSelf);
1886 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1887 self->powEqual(aaa);
1888 Py_XINCREF(trueSelf);
1892 throw INTERP_KERNEL::Exception(msg);
1896 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1898 DataArrayInt *c=0,*cI=0;
1900 self->computeTupleIdsNearTuples(other,eps,c,cI);
1901 PyObject *ret=PyTuple_New(2);
1902 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1903 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1907 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1909 DataArrayInt *ret1=0;
1910 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1911 PyObject *ret=PyTuple_New(2);
1912 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1913 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1919 class DataArrayDoubleTuple;
1921 class DataArrayDoubleIterator
1924 DataArrayDoubleIterator(DataArrayDouble *da);
1925 ~DataArrayDoubleIterator();
1930 DataArrayDoubleTuple *ret=self->nextt();
1932 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1935 PyErr_SetString(PyExc_StopIteration,"No more data.");
1942 class DataArrayDoubleTuple
1945 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1946 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1949 std::string __str__() const throw(INTERP_KERNEL::Exception)
1951 return self->repr();
1954 double __float__() const throw(INTERP_KERNEL::Exception)
1956 return self->doubleValue();
1959 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
1961 return self->buildDADouble(1,self->getNumberOfCompo());
1964 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1966 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1967 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
1968 Py_XINCREF(trueSelf);
1972 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1974 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1975 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
1976 Py_XINCREF(trueSelf);
1980 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1982 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1983 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
1984 Py_XINCREF(trueSelf);
1988 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1990 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
1991 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
1992 Py_XINCREF(trueSelf);
1996 PyObject *__len__() throw(INTERP_KERNEL::Exception)
1998 return PyInt_FromLong(self->getNumberOfCompo());
2001 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2003 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2006 std::vector<int> multiVal;
2007 std::pair<int, std::pair<int,int> > slic;
2008 MEDCoupling::DataArrayInt *daIntTyypp=0;
2009 const double *pt=self->getConstPointer();
2010 int nbc=self->getNumberOfCompo();
2011 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2018 std::ostringstream oss;
2019 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2020 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2024 return PyFloat_FromDouble(pt[singleVal]);
2028 return PyFloat_FromDouble(pt[nbc+singleVal]);
2031 std::ostringstream oss;
2032 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2033 throw INTERP_KERNEL::Exception(oss.str().c_str());
2039 PyObject *t=PyTuple_New(multiVal.size());
2040 for(int j=0;j<(int)multiVal.size();j++)
2042 int cid=multiVal[j];
2045 std::ostringstream oss;
2046 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2047 throw INTERP_KERNEL::Exception(oss.str().c_str());
2049 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2055 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2056 PyObject *t=PyTuple_New(sz);
2057 for(int j=0;j<sz;j++)
2058 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2062 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2066 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2068 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2069 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2072 std::vector<double> multiValV;
2073 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2074 int nbc=self->getNumberOfCompo();
2075 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2077 std::vector<int> multiVal;
2078 std::pair<int, std::pair<int,int> > slic;
2079 MEDCoupling::DataArrayInt *daIntTyypp=0;
2080 double *pt=self->getPointer();
2081 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2088 std::ostringstream oss;
2089 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2090 throw INTERP_KERNEL::Exception(oss.str().c_str());
2096 pt[singleVal]=singleValV;
2101 if(multiValV.size()!=1)
2103 std::ostringstream oss;
2104 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2105 throw INTERP_KERNEL::Exception(oss.str().c_str());
2107 pt[singleVal]=multiValV[0];
2112 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2116 throw INTERP_KERNEL::Exception(msg);
2125 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2129 std::ostringstream oss;
2130 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2131 throw INTERP_KERNEL::Exception(oss.str().c_str());
2139 if(multiVal.size()!=multiValV.size())
2141 std::ostringstream oss;
2142 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2143 throw INTERP_KERNEL::Exception(oss.str().c_str());
2145 for(int i=0;i<(int)multiVal.size();i++)
2147 int pos=multiVal[i];
2150 std::ostringstream oss;
2151 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2152 throw INTERP_KERNEL::Exception(oss.str().c_str());
2154 pt[multiVal[i]]=multiValV[i];
2160 const double *ptV=daIntTyyppV->getConstPointer();
2161 if(nbc>daIntTyyppV->getNumberOfCompo())
2163 std::ostringstream oss;
2164 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2165 throw INTERP_KERNEL::Exception(oss.str().c_str());
2167 std::copy(ptV,ptV+nbc,pt);
2171 throw INTERP_KERNEL::Exception(msg);
2176 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2181 for(int j=0;j<sz;j++)
2182 pt[slic.first+j*slic.second.second]=singleValV;
2187 if(sz!=(int)multiValV.size())
2189 std::ostringstream oss;
2190 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2191 throw INTERP_KERNEL::Exception(oss.str().c_str());
2193 for(int j=0;j<sz;j++)
2194 pt[slic.first+j*slic.second.second]=multiValV[j];
2199 const double *ptV=daIntTyyppV->getConstPointer();
2200 if(sz>daIntTyyppV->getNumberOfCompo())
2202 std::ostringstream oss;
2203 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2204 throw INTERP_KERNEL::Exception(oss.str().c_str());
2206 for(int j=0;j<sz;j++)
2207 pt[slic.first+j*slic.second.second]=ptV[j];
2211 throw INTERP_KERNEL::Exception(msg);
2215 throw INTERP_KERNEL::Exception(msg);
2221 class DataArrayIntIterator;
2223 class DataArrayInt : public DataArray
2226 static DataArrayInt *New();
2227 int intValue() const throw(INTERP_KERNEL::Exception);
2228 int getHashCode() const throw(INTERP_KERNEL::Exception);
2229 bool empty() const throw(INTERP_KERNEL::Exception);
2230 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2231 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2232 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2233 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2234 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2235 int popBackSilent() throw(INTERP_KERNEL::Exception);
2236 void pack() const throw(INTERP_KERNEL::Exception);
2237 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2238 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2239 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2240 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2241 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2242 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2243 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2244 void reverse() throw(INTERP_KERNEL::Exception);
2245 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2246 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2247 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2248 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2249 void fillWithZero() throw(INTERP_KERNEL::Exception);
2250 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2251 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2252 std::string repr() const throw(INTERP_KERNEL::Exception);
2253 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2254 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2255 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2256 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2257 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2258 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2259 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2260 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2261 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2262 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2263 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2264 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2265 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2266 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2267 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2268 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2269 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2270 void transpose() throw(INTERP_KERNEL::Exception);
2271 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2272 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2273 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2274 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2275 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2276 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2277 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2278 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2279 int front() const throw(INTERP_KERNEL::Exception);
2280 int back() const throw(INTERP_KERNEL::Exception);
2281 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2282 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2283 int *getPointer() throw(INTERP_KERNEL::Exception);
2284 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2285 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2286 const int *begin() const throw(INTERP_KERNEL::Exception);
2287 const int *end() const throw(INTERP_KERNEL::Exception);
2288 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2289 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2290 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2291 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2292 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2293 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2294 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2295 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2296 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2297 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2298 int count(int value) const throw(INTERP_KERNEL::Exception);
2299 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2300 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2301 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2302 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2303 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2304 void abs() throw(INTERP_KERNEL::Exception);
2305 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2306 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2307 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2308 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2310 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2311 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2312 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2313 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2314 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2315 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2316 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2317 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2318 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2319 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2320 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2321 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2322 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2323 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2324 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2325 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2326 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2327 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2328 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2329 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2330 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2331 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2332 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2333 void computeOffsets() throw(INTERP_KERNEL::Exception);
2334 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2335 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2336 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2337 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2338 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2339 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2340 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2341 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2342 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2343 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2344 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2345 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2346 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2347 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2348 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2349 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2350 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2351 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2352 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2353 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2354 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2355 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2356 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2357 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2358 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2359 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2360 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2362 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2365 DataArrayInt() throw(INTERP_KERNEL::Exception)
2367 return DataArrayInt::New();
2370 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2372 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)";
2373 std::string msg(msgBase);
2375 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2378 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2382 if(PyInt_Check(nbOfTuples))
2384 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2386 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2389 if(PyInt_Check(nbOfComp))
2390 {//DataArrayInt.New([1,3,4,5],2,2)
2391 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2393 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2394 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2395 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2396 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2400 throw INTERP_KERNEL::Exception(msg.c_str());
2403 {//DataArrayInt.New([1,3,4],3)
2404 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2406 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2407 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2412 throw INTERP_KERNEL::Exception(msg.c_str());
2415 {// DataArrayInt.New([1,3,4])
2416 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2417 int tmpp1=-1,tmpp2=-1;
2418 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2419 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2423 else if(PyInt_Check(elt0))
2425 int nbOfTuples1=PyInt_AS_LONG(elt0);
2427 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2432 if(PyInt_Check(nbOfTuples))
2433 {//DataArrayInt.New(5,2)
2434 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2436 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2437 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2438 ret->alloc(nbOfTuples1,nbOfCompo);
2442 throw INTERP_KERNEL::Exception(msg.c_str());
2445 throw INTERP_KERNEL::Exception(msg.c_str());
2448 {//DataArrayInt.New(5)
2449 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2450 ret->alloc(nbOfTuples1,1);
2455 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2456 {//DataArrayInt.New(numpyArray)
2457 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2461 throw INTERP_KERNEL::Exception(msg.c_str());
2462 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2465 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2467 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2470 std::string __str__() const throw(INTERP_KERNEL::Exception)
2472 return self->reprNotTooLong();
2475 int __len__() const throw(INTERP_KERNEL::Exception)
2477 if(self->isAllocated())
2479 return self->getNumberOfTuples();
2483 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2487 int __int__() const throw(INTERP_KERNEL::Exception)
2489 return self->intValue();
2492 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2494 return self->iterator();
2497 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2499 int sz=self->getNumberOfComponents();
2500 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2501 self->accumulate(tmp);
2502 return convertIntArrToPyList(tmp,sz);
2505 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2508 std::vector<int> val2;
2509 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2510 return self->accumulatePerChunck(bg,bg+sz);
2513 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2516 std::vector<int> val2;
2517 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2518 return self->findIdsEqualTuple(bg,bg+sz);
2521 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2523 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2524 PyObject *ret=PyList_New(slcs.size());
2525 for(std::size_t i=0;i<slcs.size();i++)
2526 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2530 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2532 if(!PySlice_Check(slic))
2533 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2534 Py_ssize_t strt=2,stp=2,step=2;
2535 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2536 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2537 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 !");
2538 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2541 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2544 self->getMinMaxValues(a,b);
2545 PyObject *ret=PyTuple_New(2);
2546 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2547 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2551 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2553 int newNbOfTuples=-1;
2554 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2555 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2556 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2557 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2558 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2559 PyObject *ret=PyTuple_New(2);
2560 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2561 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2565 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2567 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2568 int szArr,sw,iTypppArr;
2569 std::vector<int> stdvecTyyppArr;
2570 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2571 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2572 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2576 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2578 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 !";
2579 if(PyList_Check(li) || PyTuple_Check(li))
2581 if(nbOfTuples && nbOfTuples != Py_None)
2583 if(PyInt_Check(nbOfTuples))
2585 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2587 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2588 if(nbOfComp && nbOfComp != Py_None)
2590 if(PyInt_Check(nbOfComp))
2591 {//DataArrayInt.setValues([1,3,4,5],2,2)
2592 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2594 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2595 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2596 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2599 throw INTERP_KERNEL::Exception(msg);
2602 {//DataArrayInt.setValues([1,3,4],3)
2604 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2605 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2609 throw INTERP_KERNEL::Exception(msg);
2612 {// DataArrayInt.setValues([1,3,4])
2613 int tmpp1=-1,tmpp2=-1;
2614 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2615 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2619 throw INTERP_KERNEL::Exception(msg);
2622 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2624 const int *vals=self->getConstPointer();
2625 return convertIntArrToPyList(vals,self->getNbOfElems());
2629 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2631 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2635 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2638 bool ret0=self->isEqualIfNotWhy(other,ret1);
2639 PyObject *ret=PyTuple_New(2);
2640 PyObject *ret0Py=ret0?Py_True:Py_False;
2642 PyTuple_SetItem(ret,0,ret0Py);
2643 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2647 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2649 const int *vals=self->getConstPointer();
2650 int nbOfComp=self->getNumberOfComponents();
2651 int nbOfTuples=self->getNumberOfTuples();
2652 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2655 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2657 std::vector<const DataArrayInt *> groups;
2658 std::vector< std::vector<int> > fidsOfGroups;
2659 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2660 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2661 PyObject *ret = PyList_New(2);
2662 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2663 int sz=fidsOfGroups.size();
2664 PyObject *ret1 = PyList_New(sz);
2665 for(int i=0;i<sz;i++)
2666 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2667 PyList_SetItem(ret,1,ret1);
2671 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2674 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2675 if (!SWIG_IsOK(res1))
2677 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2680 MapII *m=reinterpret_cast<MapII *>(da);
2681 self->transformWithIndArr(*m);
2686 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2687 self->transformWithIndArr(tmp,tmp+size);
2692 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2693 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2697 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2701 std::vector<int> multiVal;
2702 std::pair<int, std::pair<int,int> > slic;
2703 MEDCoupling::DataArrayInt *daIntTyypp=0;
2704 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2708 return self->findIdsEqualList(&singleVal,&singleVal+1);
2710 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2712 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2714 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2718 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2722 std::vector<int> multiVal;
2723 std::pair<int, std::pair<int,int> > slic;
2724 MEDCoupling::DataArrayInt *daIntTyypp=0;
2725 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2729 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2731 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2733 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2735 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2739 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2741 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2743 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2744 if (!SWIG_IsOK(res1))
2747 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2748 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2752 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2754 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2755 da2->checkAllocated();
2756 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2758 PyObject *ret = PyList_New(3);
2759 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2760 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2761 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2765 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2768 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2769 if (!SWIG_IsOK(res1))
2772 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2773 return self->transformWithIndArrR(tmp,tmp+size);
2777 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2778 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2782 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2785 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2786 if (!SWIG_IsOK(res1))
2789 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2790 if(size!=self->getNumberOfTuples())
2792 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2794 return self->renumberAndReduce(tmp,newNbOfTuple);
2798 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2800 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2801 da2->checkAllocated();
2802 int size=self->getNumberOfTuples();
2803 if(size!=self->getNumberOfTuples())
2805 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2807 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2811 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2814 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2815 if (!SWIG_IsOK(res1))
2818 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2819 if(size!=self->getNumberOfTuples())
2821 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2823 return self->renumber(tmp);
2827 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2829 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2830 da2->checkAllocated();
2831 int size=self->getNumberOfTuples();
2832 if(size!=self->getNumberOfTuples())
2834 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2836 return self->renumber(da2->getConstPointer());
2840 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2843 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2844 if (!SWIG_IsOK(res1))
2847 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2848 if(size!=self->getNumberOfTuples())
2850 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2852 return self->renumberR(tmp);
2856 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2858 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2859 da2->checkAllocated();
2860 int size=self->getNumberOfTuples();
2861 if(size!=self->getNumberOfTuples())
2863 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2865 return self->renumberR(da2->getConstPointer());
2869 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2871 std::vector<int> tmp;
2872 convertPyToNewIntArr3(li,tmp);
2873 self->setSelectedComponents(a,tmp);
2876 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2878 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2879 std::size_t sz(retCpp.size());
2880 PyObject *res(PyList_New(sz));
2881 for(std::size_t i=0;i<sz;i++)
2882 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2886 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2888 int sz=self->getNumberOfComponents();
2889 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2890 self->getTuple(tupleId,tmp);
2891 return convertIntArrToPyList(tmp,sz);
2894 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2896 DataArrayInt *arr=0;
2897 DataArrayInt *arrI=0;
2898 self->changeSurjectiveFormat(targetNb,arr,arrI);
2899 PyObject *res = PyList_New(2);
2900 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2901 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2905 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2907 std::vector<const DataArrayInt *> tmp;
2908 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2909 return DataArrayInt::Meld(tmp);
2912 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2914 std::vector<const DataArrayInt *> tmp;
2915 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2916 return DataArrayInt::Aggregate(tmp);
2919 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2921 std::vector<const DataArrayInt *> tmp;
2922 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2923 return DataArrayInt::AggregateIndexes(tmp);
2926 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2928 std::vector<const DataArrayInt *> tmp;
2929 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2930 return DataArrayInt::BuildUnion(tmp);
2933 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2935 std::vector<const DataArrayInt *> tmp;
2936 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2937 return DataArrayInt::BuildIntersection(tmp);
2940 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2943 int r1=self->getMaxValue(tmp);
2944 PyObject *ret=PyTuple_New(2);
2945 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2946 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2950 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
2953 int r1=self->getMinValue(tmp);
2954 PyObject *ret=PyTuple_New(2);
2955 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2956 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
2960 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2962 int nbOfCompo=self->getNumberOfComponents();
2967 if(PyInt_Check(obj))
2969 int val=(int)PyInt_AS_LONG(obj);
2970 return self->findIdFirstEqual(val);
2973 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
2977 std::vector<int> arr;
2978 convertPyToNewIntArr3(obj,arr);
2979 return self->findIdFirstEqualTuple(arr);
2984 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
2986 int nbOfCompo=self->getNumberOfComponents();
2993 if(PyInt_Check(obj))
2995 int val=(int)PyInt_AS_LONG(obj);
2996 return self->presenceOfValue(val);
2999 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3003 std::vector<int> arr;
3004 convertPyToNewIntArr3(obj,arr);
3005 return self->presenceOfTuple(arr);
3010 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3012 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3013 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3014 self->checkAllocated();
3015 int nbOfTuples=self->getNumberOfTuples();
3016 int nbOfComponents=self->getNumberOfComponents();
3018 std::vector<int> vt1,vc1;
3019 std::pair<int, std::pair<int,int> > pt1,pc1;
3020 DataArrayInt *dt1=0,*dc1=0;
3022 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3023 MCAuto<DataArrayInt> ret;
3028 if(nbOfComponents==1)
3029 return PyInt_FromLong(self->getIJSafe(it1,0));
3030 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3033 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3035 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3037 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3039 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3042 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3043 std::vector<int> v2(1,ic1);
3044 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3048 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3049 std::vector<int> v2(1,ic1);
3050 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3054 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3055 std::vector<int> v2(1,ic1);
3056 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3060 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3061 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3065 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3066 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3070 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3071 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3075 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3076 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3080 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3081 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3082 std::vector<int> v2(nbOfComp);
3083 for(int i=0;i<nbOfComp;i++)
3084 v2[i]=pc1.first+i*pc1.second.second;
3085 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3089 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3090 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3091 std::vector<int> v2(nbOfComp);
3092 for(int i=0;i<nbOfComp;i++)
3093 v2[i]=pc1.first+i*pc1.second.second;
3094 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3098 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3099 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3100 std::vector<int> v2(nbOfComp);
3101 for(int i=0;i<nbOfComp;i++)
3102 v2[i]=pc1.first+i*pc1.second.second;
3103 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3107 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3108 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3109 std::vector<int> v2(nbOfComp);
3110 for(int i=0;i<nbOfComp;i++)
3111 v2[i]=pc1.first+i*pc1.second.second;
3112 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3115 throw INTERP_KERNEL::Exception(msg);
3119 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3121 self->checkAllocated();
3122 const char msg[]="Unexpected situation in __setitem__ !";
3123 int nbOfTuples=self->getNumberOfTuples();
3124 int nbOfComponents=self->getNumberOfComponents();
3127 std::vector<int> v1;
3129 DataArrayIntTuple *dd1=0;
3130 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3132 std::vector<int> vt1,vc1;
3133 std::pair<int, std::pair<int,int> > pt1,pc1;
3134 DataArrayInt *dt1=0,*dc1=0;
3135 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3136 MCAuto<DataArrayInt> tmp;
3144 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3147 tmp=DataArrayInt::New();
3148 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3149 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3152 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3155 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3156 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3159 throw INTERP_KERNEL::Exception(msg);
3168 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3171 tmp=DataArrayInt::New();
3172 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3173 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3176 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3179 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3180 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3183 throw INTERP_KERNEL::Exception(msg);
3192 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3195 tmp=DataArrayInt::New();
3196 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3197 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3200 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3203 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3204 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3207 throw INTERP_KERNEL::Exception(msg);
3216 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3219 tmp=DataArrayInt::New();
3220 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3221 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3224 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3227 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3228 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3231 throw INTERP_KERNEL::Exception(msg);
3240 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3243 tmp=DataArrayInt::New();
3244 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3245 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3248 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3251 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3252 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3255 throw INTERP_KERNEL::Exception(msg);
3264 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3267 tmp=DataArrayInt::New();
3268 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3269 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3272 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3275 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3276 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3279 throw INTERP_KERNEL::Exception(msg);
3288 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3291 tmp=DataArrayInt::New();
3292 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3293 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3296 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3299 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3300 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3303 throw INTERP_KERNEL::Exception(msg);
3312 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3315 tmp=DataArrayInt::New();
3316 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3317 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3320 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3323 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3324 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3327 throw INTERP_KERNEL::Exception(msg);
3336 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3339 tmp=DataArrayInt::New();
3340 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3341 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3344 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3347 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3348 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3351 throw INTERP_KERNEL::Exception(msg);
3360 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3363 tmp=DataArrayInt::New();
3364 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3365 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3368 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3371 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3372 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3375 throw INTERP_KERNEL::Exception(msg);
3384 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3387 tmp=DataArrayInt::New();
3388 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3389 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3392 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3395 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3396 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3399 throw INTERP_KERNEL::Exception(msg);
3408 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3411 tmp=DataArrayInt::New();
3412 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3413 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3416 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3419 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3420 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3423 throw INTERP_KERNEL::Exception(msg);
3432 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3435 tmp=DataArrayInt::New();
3436 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3437 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3440 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3443 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3444 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3447 throw INTERP_KERNEL::Exception(msg);
3456 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3459 tmp=DataArrayInt::New();
3460 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3461 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3464 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3467 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3468 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3471 throw INTERP_KERNEL::Exception(msg);
3480 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3483 tmp=DataArrayInt::New();
3484 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3485 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3488 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3491 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3492 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3495 throw INTERP_KERNEL::Exception(msg);
3504 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3507 tmp=DataArrayInt::New();
3508 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3509 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3512 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3515 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3516 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3519 throw INTERP_KERNEL::Exception(msg);
3524 throw INTERP_KERNEL::Exception(msg);
3529 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3531 return self->negate();
3534 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3536 const char msg[]="Unexpected situation in __add__ !";
3539 std::vector<int> aa;
3540 DataArrayIntTuple *aaa;
3542 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3547 MCAuto<DataArrayInt> ret=self->deepCopy();
3548 ret->applyLin(1,val);
3553 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3554 return DataArrayInt::Add(self,aaaa);
3558 return DataArrayInt::Add(self,a);
3562 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3563 return DataArrayInt::Add(self,aaaa);
3566 throw INTERP_KERNEL::Exception(msg);
3570 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3572 const char msg[]="Unexpected situation in __radd__ !";
3575 std::vector<int> aa;
3576 DataArrayIntTuple *aaa;
3578 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3583 MCAuto<DataArrayInt> ret=self->deepCopy();
3584 ret->applyLin(1,val);
3589 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3590 return DataArrayInt::Add(self,aaaa);
3594 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3595 return DataArrayInt::Add(self,aaaa);
3598 throw INTERP_KERNEL::Exception(msg);
3602 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3604 const char msg[]="Unexpected situation in __iadd__ !";
3607 std::vector<int> aa;
3608 DataArrayIntTuple *aaa;
3610 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3615 self->applyLin(1,val);
3616 Py_XINCREF(trueSelf);
3621 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3623 Py_XINCREF(trueSelf);
3629 Py_XINCREF(trueSelf);
3634 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3635 self->addEqual(aaaa);
3636 Py_XINCREF(trueSelf);
3640 throw INTERP_KERNEL::Exception(msg);
3644 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3646 const char msg[]="Unexpected situation in __sub__ !";
3649 std::vector<int> aa;
3650 DataArrayIntTuple *aaa;
3652 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3657 MCAuto<DataArrayInt> ret=self->deepCopy();
3658 ret->applyLin(1,-val);
3663 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3664 return DataArrayInt::Substract(self,aaaa);
3668 return DataArrayInt::Substract(self,a);
3672 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3673 return DataArrayInt::Substract(self,aaaa);
3676 throw INTERP_KERNEL::Exception(msg);
3680 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3682 const char msg[]="Unexpected situation in __rsub__ !";
3685 std::vector<int> aa;
3686 DataArrayIntTuple *aaa;
3688 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3693 MCAuto<DataArrayInt> ret=self->deepCopy();
3694 ret->applyLin(-1,val);
3699 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3700 return DataArrayInt::Substract(aaaa,self);
3704 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3705 return DataArrayInt::Substract(aaaa,self);
3708 throw INTERP_KERNEL::Exception(msg);
3712 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3714 const char msg[]="Unexpected situation in __isub__ !";
3717 std::vector<int> aa;
3718 DataArrayIntTuple *aaa;
3720 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3725 self->applyLin(1,-val);
3726 Py_XINCREF(trueSelf);
3731 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3732 self->substractEqual(bb);
3733 Py_XINCREF(trueSelf);
3738 self->substractEqual(a);
3739 Py_XINCREF(trueSelf);
3744 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3745 self->substractEqual(aaaa);
3746 Py_XINCREF(trueSelf);
3750 throw INTERP_KERNEL::Exception(msg);
3754 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3756 const char msg[]="Unexpected situation in __mul__ !";
3759 std::vector<int> aa;
3760 DataArrayIntTuple *aaa;
3762 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3767 MCAuto<DataArrayInt> ret=self->deepCopy();
3768 ret->applyLin(val,0);
3773 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3774 return DataArrayInt::Multiply(self,aaaa);
3778 return DataArrayInt::Multiply(self,a);
3782 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3783 return DataArrayInt::Multiply(self,aaaa);
3786 throw INTERP_KERNEL::Exception(msg);
3790 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3792 const char msg[]="Unexpected situation in __rmul__ !";
3795 std::vector<int> aa;
3796 DataArrayIntTuple *aaa;
3798 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3803 MCAuto<DataArrayInt> ret=self->deepCopy();
3804 ret->applyLin(val,0);
3809 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3810 return DataArrayInt::Multiply(self,aaaa);
3814 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3815 return DataArrayInt::Multiply(self,aaaa);
3818 throw INTERP_KERNEL::Exception(msg);
3822 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3824 const char msg[]="Unexpected situation in __imul__ !";
3827 std::vector<int> aa;
3828 DataArrayIntTuple *aaa;
3830 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3835 self->applyLin(val,0);
3836 Py_XINCREF(trueSelf);
3841 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3842 self->multiplyEqual(bb);
3843 Py_XINCREF(trueSelf);
3848 self->multiplyEqual(a);
3849 Py_XINCREF(trueSelf);
3854 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3855 self->multiplyEqual(aaaa);
3856 Py_XINCREF(trueSelf);
3860 throw INTERP_KERNEL::Exception(msg);
3864 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3866 const char msg[]="Unexpected situation in __div__ !";
3869 std::vector<int> aa;
3870 DataArrayIntTuple *aaa;
3872 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3877 MCAuto<DataArrayInt> ret=self->deepCopy();
3878 ret->applyDivideBy(val);
3883 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3884 return DataArrayInt::Divide(self,aaaa);
3888 return DataArrayInt::Divide(self,a);
3892 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3893 return DataArrayInt::Divide(self,aaaa);
3896 throw INTERP_KERNEL::Exception(msg);
3900 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3902 const char msg[]="Unexpected situation in __rdiv__ !";
3905 std::vector<int> aa;
3906 DataArrayIntTuple *aaa;
3908 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3913 MCAuto<DataArrayInt> ret=self->deepCopy();
3919 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3920 return DataArrayInt::Divide(aaaa,self);
3924 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3925 return DataArrayInt::Divide(aaaa,self);
3928 throw INTERP_KERNEL::Exception(msg);
3932 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3934 const char msg[]="Unexpected situation in __idiv__ !";
3937 std::vector<int> aa;
3938 DataArrayIntTuple *aaa;
3940 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3945 self->applyDivideBy(val);
3946 Py_XINCREF(trueSelf);
3951 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3952 self->divideEqual(bb);
3953 Py_XINCREF(trueSelf);
3958 self->divideEqual(a);
3959 Py_XINCREF(trueSelf);
3964 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3965 self->divideEqual(aaaa);
3966 Py_XINCREF(trueSelf);
3970 throw INTERP_KERNEL::Exception(msg);
3974 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3976 const char msg[]="Unexpected situation in __mod__ !";
3979 std::vector<int> aa;
3980 DataArrayIntTuple *aaa;
3982 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3987 MCAuto<DataArrayInt> ret=self->deepCopy();
3988 ret->applyModulus(val);
3993 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3994 return DataArrayInt::Modulus(self,aaaa);
3998 return DataArrayInt::Modulus(self,a);
4002 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4003 return DataArrayInt::Modulus(self,aaaa);
4006 throw INTERP_KERNEL::Exception(msg);
4010 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4012 const char msg[]="Unexpected situation in __rmod__ !";
4015 std::vector<int> aa;
4016 DataArrayIntTuple *aaa;
4018 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4023 MCAuto<DataArrayInt> ret=self->deepCopy();
4024 ret->applyRModulus(val);
4029 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4030 return DataArrayInt::Modulus(aaaa,self);
4034 return DataArrayInt::Modulus(a,self);
4038 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4039 return DataArrayInt::Modulus(aaaa,self);
4042 throw INTERP_KERNEL::Exception(msg);
4046 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4048 const char msg[]="Unexpected situation in __imod__ !";
4051 std::vector<int> aa;
4052 DataArrayIntTuple *aaa;
4054 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4059 self->applyModulus(val);
4060 Py_XINCREF(trueSelf);
4065 self->modulusEqual(a);
4066 Py_XINCREF(trueSelf);
4071 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4072 self->modulusEqual(aaaa);
4073 Py_XINCREF(trueSelf);
4077 throw INTERP_KERNEL::Exception(msg);
4081 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4083 const char msg[]="Unexpected situation in __pow__ !";
4086 std::vector<int> aa;
4087 DataArrayIntTuple *aaa;
4089 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4094 MCAuto<DataArrayInt> ret=self->deepCopy();
4100 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4101 return DataArrayInt::Pow(self,aaaa);
4105 return DataArrayInt::Pow(self,a);
4109 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4110 return DataArrayInt::Pow(self,aaaa);
4113 throw INTERP_KERNEL::Exception(msg);
4117 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4119 const char msg[]="Unexpected situation in __rpow__ !";
4122 std::vector<int> aa;
4123 DataArrayIntTuple *aaa;
4125 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4130 MCAuto<DataArrayInt> ret=self->deepCopy();
4131 ret->applyRPow(val);
4136 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4137 return DataArrayInt::Pow(aaaa,self);
4141 return DataArrayInt::Pow(a,self);
4145 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4146 return DataArrayInt::Pow(aaaa,self);
4149 throw INTERP_KERNEL::Exception(msg);
4153 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4155 const char msg[]="Unexpected situation in __ipow__ !";
4158 std::vector<int> aa;
4159 DataArrayIntTuple *aaa;
4161 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4166 self->applyPow(val);
4167 Py_XINCREF(trueSelf);
4173 Py_XINCREF(trueSelf);
4178 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4179 self->powEqual(aaaa);
4180 Py_XINCREF(trueSelf);
4184 throw INTERP_KERNEL::Exception(msg);
4188 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4190 std::ostringstream oss;
4191 self->reprQuickOverview(oss);
4195 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4197 int szArr,sw,iTypppArr;
4198 std::vector<int> stdvecTyyppArr;
4199 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4200 self->pushBackValsSilent(tmp,tmp+szArr);
4203 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4205 std::vector<int> ret1;
4206 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4207 std::size_t sz=ret0.size();
4208 PyObject *pyRet=PyTuple_New(2);
4209 PyObject *pyRet0=PyList_New((int)sz);
4210 PyObject *pyRet1=PyList_New((int)sz);
4211 for(std::size_t i=0;i<sz;i++)
4213 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4214 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4216 PyTuple_SetItem(pyRet,0,pyRet0);
4217 PyTuple_SetItem(pyRet,1,pyRet1);
4221 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4223 DataArrayInt *ret0=0,*ret1=0;
4224 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4225 PyObject *pyRet=PyTuple_New(2);
4226 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4227 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4231 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4234 bool ret(self->isRange(a,b,c));
4235 PyObject *pyRet=PyTuple_New(2);
4236 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4238 PyTuple_SetItem(pyRet,0,ret0Py);
4240 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4246 PyTuple_SetItem(pyRet,1,ret1Py);
4252 class DataArrayIntTuple;
4254 class DataArrayIntIterator
4257 DataArrayIntIterator(DataArrayInt *da);
4258 ~DataArrayIntIterator();
4263 DataArrayIntTuple *ret=self->nextt();
4265 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4268 PyErr_SetString(PyExc_StopIteration,"No more data.");
4275 class DataArrayIntTuple
4278 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4279 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4282 std::string __str__() const throw(INTERP_KERNEL::Exception)
4284 return self->repr();
4287 int __int__() const throw(INTERP_KERNEL::Exception)
4289 return self->intValue();
4292 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4294 return self->buildDAInt(1,self->getNumberOfCompo());
4297 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4299 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4300 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4301 Py_XINCREF(trueSelf);
4305 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4307 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4308 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4309 Py_XINCREF(trueSelf);
4313 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4315 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4316 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4317 Py_XINCREF(trueSelf);
4320 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4322 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4323 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4324 Py_XINCREF(trueSelf);
4328 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4330 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4331 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4332 Py_XINCREF(trueSelf);
4336 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4338 return PyInt_FromLong(self->getNumberOfCompo());
4341 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4343 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4346 std::vector<int> multiVal;
4347 std::pair<int, std::pair<int,int> > slic;
4348 MEDCoupling::DataArrayInt *daIntTyypp=0;
4349 const int *pt=self->getConstPointer();
4350 int nbc=self->getNumberOfCompo();
4351 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4358 std::ostringstream oss;
4359 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4360 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4364 return PyInt_FromLong(pt[singleVal]);
4368 return PyInt_FromLong(pt[nbc+singleVal]);
4371 std::ostringstream oss;
4372 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4373 throw INTERP_KERNEL::Exception(oss.str().c_str());
4379 PyObject *t=PyTuple_New(multiVal.size());
4380 for(int j=0;j<(int)multiVal.size();j++)
4382 int cid=multiVal[j];
4385 std::ostringstream oss;
4386 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4387 throw INTERP_KERNEL::Exception(oss.str().c_str());
4389 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4395 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4396 PyObject *t=PyTuple_New(sz);
4397 for(int j=0;j<sz;j++)
4398 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4402 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4406 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4408 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4409 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4412 std::vector<int> multiValV;
4413 std::pair<int, std::pair<int,int> > slicV;
4414 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4415 int nbc=self->getNumberOfCompo();
4416 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4418 std::vector<int> multiVal;
4419 std::pair<int, std::pair<int,int> > slic;
4420 MEDCoupling::DataArrayInt *daIntTyypp=0;
4421 int *pt=self->getPointer();
4422 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4429 std::ostringstream oss;
4430 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4431 throw INTERP_KERNEL::Exception(oss.str().c_str());
4437 pt[singleVal]=singleValV;
4442 if(multiValV.size()!=1)
4444 std::ostringstream oss;
4445 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4446 throw INTERP_KERNEL::Exception(oss.str().c_str());
4448 pt[singleVal]=multiValV[0];
4453 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4457 throw INTERP_KERNEL::Exception(msg);
4466 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4470 std::ostringstream oss;
4471 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4472 throw INTERP_KERNEL::Exception(oss.str().c_str());
4480 if(multiVal.size()!=multiValV.size())
4482 std::ostringstream oss;
4483 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4484 throw INTERP_KERNEL::Exception(oss.str().c_str());
4486 for(int i=0;i<(int)multiVal.size();i++)
4488 int pos=multiVal[i];
4491 std::ostringstream oss;
4492 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4493 throw INTERP_KERNEL::Exception(oss.str().c_str());
4495 pt[multiVal[i]]=multiValV[i];
4501 const int *ptV=daIntTyyppV->getConstPointer();
4502 if(nbc>daIntTyyppV->getNumberOfCompo())
4504 std::ostringstream oss;
4505 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4506 throw INTERP_KERNEL::Exception(oss.str().c_str());
4508 std::copy(ptV,ptV+nbc,pt);
4512 throw INTERP_KERNEL::Exception(msg);
4517 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4522 for(int j=0;j<sz;j++)
4523 pt[slic.first+j*slic.second.second]=singleValV;
4528 if(sz!=(int)multiValV.size())
4530 std::ostringstream oss;
4531 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4532 throw INTERP_KERNEL::Exception(oss.str().c_str());
4534 for(int j=0;j<sz;j++)
4535 pt[slic.first+j*slic.second.second]=multiValV[j];
4540 const int *ptV=daIntTyyppV->getConstPointer();
4541 if(sz>daIntTyyppV->getNumberOfCompo())
4543 std::ostringstream oss;
4544 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4545 throw INTERP_KERNEL::Exception(oss.str().c_str());
4547 for(int j=0;j<sz;j++)
4548 pt[slic.first+j*slic.second.second]=ptV[j];
4552 throw INTERP_KERNEL::Exception(msg);
4556 throw INTERP_KERNEL::Exception(msg);
4562 class DataArrayChar : public DataArray
4565 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4566 int getHashCode() const throw(INTERP_KERNEL::Exception);
4567 bool empty() const throw(INTERP_KERNEL::Exception);
4568 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4569 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4570 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4571 char popBackSilent() throw(INTERP_KERNEL::Exception);
4572 void pack() const throw(INTERP_KERNEL::Exception);
4573 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4574 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4575 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4576 void reverse() throw(INTERP_KERNEL::Exception);
4577 void fillWithZero() throw(INTERP_KERNEL::Exception);
4578 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4579 std::string repr() const throw(INTERP_KERNEL::Exception);
4580 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4581 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4582 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4583 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4584 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4585 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4586 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4587 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4588 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4589 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4590 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4591 char front() const throw(INTERP_KERNEL::Exception);
4592 char back() const throw(INTERP_KERNEL::Exception);
4593 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4594 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4595 char *getPointer() throw(INTERP_KERNEL::Exception);
4596 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4597 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4598 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4599 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4600 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4601 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4602 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4603 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4604 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4605 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4606 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4609 int __len__() const throw(INTERP_KERNEL::Exception)
4611 if(self->isAllocated())
4613 return self->getNumberOfTuples();
4617 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4621 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4624 bool ret0=self->isEqualIfNotWhy(other,ret1);
4625 PyObject *ret=PyTuple_New(2);
4626 PyObject *ret0Py=ret0?Py_True:Py_False;
4628 PyTuple_SetItem(ret,0,ret0Py);
4629 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4633 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4636 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4637 if (!SWIG_IsOK(res1))
4640 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4641 if(size!=self->getNumberOfTuples())
4643 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4645 return self->renumber(tmp);
4649 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4651 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4652 da2->checkAllocated();
4653 int size=self->getNumberOfTuples();
4654 if(size!=self->getNumberOfTuples())
4656 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4658 return self->renumber(da2->getConstPointer());
4662 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4665 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4666 if (!SWIG_IsOK(res1))
4669 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4670 if(size!=self->getNumberOfTuples())
4672 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4674 return self->renumberR(tmp);
4678 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4680 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4681 da2->checkAllocated();
4682 int size=self->getNumberOfTuples();
4683 if(size!=self->getNumberOfTuples())
4685 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4687 return self->renumberR(da2->getConstPointer());
4691 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4694 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4695 if (!SWIG_IsOK(res1))
4698 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4699 if(size!=self->getNumberOfTuples())
4701 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4703 return self->renumberAndReduce(tmp,newNbOfTuple);
4707 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4709 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4710 da2->checkAllocated();
4711 int size=self->getNumberOfTuples();
4712 if(size!=self->getNumberOfTuples())
4714 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4716 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4720 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4722 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4723 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4724 return DataArrayChar::Aggregate(tmp);
4727 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4729 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4730 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4731 return DataArrayChar::Meld(tmp);
4736 class DataArrayByteIterator;
4738 class DataArrayByte : public DataArrayChar
4741 static DataArrayByte *New();
4742 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4743 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4744 char byteValue() const throw(INTERP_KERNEL::Exception);
4747 DataArrayByte() throw(INTERP_KERNEL::Exception)
4749 return DataArrayByte::New();
4752 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4754 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) !";
4755 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4759 if(PyInt_Check(nbOfTuples))
4761 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4763 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4766 if(PyInt_Check(nbOfComp))
4767 {//DataArrayByte.New([1,3,4,5],2,2)
4768 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4770 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4771 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4772 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4773 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4777 throw INTERP_KERNEL::Exception(msg);
4780 {//DataArrayByte.New([1,3,4],3)
4781 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4783 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4784 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4789 throw INTERP_KERNEL::Exception(msg);
4792 {// DataArrayByte.New([1,3,4])
4793 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4794 int tmpp1=-1,tmpp2=-1;
4795 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4796 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4800 else if(PyInt_Check(elt0))
4802 int nbOfTuples1=PyInt_AS_LONG(elt0);
4804 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4809 if(PyInt_Check(nbOfTuples))
4810 {//DataArrayByte.New(5,2)
4811 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4813 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4814 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4815 ret->alloc(nbOfTuples1,nbOfCompo);
4819 throw INTERP_KERNEL::Exception(msg);
4822 throw INTERP_KERNEL::Exception(msg);
4825 {//DataArrayByte.New(5)
4826 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4827 ret->alloc(nbOfTuples1,1);
4832 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4833 {//DataArrayDouble.New(numpyArray)
4834 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4838 throw INTERP_KERNEL::Exception(msg);
4841 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4843 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4846 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4848 std::ostringstream oss;
4849 self->reprQuickOverview(oss);
4853 int __int__() const throw(INTERP_KERNEL::Exception)
4855 return (int) self->byteValue();
4858 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4860 return self->iterator();
4863 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4865 return (int)self->getIJ(tupleId,compoId);
4868 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4870 return (int)self->getIJSafe(tupleId,compoId);
4873 std::string __str__() const throw(INTERP_KERNEL::Exception)
4875 return self->repr();
4878 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4880 const char *vals=self->getConstPointer();
4881 int nbOfComp=self->getNumberOfComponents();
4882 int nbOfTuples=self->getNumberOfTuples();
4883 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4886 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4889 int ival=-1; std::vector<int> ivval;
4890 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4891 std::vector<char> vals(sz);
4892 std::copy(pt,pt+sz,vals.begin());
4893 return self->presenceOfTuple(vals);
4896 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4899 int ival=-1; std::vector<int> ivval;
4900 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4901 std::vector<char> vals2(sz);
4902 std::copy(pt,pt+sz,vals2.begin());
4903 return self->presenceOfValue(vals2);
4906 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4909 int ival=-1; std::vector<int> ivval;
4910 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4911 std::vector<char> vals2(sz);
4912 std::copy(pt,pt+sz,vals2.begin());
4913 return self->findIdFirstEqual(vals2);
4916 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4919 int ival=-1; std::vector<int> ivval;
4920 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4921 std::vector<char> vals(sz);
4922 std::copy(pt,pt+sz,vals.begin());
4923 return self->findIdFirstEqualTuple(vals);
4926 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
4929 int ival=-1; std::vector<int> ivval;
4930 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
4931 std::vector<char> vals(sz);
4932 std::copy(pt,pt+sz,vals.begin());
4933 return self->findIdSequence(vals);
4936 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
4938 int sz=self->getNumberOfComponents();
4939 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
4940 self->getTuple(tupleId,tmp);
4941 PyObject *ret=PyTuple_New(sz);
4942 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
4946 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
4949 int r1=(int)self->getMaxValue(tmp);
4950 PyObject *ret=PyTuple_New(2);
4951 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4952 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4956 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
4959 int r1=(int)self->getMinValue(tmp);
4960 PyObject *ret=PyTuple_New(2);
4961 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
4962 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
4966 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4968 int nbOfCompo=self->getNumberOfComponents();
4973 if(PyInt_Check(obj))
4975 int val=(int)PyInt_AS_LONG(obj);
4976 return self->findIdFirstEqual(val);
4979 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
4982 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
4986 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
4988 int nbOfCompo=self->getNumberOfComponents();
4995 if(PyInt_Check(obj))
4997 int val=(int)PyInt_AS_LONG(obj);
4998 return self->presenceOfValue(val);
5001 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5004 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5009 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5011 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5015 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5017 self->checkAllocated();
5018 const char msg[]="Unexpected situation in __setitem__ !";
5019 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5022 std::vector<int> v1;
5024 DataArrayIntTuple *dd1=0;
5025 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5027 std::vector<int> vt1,vc1;
5028 std::pair<int, std::pair<int,int> > pt1,pc1;
5029 DataArrayInt *dt1=0,*dc1=0;
5030 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5031 MCAuto<DataArrayInt> tmp;
5039 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5042 throw INTERP_KERNEL::Exception(msg);
5051 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5054 throw INTERP_KERNEL::Exception(msg);
5063 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5066 throw INTERP_KERNEL::Exception(msg);
5075 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5078 throw INTERP_KERNEL::Exception(msg);
5087 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5090 throw INTERP_KERNEL::Exception(msg);
5099 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5102 throw INTERP_KERNEL::Exception(msg);
5111 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5114 throw INTERP_KERNEL::Exception(msg);
5123 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5126 throw INTERP_KERNEL::Exception(msg);
5135 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5138 throw INTERP_KERNEL::Exception(msg);
5147 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5150 throw INTERP_KERNEL::Exception(msg);
5159 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5162 throw INTERP_KERNEL::Exception(msg);
5171 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5174 throw INTERP_KERNEL::Exception(msg);
5183 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5186 throw INTERP_KERNEL::Exception(msg);
5195 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5198 throw INTERP_KERNEL::Exception(msg);
5207 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5210 throw INTERP_KERNEL::Exception(msg);
5219 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5222 throw INTERP_KERNEL::Exception(msg);
5227 throw INTERP_KERNEL::Exception(msg);
5234 class DataArrayByteTuple;
5236 class DataArrayByteIterator
5239 DataArrayByteIterator(DataArrayByte *da);
5240 ~DataArrayByteIterator();
5243 class DataArrayByteTuple
5246 std::string repr() const throw(INTERP_KERNEL::Exception);
5247 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5250 std::string __str__() const throw(INTERP_KERNEL::Exception)
5252 return self->repr();
5255 char __int__() const throw(INTERP_KERNEL::Exception)
5257 return self->byteValue();
5260 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5262 return self->buildDAByte(1,self->getNumberOfCompo());
5267 class DataArrayAsciiCharIterator;
5269 class DataArrayAsciiChar : public DataArrayChar
5272 static DataArrayAsciiChar *New();
5273 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5274 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5275 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5278 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5280 return DataArrayAsciiChar::New();
5283 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5285 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) !";
5286 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5290 if(PyInt_Check(nbOfTuples))
5292 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5294 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5297 if(PyInt_Check(nbOfComp))
5298 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5299 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5301 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5302 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5303 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5304 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5308 throw INTERP_KERNEL::Exception(msg);
5311 {//DataArrayAsciiChar.New([1,3,4],3)
5312 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5314 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5315 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5319 else if(PyString_Check(nbOfTuples))
5321 if(PyString_Size(nbOfTuples)!=1)
5322 throw INTERP_KERNEL::Exception(msg);
5323 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5324 std::vector<std::string> tmp;
5325 if(fillStringVector(elt0,tmp))
5326 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5328 throw INTERP_KERNEL::Exception(msg);
5330 %#if PY_VERSION_HEX >= 0x03000000
5331 else if(PyUnicode_Check(nbOfTuples))
5333 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5334 throw INTERP_KERNEL::Exception(msg);
5335 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5336 std::vector<std::string> tmp;
5337 if(fillStringVector(elt0,tmp))
5338 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5340 throw INTERP_KERNEL::Exception(msg);
5344 throw INTERP_KERNEL::Exception(msg);
5348 std::vector<std::string> tmmp;
5349 if(fillStringVector(elt0,tmmp))
5350 //DataArrayAsciiChar.New(["abc","de","fghi"])
5351 return DataArrayAsciiChar::New(tmmp,' ');
5354 // DataArrayAsciiChar.New([1,3,4])
5355 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5356 int tmpp1=-1,tmpp2=-1;
5357 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5358 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5363 else if(PyInt_Check(elt0))
5365 int nbOfTuples1=PyInt_AS_LONG(elt0);
5367 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5372 if(PyInt_Check(nbOfTuples))
5373 {//DataArrayAsciiChar.New(5,2)
5374 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5376 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5377 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5378 ret->alloc(nbOfTuples1,nbOfCompo);
5382 throw INTERP_KERNEL::Exception(msg);
5385 throw INTERP_KERNEL::Exception(msg);
5388 {//DataArrayAsciiChar.New(5)
5389 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5390 ret->alloc(nbOfTuples1,1);
5395 throw INTERP_KERNEL::Exception(msg);
5398 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5400 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5403 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5405 std::ostringstream oss;
5406 self->reprQuickOverview(oss);
5410 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5412 return self->iterator();
5415 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5417 char tmp[2]; tmp[1]='\0';
5418 tmp[0]=self->getIJ(tupleId,compoId);
5419 return std::string(tmp);
5422 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5424 char tmp[2]; tmp[1]='\0';
5425 tmp[0]=self->getIJSafe(tupleId,compoId);
5426 return std::string(tmp);
5429 std::string __str__() const throw(INTERP_KERNEL::Exception)
5431 return self->repr();
5434 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5436 const char *vals=self->getConstPointer();
5437 int nbOfComp=self->getNumberOfComponents();
5438 int nbOfTuples=self->getNumberOfTuples();
5439 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5442 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5444 if(PyString_Check(tupl))
5446 Py_ssize_t sz=PyString_Size(tupl);
5447 std::vector<char> vals(sz);
5448 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5449 return self->presenceOfTuple(vals);
5451 %#if PY_VERSION_HEX >= 0x03000000
5452 else if(PyUnicode_Check(tupl))
5454 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5455 std::vector<char> vals(sz);
5456 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5457 return self->presenceOfTuple(vals);
5461 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5464 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5466 if(PyString_Check(vals))
5468 Py_ssize_t sz=PyString_Size(vals);
5469 std::vector<char> vals2(sz);
5470 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5471 return self->presenceOfValue(vals2);
5473 %#if PY_VERSION_HEX >= 0x03000000
5474 if(PyUnicode_Check(vals))
5476 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5477 std::vector<char> vals2(sz);
5478 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5479 return self->presenceOfValue(vals2);
5483 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5486 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5488 if(PyString_Check(vals))
5490 Py_ssize_t sz=PyString_Size(vals);
5491 std::vector<char> vals2(sz);
5492 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5493 return self->findIdFirstEqual(vals2);
5495 %#if PY_VERSION_HEX >= 0x03000000
5496 if(PyUnicode_Check(vals))
5498 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5499 std::vector<char> vals2(sz);
5500 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5501 return self->findIdFirstEqual(vals2);
5505 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5508 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5510 if(PyString_Check(tupl))
5512 Py_ssize_t sz=PyString_Size(tupl);
5513 std::vector<char> vals(sz);
5514 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5515 return self->findIdFirstEqualTuple(vals);
5517 %#if PY_VERSION_HEX >= 0x03000000
5518 if(PyUnicode_Check(tupl))
5520 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5521 std::vector<char> vals(sz);
5522 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5523 return self->findIdFirstEqualTuple(vals);
5527 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5530 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5532 if(PyString_Check(strOrListOfInt))
5534 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5535 std::vector<char> vals(sz);
5536 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5537 return self->findIdSequence(vals);
5539 %#if PY_VERSION_HEX >= 0x03000000
5540 else if(PyUnicode_Check(strOrListOfInt))
5542 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5543 std::vector<char> vals(sz);
5544 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5545 return self->findIdSequence(vals);
5549 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5552 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5554 int sz=self->getNumberOfComponents();
5555 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5556 self->getTuple(tupleId,tmp);
5557 return PyString_FromString(tmp);
5560 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5563 char tmp2[2]; tmp2[1]='\0';
5564 tmp2[0]=self->getMaxValue(tmp);
5565 PyObject *ret=PyTuple_New(2);
5566 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5567 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5571 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5574 char tmp2[2]; tmp2[1]='\0';
5575 tmp2[0]=self->getMinValue(tmp);
5576 PyObject *ret=PyTuple_New(2);
5577 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5578 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5582 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5584 int nbOfCompo=self->getNumberOfComponents();
5589 if(PyString_Check(obj))
5591 Py_ssize_t sz=PyString_Size(obj);
5592 char *pt=PyString_AsString(obj);
5594 return self->findIdFirstEqual(pt[0]);
5596 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5598 %#if PY_VERSION_HEX >= 0x03000000
5599 if(PyUnicode_Check(obj))
5602 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5604 return self->findIdFirstEqual(pt[0]);
5606 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5610 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5613 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5617 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5619 int nbOfCompo=self->getNumberOfComponents();
5626 if(PyString_Check(obj))
5628 Py_ssize_t sz=PyString_Size(obj);
5629 char *pt=PyString_AsString(obj);
5631 return self->presenceOfValue(pt[0]);
5633 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5635 %#if PY_VERSION_HEX >= 0x03000000
5636 if(PyUnicode_Check(obj))
5639 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5641 return self->presenceOfValue(pt[0]);
5643 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5647 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5650 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5654 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5657 std::vector<int> stdvecTyyppArr;
5658 std::pair<int, std::pair<int,int> > sTyyppArr;
5659 MEDCoupling::DataArrayInt *daIntTyypp=0;
5660 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5664 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5666 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5668 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5670 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5672 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5676 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5678 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.";
5680 std::vector<int> stdvecTyyppArr;
5681 std::pair<int, std::pair<int,int> > sTyyppArr;
5682 MEDCoupling::DataArrayInt *daIntTyypp=0;
5683 int nbOfCompo=self->getNumberOfComponents();
5684 int nbOfTuples=self->getNumberOfTuples();
5685 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5687 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5688 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5697 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5703 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5704 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5707 //value vector<string>
5710 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5711 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5714 //value DataArrayChar
5717 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5721 throw INTERP_KERNEL::Exception(msg);
5725 {//obj list-tuple[int]
5731 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5737 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5738 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5741 //value vector<string>
5744 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5745 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5748 //value DataArrayChar
5751 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5755 throw INTERP_KERNEL::Exception(msg);
5766 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5772 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5773 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5776 //value vector<string>
5779 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5780 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5783 //value DataArrayChar
5786 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5790 throw INTERP_KERNEL::Exception(msg);
5801 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5807 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5808 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5811 //value vector<string>
5814 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5815 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5818 //value DataArrayChar
5821 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5825 throw INTERP_KERNEL::Exception(msg);
5830 throw INTERP_KERNEL::Exception(msg);
5836 class DataArrayAsciiCharTuple;
5838 class DataArrayAsciiCharIterator
5841 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5842 ~DataArrayAsciiCharIterator();
5847 DataArrayAsciiCharTuple *ret=self->nextt();
5849 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5852 PyErr_SetString(PyExc_StopIteration,"No more data.");
5859 class DataArrayAsciiCharTuple
5862 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5863 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5866 std::string __str__() const throw(INTERP_KERNEL::Exception)
5868 return self->repr();
5871 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5873 return self->buildDAAsciiChar(1,self->getNumberOfCompo());
5880 def MEDCouplingStdReduceFunct(cls,params):
5882 ret=object.__new__(cls)
5887 def MEDCouplingDataArrayDoubleReduce(self):
5888 if not MEDCouplingHasNumPyBindings():
5889 raise InterpKernelException("PyWrap of DataArrayDouble.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5890 return MEDCouplingStdReduceFunct,(DataArrayDouble,((self.toNumPyArray(),),(self.__getstate__()),))
5892 def MEDCouplingDataArrayIntReduce(self):
5893 if not MEDCouplingHasNumPyBindings():
5894 raise InterpKernelException("PyWrap of DataArrayInt.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5895 return MEDCouplingStdReduceFunct,(DataArrayInt,((self.toNumPyArray(),),(self.__getstate__()),))
5897 def MEDCouplingDataArrayByteReduce(self):
5898 if not MEDCouplingHasNumPyBindings():
5899 raise InterpKernelException("PyWrap of DataArrayByte.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5900 return MEDCouplingStdReduceFunct,(DataArrayByte,((self.toNumPyArray(),),(self.__getstate__()),))
5902 def MEDCouplingDataArrayFloatReduce(self):
5903 if not MEDCouplingHasNumPyBindings():
5904 raise InterpKernelException("PyWrap of DataArrayFloat.__reduce__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !")
5905 return MEDCouplingStdReduceFunct,(DataArrayFloat,((self.toNumPyArray(),),(self.__getstate__()),))