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");
805 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
807 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayFloat");
810 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
813 if(!self->isAllocated())
814 throw INTERP_KERNEL::Exception("PyWrap of DataArrayFloat.__getnewargs__ : self is not allocated !");
815 PyObject *ret(PyTuple_New(1));
816 PyObject *ret0(PyDict_New());
817 PyObject *numpyArryObj(MEDCoupling_DataArrayFloat_toNumPyArray(self));
818 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
819 PyObject *tmp1(PyInt_FromLong(0));
820 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
821 PyTuple_SetItem(ret,0,ret0);
825 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
831 class DataArrayFloatTuple;
833 class DataArrayFloatIterator
836 DataArrayFloatIterator(DataArrayFloat *da);
837 ~DataArrayFloatIterator();
842 DataArrayFloatTuple *ret=self->nextt();
844 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayFloatTuple,SWIG_POINTER_OWN|0);
847 PyErr_SetString(PyExc_StopIteration,"No more data.");
854 class DataArrayFloatTuple
857 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
858 DataArrayFloat *buildDAFloat(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
861 std::string __str__() const throw(INTERP_KERNEL::Exception)
866 float __float__() const throw(INTERP_KERNEL::Exception)
868 return self->floatValue();
871 DataArrayFloat *buildDAFloat() throw(INTERP_KERNEL::Exception)
873 return self->buildDAFloat(1,self->getNumberOfCompo());
876 /*PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
878 MCAuto<DataArrayFloat> ret=self->buildDAFloat(1,self->getNumberOfCompo());
879 MEDCoupling_DataArrayFloat____imul___(ret,0,obj);
880 Py_XINCREF(trueSelf);
884 PyObject *__len__() throw(INTERP_KERNEL::Exception)
886 return PyInt_FromLong(self->getNumberOfCompo());
892 class DataArrayDoubleIterator;
894 class DataArrayDouble : public DataArray
897 static DataArrayDouble *New();
898 double doubleValue() const throw(INTERP_KERNEL::Exception);
899 bool empty() const throw(INTERP_KERNEL::Exception);
900 void aggregate(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
901 DataArrayDouble *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
902 void deepCopyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
903 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
904 void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
905 double popBackSilent() throw(INTERP_KERNEL::Exception);
906 void pack() const throw(INTERP_KERNEL::Exception);
907 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
908 void fillWithZero() throw(INTERP_KERNEL::Exception);
909 void fillWithValue(double val) throw(INTERP_KERNEL::Exception);
910 void iota(double init=0.) throw(INTERP_KERNEL::Exception);
911 bool isUniform(double val, double eps) const throw(INTERP_KERNEL::Exception);
912 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
913 void reverse() throw(INTERP_KERNEL::Exception);
914 void checkMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
915 bool isMonotonic(bool increasing, double eps) const throw(INTERP_KERNEL::Exception);
916 std::string repr() const throw(INTERP_KERNEL::Exception);
917 std::string reprZip() const throw(INTERP_KERNEL::Exception);
918 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
919 bool isEqual(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
920 bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception);
921 DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
922 DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception);
923 DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
924 void transpose() throw(INTERP_KERNEL::Exception);
925 DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
926 void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
927 DataArrayDouble *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
928 DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const throw(INTERP_KERNEL::Exception);
929 DataArrayInt *findClosestTupleId(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
930 DataArrayInt *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const throw(INTERP_KERNEL::Exception);
931 void setPartOfValues1(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
932 void setPartOfValuesSimple1(double a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
933 void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
934 double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
935 double front() const throw(INTERP_KERNEL::Exception);
936 double back() const throw(INTERP_KERNEL::Exception);
937 double getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
938 void setIJ(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
939 void setIJSilent(int tupleId, int compoId, double newVal) throw(INTERP_KERNEL::Exception);
940 double *getPointer() throw(INTERP_KERNEL::Exception);
941 void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
942 DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
943 void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
944 double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
945 double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
946 double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
947 double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
948 int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
949 double getAverageValue() const throw(INTERP_KERNEL::Exception);
950 double norm2() const throw(INTERP_KERNEL::Exception);
951 double normMax() const throw(INTERP_KERNEL::Exception);
952 double normMin() const throw(INTERP_KERNEL::Exception);
953 double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
954 DataArrayDouble *fromPolarToCart() const throw(INTERP_KERNEL::Exception);
955 DataArrayDouble *fromCylToCart() const throw(INTERP_KERNEL::Exception);
956 DataArrayDouble *fromSpherToCart() const throw(INTERP_KERNEL::Exception);
957 DataArrayDouble *fromCartToPolar() const throw(INTERP_KERNEL::Exception);
958 DataArrayDouble *fromCartToCyl() const throw(INTERP_KERNEL::Exception);
959 DataArrayDouble *fromCartToSpher() const throw(INTERP_KERNEL::Exception);
960 DataArrayDouble *cartesianize(MEDCouplingAxisType atOfThis) const throw(INTERP_KERNEL::Exception);
961 DataArrayDouble *doublyContractedProduct() const throw(INTERP_KERNEL::Exception);
962 DataArrayDouble *determinant() const throw(INTERP_KERNEL::Exception);
963 DataArrayDouble *eigenValues() const throw(INTERP_KERNEL::Exception);
964 DataArrayDouble *eigenVectors() const throw(INTERP_KERNEL::Exception);
965 DataArrayDouble *inverse() const throw(INTERP_KERNEL::Exception);
966 DataArrayDouble *trace() const throw(INTERP_KERNEL::Exception);
967 DataArrayDouble *deviator() const throw(INTERP_KERNEL::Exception);
968 DataArrayDouble *magnitude() const throw(INTERP_KERNEL::Exception);
969 DataArrayDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
970 DataArrayDouble *sumPerTuple() const throw(INTERP_KERNEL::Exception);
971 DataArrayDouble *buildEuclidianDistanceDenseMatrix() const throw(INTERP_KERNEL::Exception);
972 DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception);
973 void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
974 void abs() throw(INTERP_KERNEL::Exception);
975 DataArrayDouble *computeAbs() const throw(INTERP_KERNEL::Exception);
976 void applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception);
977 void applyLin(double a, double b) throw(INTERP_KERNEL::Exception);
978 void applyInv(double numerator) throw(INTERP_KERNEL::Exception);
979 void applyPow(double val) throw(INTERP_KERNEL::Exception);
980 void applyRPow(double val) throw(INTERP_KERNEL::Exception);
981 DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
982 DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
983 DataArrayDouble *applyFunc(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
984 DataArrayDouble *applyFunc(const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
985 void applyFuncOnThis(const std::string& func, bool isSafe=true) throw(INTERP_KERNEL::Exception);
986 DataArrayDouble *applyFuncCompo(int nbOfComp, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
987 DataArrayDouble *applyFuncNamedCompo(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func, bool isSafe=true) const throw(INTERP_KERNEL::Exception);
988 void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
989 void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
990 DataArrayInt *findIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
991 DataArrayInt *findIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
992 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
993 static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
994 static DataArrayDouble *Meld(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
995 static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
996 static DataArrayDouble *CrossProduct(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
997 static DataArrayDouble *Max(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
998 static DataArrayDouble *Min(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
999 static DataArrayDouble *Add(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
1000 void addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
1001 static DataArrayDouble *Substract(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
1002 void substractEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
1003 static DataArrayDouble *Multiply(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
1004 void multiplyEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
1005 static DataArrayDouble *Divide(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
1006 void divideEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
1007 static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
1008 void powEqual(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception);
1009 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
1010 MCAuto<DataArrayInt> findIdsGreaterThan(double val) const throw(INTERP_KERNEL::Exception);
1011 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(double val) const throw(INTERP_KERNEL::Exception);
1012 MCAuto<DataArrayInt> findIdsLowerThan(double val) const throw(INTERP_KERNEL::Exception);
1013 MCAuto<DataArrayInt> convertToIntArr() const throw(INTERP_KERNEL::Exception);
1014 MCAuto<DataArrayDouble> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
1015 MCAuto<DataArrayDouble> cumSum() const throw(INTERP_KERNEL::Exception);
1016 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
1019 DataArrayDouble() throw(INTERP_KERNEL::Exception)
1021 return DataArrayDouble::New();
1024 static DataArrayDouble *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1026 return DataArrayT_New<double>(elt0,nbOfTuples,elt2);
1029 DataArrayDouble(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *elt2=0) throw(INTERP_KERNEL::Exception)
1031 return MEDCoupling_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
1034 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
1037 std::vector<double> bb;
1039 const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
1040 const double *tmp=convertObjToPossibleCpp5_SingleCompo(li,sw,val,bb,msg,true,nbTuples);
1041 self->pushBackValsSilent(tmp,tmp+nbTuples);
1044 std::string __repr__() const throw(INTERP_KERNEL::Exception)
1046 std::ostringstream oss;
1047 self->reprQuickOverview(oss);
1051 std::string __str__() const throw(INTERP_KERNEL::Exception)
1053 return self->reprNotTooLong();
1056 double __float__() const throw(INTERP_KERNEL::Exception)
1058 return self->doubleValue();
1061 int __len__() const throw(INTERP_KERNEL::Exception)
1063 if(self->isAllocated())
1065 return self->getNumberOfTuples();
1069 throw INTERP_KERNEL::Exception("DataArrayDouble::__len__ : Instance is NOT allocated !");
1073 DataArrayDoubleIterator *__iter__() throw(INTERP_KERNEL::Exception)
1075 return self->iterator();
1078 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
1080 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 !";
1081 if(PyList_Check(li) || PyTuple_Check(li))
1085 if(PyInt_Check(nbOfTuples))
1087 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
1089 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive set of allocated memory !");
1092 if(PyInt_Check(nbOfComp))
1093 {//DataArrayDouble.setValues([1.,3.,4.,5.],2,2)
1094 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
1096 throw INTERP_KERNEL::Exception("DataArrayDouble::setValues : should be a positive number of components !");
1097 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,nbOfCompo);
1098 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1101 throw INTERP_KERNEL::Exception(msg);
1104 {//DataArrayDouble.setValues([1.,3.,4.],3)
1106 std::vector<double> tmp=fillArrayWithPyListDbl2(li,nbOfTuples1,tmpp1);
1107 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1111 throw INTERP_KERNEL::Exception(msg);
1114 {// DataArrayDouble.setValues([1.,3.,4.])
1115 int tmpp1=-1,tmpp2=-1;
1116 std::vector<double> tmp=fillArrayWithPyListDbl2(li,tmpp1,tmpp2);
1117 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
1121 throw INTERP_KERNEL::Exception(msg);
1124 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
1126 const double *vals(self->begin());
1127 return convertDblArrToPyList<double>(vals,self->getNbOfElems());
1131 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
1133 return ToNumPyArray<DataArrayDouble,double>(self,NPY_DOUBLE,"DataArrayDouble");
1137 PyObject *isEqualIfNotWhy(const DataArrayDouble& other, double prec) const throw(INTERP_KERNEL::Exception)
1140 bool ret0=self->isEqualIfNotWhy(other,prec,ret1);
1141 PyObject *ret=PyTuple_New(2);
1142 PyObject *ret0Py=ret0?Py_True:Py_False;
1144 PyTuple_SetItem(ret,0,ret0Py);
1145 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
1149 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
1151 const double *vals(self->begin());
1152 int nbOfComp(self->getNumberOfComponents()),nbOfTuples(self->getNumberOfTuples());
1153 return convertDblArrToPyListOfTuple<double>(vals,nbOfComp,nbOfTuples);
1156 DataArrayDouble *symmetry3DPlane(PyObject *point, PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1158 const char msg[]="Python wrap of DataArrayDouble::symmetry3DPlane : ";
1160 DataArrayDouble *a,*a2;
1161 DataArrayDoubleTuple *aa,*aa2;
1162 std::vector<double> bb,bb2;
1164 const double *centerPtr(convertObjToPossibleCpp5_Safe(point,sw,val,a,aa,bb,msg,1,3,true));
1165 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val2,a2,aa2,bb2,msg,1,3,true));
1166 MCAuto<DataArrayDouble> ret(self->symmetry3DPlane(centerPtr,vectorPtr));
1170 static PyObject *GiveBaseForPlane(PyObject *normalVector) throw(INTERP_KERNEL::Exception)
1172 const char msg[]="Python wrap of DataArrayDouble::GiveBaseForPlane : ";
1174 DataArrayDouble *a,*a2;
1175 DataArrayDoubleTuple *aa,*aa2;
1176 std::vector<double> bb,bb2;
1178 const double *vectorPtr(convertObjToPossibleCpp5_Safe(normalVector,sw,val,a,aa,bb,msg,1,3,true));
1180 DataArrayDouble::GiveBaseForPlane(vectorPtr,res);
1181 return convertDblArrToPyListOfTuple<double>(res,3,3);
1184 DataArrayDouble *fromCartToCylGiven(const DataArrayDouble *coords, PyObject *center, PyObject *vector) const
1186 const char msg[]="Python wrap of DataArrayDouble::fromCartToCylGiven : ";
1188 DataArrayDouble *a,*a2;
1189 DataArrayDoubleTuple *aa,*aa2;
1190 std::vector<double> bb,bb2;
1192 const double *centerPtr=convertObjToPossibleCpp5_Safe(center,sw,val,a,aa,bb,msg,1,3,true);
1193 const double *vectorPtr=convertObjToPossibleCpp5_Safe(vector,sw,val2,a2,aa2,bb2,msg,1,3,true);
1194 return self->fromCartToCylGiven(coords,centerPtr,vectorPtr);
1197 DataArrayDouble *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
1200 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1201 if (!SWIG_IsOK(res1))
1204 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1205 if(size!=self->getNumberOfTuples())
1207 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1209 return self->renumber(tmp);
1213 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1215 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1216 da2->checkAllocated();
1217 int size=self->getNumberOfTuples();
1218 if(size!=self->getNumberOfTuples())
1220 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1222 return self->renumber(da2->getConstPointer());
1226 DataArrayDouble *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
1229 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1230 if (!SWIG_IsOK(res1))
1233 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1234 if(size!=self->getNumberOfTuples())
1236 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1238 return self->renumberR(tmp);
1242 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1244 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1245 da2->checkAllocated();
1246 int size=self->getNumberOfTuples();
1247 if(size!=self->getNumberOfTuples())
1249 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1251 return self->renumberR(da2->getConstPointer());
1255 DataArrayDouble *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
1258 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
1259 if (!SWIG_IsOK(res1))
1262 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
1263 if(size!=self->getNumberOfTuples())
1265 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1267 return self->renumberAndReduce(tmp,newNbOfTuple);
1271 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
1273 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
1274 da2->checkAllocated();
1275 int size=self->getNumberOfTuples();
1276 if(size!=self->getNumberOfTuples())
1278 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
1280 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
1284 PyObject *minimalDistanceTo(const DataArrayDouble *other) const throw(INTERP_KERNEL::Exception)
1286 int thisTupleId,otherTupleId;
1287 double r0=self->minimalDistanceTo(other,thisTupleId,otherTupleId);
1288 PyObject *ret=PyTuple_New(3);
1289 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r0));
1290 PyTuple_SetItem(ret,1,PyInt_FromLong(thisTupleId));
1291 PyTuple_SetItem(ret,2,PyInt_FromLong(otherTupleId));
1295 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
1298 double r1=self->getMaxValue(tmp);
1299 PyObject *ret=PyTuple_New(2);
1300 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1301 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1305 PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
1308 double r1=self->getMaxValue2(tmp);
1309 PyObject *ret=PyTuple_New(2);
1310 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1311 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1315 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
1318 double r1=self->getMinValue(tmp);
1319 PyObject *ret=PyTuple_New(2);
1320 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1321 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
1325 PyObject *getMinValue2() const throw(INTERP_KERNEL::Exception)
1328 double r1=self->getMinValue2(tmp);
1329 PyObject *ret=PyTuple_New(2);
1330 PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
1331 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1335 PyObject *getMinMaxPerComponent() const throw(INTERP_KERNEL::Exception)
1337 int nbOfCompo(self->getNumberOfComponents());
1338 INTERP_KERNEL::AutoPtr<double> tmp(new double[2*nbOfCompo]);
1339 self->getMinMaxPerComponent(tmp);
1340 PyObject *ret=convertDblArrToPyListOfTuple<double>(tmp,2,nbOfCompo);
1344 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
1346 int sz=self->getNumberOfComponents();
1347 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1348 self->accumulate(tmp);
1349 return convertDblArrToPyList<double>(tmp,sz);
1352 DataArrayDouble *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
1355 std::vector<int> val2;
1356 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
1357 return self->accumulatePerChunck(bg,bg+sz);
1360 PyObject *findCommonTuples(double prec, int limitNodeId=-1) const throw(INTERP_KERNEL::Exception)
1362 DataArrayInt *comm, *commIndex;
1363 self->findCommonTuples(prec,limitNodeId,comm,commIndex);
1364 PyObject *res = PyList_New(2);
1365 PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(comm),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1366 PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(commIndex),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1370 PyObject *distanceToTuple(PyObject *tuple) const throw(INTERP_KERNEL::Exception)
1374 DataArrayDoubleTuple *aa;
1375 std::vector<double> bb;
1377 int tupleId=-1,nbOfCompo=self->getNumberOfComponents();
1378 const double *pt=convertObjToPossibleCpp5_Safe(tuple,sw,val,a,aa,bb,"Python wrap of DataArrayDouble::distanceToTuple",1,nbOfCompo,true);
1380 double ret0=self->distanceToTuple(pt,pt+nbOfCompo,tupleId);
1381 PyObject *ret=PyTuple_New(2);
1382 PyTuple_SetItem(ret,0,PyFloat_FromDouble(ret0));
1383 PyTuple_SetItem(ret,1,PyInt_FromLong(tupleId));
1387 void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
1389 std::vector<int> tmp;
1390 convertPyToNewIntArr3(li,tmp);
1391 self->setSelectedComponents(a,tmp);
1394 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
1396 std::vector< MCAuto<DataArrayDouble> > retCpp(self->explodeComponents());
1397 std::size_t sz(retCpp.size());
1398 PyObject *res(PyList_New(sz));
1399 for(std::size_t i=0;i<sz;i++)
1400 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1404 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
1406 int sz=self->getNumberOfComponents();
1407 INTERP_KERNEL::AutoPtr<double> tmp=new double[sz];
1408 self->getTuple(tupleId,tmp);
1409 return convertDblArrToPyList<double>(tmp,sz);
1412 static DataArrayDouble *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
1414 std::vector<const DataArrayDouble *> tmp;
1415 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1416 return DataArrayDouble::Aggregate(tmp);
1419 static DataArrayDouble *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
1421 std::vector<const DataArrayDouble *> tmp;
1422 convertFromPyObjVectorOfObj<const DataArrayDouble *>(li,SWIGTYPE_p_MEDCoupling__DataArrayDouble,"DataArrayDouble",tmp);
1423 return DataArrayDouble::Meld(tmp);
1426 PyObject *computeTupleIdsNearTuples(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
1430 DataArrayDoubleTuple *aa;
1431 std::vector<double> bb;
1433 int nbComp=self->getNumberOfComponents(),nbTuples=-1;
1434 const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
1435 const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
1436 MCAuto<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
1437 DataArrayInt *c=0,*cI=0;
1438 self->computeTupleIdsNearTuples(inpu,eps,c,cI);
1439 PyObject *ret=PyTuple_New(2);
1440 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1441 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1445 PyObject *areIncludedInMe(const DataArrayDouble *other, double prec) const throw(INTERP_KERNEL::Exception)
1447 DataArrayInt *ret1=0;
1448 bool ret0=self->areIncludedInMe(other,prec,ret1);
1449 PyObject *ret=PyTuple_New(2);
1450 PyObject *ret0Py=ret0?Py_True:Py_False;
1452 PyTuple_SetItem(ret,0,ret0Py);
1453 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1457 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1459 return DataArrayT__getitem<double>(self,obj);
1462 DataArrayDouble *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
1464 return DataArrayT__setitem__<double>(self,obj,value);
1467 DataArrayDouble *__neg__() const throw(INTERP_KERNEL::Exception)
1469 return self->negate();
1472 PyObject *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1474 const char msg[]="Unexpected situation in DataArrayDouble.__add__ !";
1477 DataArrayDoubleTuple *aa;
1478 std::vector<double> bb;
1481 #ifndef WITHOUT_AUTOFIELD
1483 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1485 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1488 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1489 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___radd__Impl(other,tmp);
1491 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1494 throw INTERP_KERNEL::Exception(msg);
1498 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1503 MCAuto<DataArrayDouble> ret=self->deepCopy();
1504 ret->applyLin(1.,val);
1505 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1509 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1513 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1514 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1518 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1519 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Add(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1522 throw INTERP_KERNEL::Exception(msg);
1526 DataArrayDouble *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1528 const char msg[]="Unexpected situation in __radd__ !";
1531 DataArrayDoubleTuple *aa;
1532 std::vector<double> bb;
1534 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1539 MCAuto<DataArrayDouble> ret=self->deepCopy();
1540 ret->applyLin(1.,val);
1545 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1546 return DataArrayDouble::Add(self,aaa);
1550 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1551 return DataArrayDouble::Add(self,aaa);
1554 throw INTERP_KERNEL::Exception(msg);
1558 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1560 return DataArrayT_iadd<double>(trueSelf,obj,self);
1563 PyObject *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1565 const char msg[]="Unexpected situation in __sub__ !";
1568 DataArrayDoubleTuple *aa;
1569 std::vector<double> bb;
1572 #ifndef WITHOUT_AUTOFIELD
1574 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1576 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1579 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1580 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rsub__Impl(other,tmp);
1582 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1585 throw INTERP_KERNEL::Exception(msg);
1589 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1594 MCAuto<DataArrayDouble> ret=self->deepCopy();
1595 ret->applyLin(1.,-val);
1596 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1600 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1604 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1605 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1609 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1610 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Substract(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1613 throw INTERP_KERNEL::Exception(msg);
1617 DataArrayDouble *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1619 const char msg[]="Unexpected situation in __rsub__ !";
1622 DataArrayDoubleTuple *aa;
1623 std::vector<double> bb;
1625 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1630 MCAuto<DataArrayDouble> ret=self->deepCopy();
1631 ret->applyLin(-1.,val);
1636 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1637 return DataArrayDouble::Substract(aaa,self);
1641 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1642 return DataArrayDouble::Substract(aaa,self);
1645 throw INTERP_KERNEL::Exception(msg);
1649 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1651 return DataArrayT_isub<double>(trueSelf,obj,self);
1654 PyObject *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1656 const char msg[]="Unexpected situation in __mul__ !";
1659 DataArrayDoubleTuple *aa;
1660 std::vector<double> bb;
1663 #ifndef WITHOUT_AUTOFIELD
1665 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1667 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1670 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1671 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rmul__Impl(other,tmp);
1673 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1676 throw INTERP_KERNEL::Exception(msg);
1680 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1685 MCAuto<DataArrayDouble> ret=self->deepCopy();
1686 ret->applyLin(val,0.);
1687 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1691 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1695 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1696 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1700 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1701 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Multiply(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1704 throw INTERP_KERNEL::Exception(msg);
1708 DataArrayDouble *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1710 return DataArrayFPT_rmul<double>(self,obj);
1713 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1715 return DataArrayT_imul<double>(trueSelf,obj,self);
1718 PyObject *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1720 const char msg[]="Unexpected situation in __div__ !";
1723 DataArrayDoubleTuple *aa;
1724 std::vector<double> bb;
1727 #ifndef WITHOUT_AUTOFIELD
1729 if(SWIG_IsOK(SWIG_ConvertPtr(obj,&argp,SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble,0|0)))
1731 MEDCouplingFieldDouble *other=reinterpret_cast< MEDCoupling::MEDCouplingFieldDouble * >(argp);
1734 PyObject *tmp=SWIG_NewPointerObj(SWIG_as_voidptr(self),SWIGTYPE_p_MEDCoupling__DataArrayDouble, 0 | 0 );
1735 MCAuto<MEDCouplingFieldDouble> ret=MEDCoupling_MEDCouplingFieldDouble___rdiv__Impl(other,tmp);
1737 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 );
1740 throw INTERP_KERNEL::Exception(msg);
1744 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1750 throw INTERP_KERNEL::Exception("DataArrayDouble::__div__ : trying to divide by zero !");
1751 MCAuto<DataArrayDouble> ret=self->deepCopy();
1752 ret->applyLin(1/val,0.);
1753 return SWIG_NewPointerObj(SWIG_as_voidptr(ret.retn()),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1757 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,a)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1761 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1762 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1766 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1767 return SWIG_NewPointerObj(SWIG_as_voidptr(DataArrayDouble::Divide(self,aaa)),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 );
1770 throw INTERP_KERNEL::Exception(msg);
1774 DataArrayDouble *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1776 const char msg[]="Unexpected situation in __rdiv__ !";
1779 DataArrayDoubleTuple *aa;
1780 std::vector<double> bb;
1782 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1787 MCAuto<DataArrayDouble> ret=self->deepCopy();
1793 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1794 return DataArrayDouble::Divide(aaa,self);
1798 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1799 return DataArrayDouble::Divide(aaa,self);
1802 throw INTERP_KERNEL::Exception(msg);
1806 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1808 return DataArrayT_idiv<double>(trueSelf,obj,self);
1811 DataArrayDouble *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1813 const char msg[]="Unexpected situation in __pow__ !";
1816 DataArrayDoubleTuple *aa;
1817 std::vector<double> bb;
1819 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1824 MCAuto<DataArrayDouble> ret=self->deepCopy();
1830 return DataArrayDouble::Pow(self,a);
1834 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1835 return DataArrayDouble::Pow(self,aaa);
1839 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1840 return DataArrayDouble::Pow(self,aaa);
1843 throw INTERP_KERNEL::Exception(msg);
1847 DataArrayDouble *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
1849 const char msg[]="Unexpected situation in __rpow__ !";
1852 DataArrayDoubleTuple *aa;
1853 std::vector<double> bb;
1855 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1860 MCAuto<DataArrayDouble> ret=self->deepCopy();
1861 ret->applyRPow(val);
1866 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1867 return DataArrayDouble::Pow(aaa,self);
1871 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1872 return DataArrayDouble::Pow(aaa,self);
1875 throw INTERP_KERNEL::Exception(msg);
1879 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
1881 const char msg[]="Unexpected situation in __ipow__ !";
1884 DataArrayDoubleTuple *aa;
1885 std::vector<double> bb;
1887 convertDoubleStarLikePyObjToCpp_2(obj,sw,val,a,aa,bb);
1892 self->applyPow(val);
1893 Py_XINCREF(trueSelf);
1899 Py_XINCREF(trueSelf);
1904 MCAuto<DataArrayDouble> aaa=aa->buildDADouble(1,self->getNumberOfComponents());
1905 self->powEqual(aaa);
1906 Py_XINCREF(trueSelf);
1911 MCAuto<DataArrayDouble> aaa=DataArrayDouble::New(); aaa->useArray(&bb[0],false,CPP_DEALLOC,1,(int)bb.size());
1912 self->powEqual(aaa);
1913 Py_XINCREF(trueSelf);
1917 throw INTERP_KERNEL::Exception(msg);
1921 PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
1923 DataArrayInt *c=0,*cI=0;
1925 self->computeTupleIdsNearTuples(other,eps,c,cI);
1926 PyObject *ret=PyTuple_New(2);
1927 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1928 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1932 PyObject *maxPerTupleWithCompoId() const throw(INTERP_KERNEL::Exception)
1934 DataArrayInt *ret1=0;
1935 DataArrayDouble *ret0=self->maxPerTupleWithCompoId(ret1);
1936 PyObject *ret=PyTuple_New(2);
1937 PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
1938 PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
1943 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
1945 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayDouble");
1948 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
1951 if(!self->isAllocated())
1952 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : self is not allocated !");
1953 PyObject *ret(PyTuple_New(1));
1954 PyObject *ret0(PyDict_New());
1955 PyObject *numpyArryObj(MEDCoupling_DataArrayDouble_toNumPyArray(self));
1956 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
1957 PyObject *tmp1(PyInt_FromLong(0));
1958 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
1959 PyTuple_SetItem(ret,0,ret0);
1963 throw INTERP_KERNEL::Exception("PyWrap of DataArrayDouble.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
1969 class DataArrayDoubleTuple;
1971 class DataArrayDoubleIterator
1974 DataArrayDoubleIterator(DataArrayDouble *da);
1975 ~DataArrayDoubleIterator();
1980 DataArrayDoubleTuple *ret=self->nextt();
1982 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayDoubleTuple,SWIG_POINTER_OWN|0);
1985 PyErr_SetString(PyExc_StopIteration,"No more data.");
1992 class DataArrayDoubleTuple
1995 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
1996 DataArrayDouble *buildDADouble(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
1999 std::string __str__() const throw(INTERP_KERNEL::Exception)
2001 return self->repr();
2004 double __float__() const throw(INTERP_KERNEL::Exception)
2006 return self->doubleValue();
2009 DataArrayDouble *buildDADouble() throw(INTERP_KERNEL::Exception)
2011 return self->buildDADouble(1,self->getNumberOfCompo());
2014 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2016 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2017 MEDCoupling_DataArrayDouble____iadd___(ret,0,obj);
2018 Py_XINCREF(trueSelf);
2022 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2024 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2025 MEDCoupling_DataArrayDouble____isub___(ret,0,obj);
2026 Py_XINCREF(trueSelf);
2030 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2032 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2033 MEDCoupling_DataArrayDouble____imul___(ret,0,obj);
2034 Py_XINCREF(trueSelf);
2038 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
2040 MCAuto<DataArrayDouble> ret=self->buildDADouble(1,self->getNumberOfCompo());
2041 MEDCoupling_DataArrayDouble____idiv___(ret,0,obj);
2042 Py_XINCREF(trueSelf);
2046 PyObject *__len__() throw(INTERP_KERNEL::Exception)
2048 return PyInt_FromLong(self->getNumberOfCompo());
2051 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
2053 const char msg2[]="DataArrayDoubleTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
2056 std::vector<int> multiVal;
2057 std::pair<int, std::pair<int,int> > slic;
2058 MEDCoupling::DataArrayInt *daIntTyypp=0;
2059 const double *pt=self->getConstPointer();
2060 int nbc=self->getNumberOfCompo();
2061 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
2068 std::ostringstream oss;
2069 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2070 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
2074 return PyFloat_FromDouble(pt[singleVal]);
2078 return PyFloat_FromDouble(pt[nbc+singleVal]);
2081 std::ostringstream oss;
2082 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
2083 throw INTERP_KERNEL::Exception(oss.str().c_str());
2089 PyObject *t=PyTuple_New(multiVal.size());
2090 for(int j=0;j<(int)multiVal.size();j++)
2092 int cid=multiVal[j];
2095 std::ostringstream oss;
2096 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
2097 throw INTERP_KERNEL::Exception(oss.str().c_str());
2099 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[cid]));
2105 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2106 PyObject *t=PyTuple_New(sz);
2107 for(int j=0;j<sz;j++)
2108 PyTuple_SetItem(t,j,PyFloat_FromDouble(pt[slic.first+j*slic.second.second]));
2112 throw INTERP_KERNEL::Exception("DataArrayDoubleTuple::__getitem__ : unrecognized type entered !");
2116 DataArrayDoubleTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
2118 const char msg[]="DataArrayDoubleTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
2119 const char msg2[]="DataArrayDoubleTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
2122 std::vector<double> multiValV;
2123 MEDCoupling::DataArrayDoubleTuple *daIntTyyppV=0;
2124 int nbc=self->getNumberOfCompo();
2125 convertDoubleStarLikePyObjToCpp(value,sw1,singleValV,multiValV,daIntTyyppV);
2127 std::vector<int> multiVal;
2128 std::pair<int, std::pair<int,int> > slic;
2129 MEDCoupling::DataArrayInt *daIntTyypp=0;
2130 double *pt=self->getPointer();
2131 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
2138 std::ostringstream oss;
2139 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
2140 throw INTERP_KERNEL::Exception(oss.str().c_str());
2146 pt[singleVal]=singleValV;
2151 if(multiValV.size()!=1)
2153 std::ostringstream oss;
2154 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
2155 throw INTERP_KERNEL::Exception(oss.str().c_str());
2157 pt[singleVal]=multiValV[0];
2162 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
2166 throw INTERP_KERNEL::Exception(msg);
2175 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
2179 std::ostringstream oss;
2180 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
2181 throw INTERP_KERNEL::Exception(oss.str().c_str());
2189 if(multiVal.size()!=multiValV.size())
2191 std::ostringstream oss;
2192 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
2193 throw INTERP_KERNEL::Exception(oss.str().c_str());
2195 for(int i=0;i<(int)multiVal.size();i++)
2197 int pos=multiVal[i];
2200 std::ostringstream oss;
2201 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
2202 throw INTERP_KERNEL::Exception(oss.str().c_str());
2204 pt[multiVal[i]]=multiValV[i];
2210 const double *ptV=daIntTyyppV->getConstPointer();
2211 if(nbc>daIntTyyppV->getNumberOfCompo())
2213 std::ostringstream oss;
2214 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2215 throw INTERP_KERNEL::Exception(oss.str().c_str());
2217 std::copy(ptV,ptV+nbc,pt);
2221 throw INTERP_KERNEL::Exception(msg);
2226 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
2231 for(int j=0;j<sz;j++)
2232 pt[slic.first+j*slic.second.second]=singleValV;
2237 if(sz!=(int)multiValV.size())
2239 std::ostringstream oss;
2240 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
2241 throw INTERP_KERNEL::Exception(oss.str().c_str());
2243 for(int j=0;j<sz;j++)
2244 pt[slic.first+j*slic.second.second]=multiValV[j];
2249 const double *ptV=daIntTyyppV->getConstPointer();
2250 if(sz>daIntTyyppV->getNumberOfCompo())
2252 std::ostringstream oss;
2253 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
2254 throw INTERP_KERNEL::Exception(oss.str().c_str());
2256 for(int j=0;j<sz;j++)
2257 pt[slic.first+j*slic.second.second]=ptV[j];
2261 throw INTERP_KERNEL::Exception(msg);
2265 throw INTERP_KERNEL::Exception(msg);
2271 class DataArrayIntIterator;
2273 class DataArrayInt : public DataArray
2276 static DataArrayInt *New();
2277 int intValue() const throw(INTERP_KERNEL::Exception);
2278 int getHashCode() const throw(INTERP_KERNEL::Exception);
2279 bool empty() const throw(INTERP_KERNEL::Exception);
2280 void aggregate(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2281 DataArrayInt *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
2282 void deepCopyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
2283 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
2284 void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
2285 int popBackSilent() throw(INTERP_KERNEL::Exception);
2286 void pack() const throw(INTERP_KERNEL::Exception);
2287 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
2288 bool isEqual(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2289 bool isEqualWithoutConsideringStr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2290 bool isEqualWithoutConsideringStrAndOrder(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2291 DataArrayInt *buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception);
2292 DataArrayInt *sumPerTuple() const throw(INTERP_KERNEL::Exception);
2293 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
2294 void reverse() throw(INTERP_KERNEL::Exception);
2295 void checkMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2296 bool isMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2297 void checkStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2298 bool isStrictlyMonotonic(bool increasing) const throw(INTERP_KERNEL::Exception);
2299 void fillWithZero() throw(INTERP_KERNEL::Exception);
2300 void fillWithValue(int val) throw(INTERP_KERNEL::Exception);
2301 void iota(int init=0) throw(INTERP_KERNEL::Exception);
2302 std::string repr() const throw(INTERP_KERNEL::Exception);
2303 std::string reprZip() const throw(INTERP_KERNEL::Exception);
2304 std::string reprNotTooLong() const throw(INTERP_KERNEL::Exception);
2305 DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2306 DataArrayInt *invertArrayN2O2O2N(int oldNbOfElem) const throw(INTERP_KERNEL::Exception);
2307 DataArrayInt *invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception);
2308 MCAuto< MapII > invertArrayN2O2O2NOptimized() const throw(INTERP_KERNEL::Exception);
2309 DataArrayInt *indicesOfSubPart(const DataArrayInt& partOfThis) const throw(INTERP_KERNEL::Exception);
2310 DataArrayInt *fromNoInterlace() const throw(INTERP_KERNEL::Exception);
2311 DataArrayInt *toNoInterlace() const throw(INTERP_KERNEL::Exception);
2312 DataArrayInt *selectByTupleIdSafeSlice(int bg, int end, int step) const throw(INTERP_KERNEL::Exception);
2313 DataArrayInt *checkAndPreparePermutation() const throw(INTERP_KERNEL::Exception);
2314 DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception);
2315 bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception);
2316 bool isUniform(int val) const throw(INTERP_KERNEL::Exception);
2317 int checkUniformAndGuess() const throw(INTERP_KERNEL::Exception);
2318 bool hasUniqueValues() const throw(INTERP_KERNEL::Exception);
2319 DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
2320 void transpose() throw(INTERP_KERNEL::Exception);
2321 DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
2322 void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2323 void setPartOfValues1(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
2324 void setPartOfValuesSimple1(int a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
2325 void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
2326 void getTuple(int tupleId, int *res) const throw(INTERP_KERNEL::Exception);
2327 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2328 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
2329 int front() const throw(INTERP_KERNEL::Exception);
2330 int back() const throw(INTERP_KERNEL::Exception);
2331 void setIJ(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2332 void setIJSilent(int tupleId, int compoId, int newVal) throw(INTERP_KERNEL::Exception);
2333 int *getPointer() throw(INTERP_KERNEL::Exception);
2334 const int *getConstPointer() const throw(INTERP_KERNEL::Exception);
2335 DataArrayIntIterator *iterator() throw(INTERP_KERNEL::Exception);
2336 const int *begin() const throw(INTERP_KERNEL::Exception);
2337 const int *end() const throw(INTERP_KERNEL::Exception);
2338 DataArrayInt *findIdsEqual(int val) const throw(INTERP_KERNEL::Exception);
2339 DataArrayInt *findIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception);
2340 int changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception);
2341 int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2342 int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
2343 int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2344 int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2345 bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
2346 bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
2347 bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
2348 int count(int value) const throw(INTERP_KERNEL::Exception);
2349 int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
2350 int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2351 int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
2352 int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
2353 int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
2354 void abs() throw(INTERP_KERNEL::Exception);
2355 DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
2356 void applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception);
2357 void applyLin(int a, int b) throw(INTERP_KERNEL::Exception);
2358 void applyInv(int numerator) throw(INTERP_KERNEL::Exception);
2359 DataArrayInt *negate() const throw(INTERP_KERNEL::Exception);
2360 void applyDivideBy(int val) throw(INTERP_KERNEL::Exception);
2361 void applyModulus(int val) throw(INTERP_KERNEL::Exception);
2362 void applyRModulus(int val) throw(INTERP_KERNEL::Exception);
2363 void applyPow(int val) throw(INTERP_KERNEL::Exception);
2364 void applyRPow(int val) throw(INTERP_KERNEL::Exception);
2365 DataArrayInt *findIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2366 DataArrayInt *findIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2367 DataArrayInt *findIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception);
2368 bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception);
2369 static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception);
2370 static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2371 static DataArrayInt *MakePartition(const std::vector<const DataArrayInt *>& groups, int newNb, std::vector< std::vector<int> >& fidsOfGroups) throw(INTERP_KERNEL::Exception);
2372 static DataArrayInt *BuildUnion(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2373 static DataArrayInt *BuildIntersection(const std::vector<const DataArrayInt *>& arr) throw(INTERP_KERNEL::Exception);
2374 static DataArrayInt *FindPermutationFromFirstToSecond(const DataArrayInt *ids1, const DataArrayInt *ids2) throw(INTERP_KERNEL::Exception);
2375 DataArrayInt *buildComplement(int nbOfElement) const throw(INTERP_KERNEL::Exception);
2376 DataArrayInt *buildSubstraction(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2377 DataArrayInt *buildSubstractionOptimized(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2378 DataArrayInt *buildUnion(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2379 DataArrayInt *buildIntersection(const DataArrayInt *other) const throw(INTERP_KERNEL::Exception);
2380 DataArrayInt *buildUnique() const throw(INTERP_KERNEL::Exception);
2381 DataArrayInt *buildUniqueNotSorted() const throw(INTERP_KERNEL::Exception);
2382 DataArrayInt *deltaShiftIndex() const throw(INTERP_KERNEL::Exception);
2383 void computeOffsets() throw(INTERP_KERNEL::Exception);
2384 void computeOffsetsFull() throw(INTERP_KERNEL::Exception);
2385 DataArrayInt *buildExplicitArrByRanges(const DataArrayInt *offsets) const throw(INTERP_KERNEL::Exception);
2386 DataArrayInt *findRangeIdForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2387 DataArrayInt *findIdInRangeForEachTuple(const DataArrayInt *ranges) const throw(INTERP_KERNEL::Exception);
2388 void sortEachPairToMakeALinkedList() throw(INTERP_KERNEL::Exception);
2389 DataArrayInt *duplicateEachTupleNTimes(int nbTimes) const throw(INTERP_KERNEL::Exception);
2390 DataArrayInt *getDifferentValues() const throw(INTERP_KERNEL::Exception);
2391 static DataArrayInt *Add(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2392 void addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2393 static DataArrayInt *Substract(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2394 void substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2395 static DataArrayInt *Multiply(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2396 void multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2397 static DataArrayInt *Divide(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2398 void divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2399 static DataArrayInt *Modulus(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2400 void modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2401 static DataArrayInt *Pow(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);
2402 void powEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exception);
2403 MCAuto<DataArrayInt> fromLinkedListOfPairToList() const throw(INTERP_KERNEL::Exception);
2404 MCAuto<DataArrayInt> findIdsGreaterOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2405 MCAuto<DataArrayInt> findIdsGreaterThan(int val) const throw(INTERP_KERNEL::Exception);
2406 MCAuto<DataArrayInt> findIdsLowerOrEqualTo(int val) const throw(INTERP_KERNEL::Exception);
2407 MCAuto<DataArrayInt> findIdsLowerThan(int val) const throw(INTERP_KERNEL::Exception);
2408 MCAuto<DataArrayInt> selectPartDef(const PartDefinition* pd) const throw(INTERP_KERNEL::Exception);
2409 MCAuto<DataArrayDouble> convertToDblArr() const throw(INTERP_KERNEL::Exception);
2410 MCAuto<DataArrayFloat> convertToFloatArr() const throw(INTERP_KERNEL::Exception);
2412 static DataArrayInt *Range(int begin, int end, int step) throw(INTERP_KERNEL::Exception);
2415 DataArrayInt() throw(INTERP_KERNEL::Exception)
2417 return DataArrayInt::New();
2420 static DataArrayInt *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2422 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)";
2423 std::string msg(msgBase);
2425 msg+="\n-DataArrayInt.New(numpy array with dtype=int32)";
2428 if(PyList_Check(elt0) || PyTuple_Check(elt0))
2432 if(PyInt_Check(nbOfTuples))
2434 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2436 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2439 if(PyInt_Check(nbOfComp))
2440 {//DataArrayInt.New([1,3,4,5],2,2)
2441 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2443 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2444 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2445 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
2446 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2450 throw INTERP_KERNEL::Exception(msg.c_str());
2453 {//DataArrayInt.New([1,3,4],3)
2454 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2456 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
2457 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2462 throw INTERP_KERNEL::Exception(msg.c_str());
2465 {// DataArrayInt.New([1,3,4])
2466 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2467 int tmpp1=-1,tmpp2=-1;
2468 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
2469 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
2473 else if(PyInt_Check(elt0))
2475 int nbOfTuples1=PyInt_AS_LONG(elt0);
2477 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive set of allocated memory !");
2482 if(PyInt_Check(nbOfTuples))
2483 {//DataArrayInt.New(5,2)
2484 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
2486 throw INTERP_KERNEL::Exception("DataArrayInt::New : should be a positive number of components !");
2487 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2488 ret->alloc(nbOfTuples1,nbOfCompo);
2492 throw INTERP_KERNEL::Exception(msg.c_str());
2495 throw INTERP_KERNEL::Exception(msg.c_str());
2498 {//DataArrayInt.New(5)
2499 MCAuto<DataArrayInt> ret=DataArrayInt::New();
2500 ret->alloc(nbOfTuples1,1);
2505 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
2506 {//DataArrayInt.New(numpyArray)
2507 return BuildNewInstance<DataArrayInt,int>(elt0,NPY_INT32,&PyCallBackDataArrayInt_RefType,"INT32");
2511 throw INTERP_KERNEL::Exception(msg.c_str());
2512 throw INTERP_KERNEL::Exception(msg.c_str());//to make g++ happy
2515 DataArrayInt(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2517 return MEDCoupling_DataArrayInt_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
2520 std::string __str__() const throw(INTERP_KERNEL::Exception)
2522 return self->reprNotTooLong();
2525 int __len__() const throw(INTERP_KERNEL::Exception)
2527 if(self->isAllocated())
2529 return self->getNumberOfTuples();
2533 throw INTERP_KERNEL::Exception("DataArrayInt::__len__ : Instance is NOT allocated !");
2537 int __int__() const throw(INTERP_KERNEL::Exception)
2539 return self->intValue();
2542 DataArrayIntIterator *__iter__() throw(INTERP_KERNEL::Exception)
2544 return self->iterator();
2547 PyObject *accumulate() const throw(INTERP_KERNEL::Exception)
2549 int sz=self->getNumberOfComponents();
2550 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2551 self->accumulate(tmp);
2552 return convertIntArrToPyList(tmp,sz);
2555 DataArrayInt *accumulatePerChunck(PyObject *indexArr) const throw(INTERP_KERNEL::Exception)
2558 std::vector<int> val2;
2559 const int *bg=convertIntStarLikePyObjToCppIntStar(indexArr,sw,sz,val,val2);
2560 return self->accumulatePerChunck(bg,bg+sz);
2563 DataArrayInt *findIdsEqualTuple(PyObject *inputTuple) const throw(INTERP_KERNEL::Exception)
2566 std::vector<int> val2;
2567 const int *bg(convertIntStarLikePyObjToCppIntStar(inputTuple,sw,sz,val,val2));
2568 return self->findIdsEqualTuple(bg,bg+sz);
2571 PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
2573 std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
2574 PyObject *ret=PyList_New(slcs.size());
2575 for(std::size_t i=0;i<slcs.size();i++)
2576 PyList_SetItem(ret,i,PySlice_New(PyInt_FromLong(slcs[i].first),PyInt_FromLong(slcs[i].second),PyInt_FromLong(1)));
2580 DataArrayInt *buildExplicitArrOfSliceOnScaledArr(PyObject *slic) const throw(INTERP_KERNEL::Exception)
2582 if(!PySlice_Check(slic))
2583 throw INTERP_KERNEL::Exception("DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : expecting a pyslice as second (first) parameter !");
2584 Py_ssize_t strt=2,stp=2,step=2;
2585 GetIndicesOfSliceExplicitely(slic,&strt,&stp,&step,"DataArrayInt::buildExplicitArrOfSliceOnScaledArr (wrap) : the input slice is invalid !");
2586 if(strt==std::numeric_limits<int>::max() || stp==std::numeric_limits<int>::max())
2587 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 !");
2588 return self->buildExplicitArrOfSliceOnScaledArr(strt,stp,step);
2591 PyObject *getMinMaxValues() const throw(INTERP_KERNEL::Exception)
2594 self->getMinMaxValues(a,b);
2595 PyObject *ret=PyTuple_New(2);
2596 PyTuple_SetItem(ret,0,PyInt_FromLong(a));
2597 PyTuple_SetItem(ret,1,PyInt_FromLong(b));
2601 static PyObject *ConvertIndexArrayToO2N(int nbOfOldTuples, PyObject *arr, PyObject *arrI) throw(INTERP_KERNEL::Exception)
2603 int newNbOfTuples=-1;
2604 int szArr,szArrI,sw,iTypppArr,iTypppArrI;
2605 std::vector<int> stdvecTyyppArr,stdvecTyyppArrI;
2606 const int *arrPtr=convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr);
2607 const int *arrIPtr=convertIntStarLikePyObjToCppIntStar(arrI,sw,szArrI,iTypppArrI,stdvecTyyppArrI);
2608 DataArrayInt *ret0=MEDCoupling::DataArrayInt::ConvertIndexArrayToO2N(nbOfOldTuples,arrPtr,arrIPtr,arrIPtr+szArrI,newNbOfTuples);
2609 PyObject *ret=PyTuple_New(2);
2610 PyTuple_SetItem(ret,0,SWIG_NewPointerObj((void*)ret0,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2611 PyTuple_SetItem(ret,1,PyInt_FromLong(newNbOfTuples));
2615 static DataArrayInt *CheckAndPreparePermutation(PyObject *arr) throw(INTERP_KERNEL::Exception)
2617 MCAuto<DataArrayInt> ret(DataArrayInt::New());
2618 int szArr,sw,iTypppArr;
2619 std::vector<int> stdvecTyyppArr;
2620 const int *arrPtr(convertIntStarLikePyObjToCppIntStar(arr,sw,szArr,iTypppArr,stdvecTyyppArr));
2621 int *pt(MEDCoupling::DataArrayInt::CheckAndPreparePermutation(arrPtr,arrPtr+szArr));
2622 ret->useArray(pt,true,MEDCoupling::C_DEALLOC,szArr,1);
2626 void setValues(PyObject *li, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
2628 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 !";
2629 if(PyList_Check(li) || PyTuple_Check(li))
2631 if(nbOfTuples && nbOfTuples != Py_None)
2633 if(PyInt_Check(nbOfTuples))
2635 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
2637 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive set of allocated memory !");
2638 if(nbOfComp && nbOfComp != Py_None)
2640 if(PyInt_Check(nbOfComp))
2641 {//DataArrayInt.setValues([1,3,4,5],2,2)
2642 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
2644 throw INTERP_KERNEL::Exception("DataArrayInt::setValue : should be a positive number of components !");
2645 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,nbOfCompo);
2646 self->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2649 throw INTERP_KERNEL::Exception(msg);
2652 {//DataArrayInt.setValues([1,3,4],3)
2654 std::vector<int> tmp=fillArrayWithPyListInt2(li,nbOfTuples1,tmpp1);
2655 self->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2659 throw INTERP_KERNEL::Exception(msg);
2662 {// DataArrayInt.setValues([1,3,4])
2663 int tmpp1=-1,tmpp2=-1;
2664 std::vector<int> tmp=fillArrayWithPyListInt2(li,tmpp1,tmpp2);
2665 self->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),self->getPointer());
2669 throw INTERP_KERNEL::Exception(msg);
2672 PyObject *getValues() const throw(INTERP_KERNEL::Exception)
2674 const int *vals=self->getConstPointer();
2675 return convertIntArrToPyList(vals,self->getNbOfElems());
2679 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
2681 return ToNumPyArray<DataArrayInt,int>(self,NPY_INT32,"DataArrayInt");
2685 PyObject *isEqualIfNotWhy(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
2688 bool ret0=self->isEqualIfNotWhy(other,ret1);
2689 PyObject *ret=PyTuple_New(2);
2690 PyObject *ret0Py=ret0?Py_True:Py_False;
2692 PyTuple_SetItem(ret,0,ret0Py);
2693 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
2697 PyObject *getValuesAsTuple() const throw(INTERP_KERNEL::Exception)
2699 const int *vals=self->getConstPointer();
2700 int nbOfComp=self->getNumberOfComponents();
2701 int nbOfTuples=self->getNumberOfTuples();
2702 return convertIntArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
2705 static PyObject *MakePartition(PyObject *gps, int newNb) throw(INTERP_KERNEL::Exception)
2707 std::vector<const DataArrayInt *> groups;
2708 std::vector< std::vector<int> > fidsOfGroups;
2709 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(gps,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",groups);
2710 MEDCoupling::DataArrayInt *ret0=MEDCoupling::DataArrayInt::MakePartition(groups,newNb,fidsOfGroups);
2711 PyObject *ret = PyList_New(2);
2712 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2713 int sz=fidsOfGroups.size();
2714 PyObject *ret1 = PyList_New(sz);
2715 for(int i=0;i<sz;i++)
2716 PyList_SetItem(ret1,i,convertIntArrToPyList2(fidsOfGroups[i]));
2717 PyList_SetItem(ret,1,ret1);
2721 void transformWithIndArr(PyObject *li) throw(INTERP_KERNEL::Exception)
2724 int res1(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 ));
2725 if (!SWIG_IsOK(res1))
2727 int res2(SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__MapII, 0 | 0 ));
2730 MapII *m=reinterpret_cast<MapII *>(da);
2731 self->transformWithIndArr(*m);
2736 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2737 self->transformWithIndArr(tmp,tmp+size);
2742 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2743 self->transformWithIndArr(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2747 DataArrayInt *findIdsEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2751 std::vector<int> multiVal;
2752 std::pair<int, std::pair<int,int> > slic;
2753 MEDCoupling::DataArrayInt *daIntTyypp=0;
2754 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2758 return self->findIdsEqualList(&singleVal,&singleVal+1);
2760 return self->findIdsEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2762 return self->findIdsEqualList(daIntTyypp->begin(),daIntTyypp->end());
2764 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2768 DataArrayInt *findIdsNotEqualList(PyObject *obj) throw(INTERP_KERNEL::Exception)
2772 std::vector<int> multiVal;
2773 std::pair<int, std::pair<int,int> > slic;
2774 MEDCoupling::DataArrayInt *daIntTyypp=0;
2775 convertIntStarOrSliceLikePyObjToCpp(obj,self->getNumberOfTuples(),sw,singleVal,multiVal,slic,daIntTyypp);
2779 return self->findIdsNotEqualList(&singleVal,&singleVal+1);
2781 return self->findIdsNotEqualList(&multiVal[0],&multiVal[0]+multiVal.size());
2783 return self->findIdsNotEqualList(daIntTyypp->begin(),daIntTyypp->end());
2785 throw INTERP_KERNEL::Exception("DataArrayInt::findIdsNotEqualList : unrecognized type entered, expected list of int, tuple of int or DataArrayInt !");
2789 PyObject *splitByValueRange(PyObject *li) const throw(INTERP_KERNEL::Exception)
2791 DataArrayInt *ret0=0,*ret1=0,*ret2=0;
2793 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2794 if (!SWIG_IsOK(res1))
2797 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2798 self->splitByValueRange(tmp,(int *)tmp+size,ret0,ret1,ret2);
2802 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2804 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2805 da2->checkAllocated();
2806 self->splitByValueRange(da2->begin(),da2->end(),ret0,ret1,ret2);
2808 PyObject *ret = PyList_New(3);
2809 PyList_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2810 PyList_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2811 PyList_SetItem(ret,2,SWIG_NewPointerObj(SWIG_as_voidptr(ret2),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2815 DataArrayInt *transformWithIndArrR(PyObject *li) const throw(INTERP_KERNEL::Exception)
2818 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2819 if (!SWIG_IsOK(res1))
2822 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2823 return self->transformWithIndArrR(tmp,tmp+size);
2827 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2828 return self->transformWithIndArrR(da2->getConstPointer(),da2->getConstPointer()+da2->getNbOfElems());
2832 DataArrayInt *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
2835 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2836 if (!SWIG_IsOK(res1))
2839 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2840 if(size!=self->getNumberOfTuples())
2842 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2844 return self->renumberAndReduce(tmp,newNbOfTuple);
2848 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2850 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2851 da2->checkAllocated();
2852 int size=self->getNumberOfTuples();
2853 if(size!=self->getNumberOfTuples())
2855 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2857 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
2861 DataArrayInt *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
2864 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2865 if (!SWIG_IsOK(res1))
2868 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2869 if(size!=self->getNumberOfTuples())
2871 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2873 return self->renumber(tmp);
2877 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2879 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2880 da2->checkAllocated();
2881 int size=self->getNumberOfTuples();
2882 if(size!=self->getNumberOfTuples())
2884 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2886 return self->renumber(da2->getConstPointer());
2890 DataArrayInt *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
2893 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
2894 if (!SWIG_IsOK(res1))
2897 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
2898 if(size!=self->getNumberOfTuples())
2900 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2902 return self->renumberR(tmp);
2906 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
2908 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
2909 da2->checkAllocated();
2910 int size=self->getNumberOfTuples();
2911 if(size!=self->getNumberOfTuples())
2913 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
2915 return self->renumberR(da2->getConstPointer());
2919 void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
2921 std::vector<int> tmp;
2922 convertPyToNewIntArr3(li,tmp);
2923 self->setSelectedComponents(a,tmp);
2926 PyObject *explodeComponents() const throw(INTERP_KERNEL::Exception)
2928 std::vector< MCAuto<DataArrayInt> > retCpp(self->explodeComponents());
2929 std::size_t sz(retCpp.size());
2930 PyObject *res(PyList_New(sz));
2931 for(std::size_t i=0;i<sz;i++)
2932 PyList_SetItem(res,i,SWIG_NewPointerObj(SWIG_as_voidptr(retCpp[i].retn()),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
2936 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
2938 int sz=self->getNumberOfComponents();
2939 INTERP_KERNEL::AutoPtr<int> tmp=new int[sz];
2940 self->getTuple(tupleId,tmp);
2941 return convertIntArrToPyList(tmp,sz);
2944 PyObject *changeSurjectiveFormat(int targetNb) const throw(INTERP_KERNEL::Exception)
2946 DataArrayInt *arr=0;
2947 DataArrayInt *arrI=0;
2948 self->changeSurjectiveFormat(targetNb,arr,arrI);
2949 PyObject *res = PyList_New(2);
2950 PyList_SetItem(res,0,SWIG_NewPointerObj((void*)arr,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2951 PyList_SetItem(res,1,SWIG_NewPointerObj((void*)arrI,SWIGTYPE_p_MEDCoupling__DataArrayInt,SWIG_POINTER_OWN | 0));
2955 static DataArrayInt *Meld(PyObject *li) throw(INTERP_KERNEL::Exception)
2957 std::vector<const DataArrayInt *> tmp;
2958 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2959 return DataArrayInt::Meld(tmp);
2962 static DataArrayInt *Aggregate(PyObject *li) throw(INTERP_KERNEL::Exception)
2964 std::vector<const DataArrayInt *> tmp;
2965 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2966 return DataArrayInt::Aggregate(tmp);
2969 static DataArrayInt *AggregateIndexes(PyObject *li) throw(INTERP_KERNEL::Exception)
2971 std::vector<const DataArrayInt *> tmp;
2972 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2973 return DataArrayInt::AggregateIndexes(tmp);
2976 static DataArrayInt *BuildUnion(PyObject *li) throw(INTERP_KERNEL::Exception)
2978 std::vector<const DataArrayInt *> tmp;
2979 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2980 return DataArrayInt::BuildUnion(tmp);
2983 static DataArrayInt *BuildIntersection(PyObject *li) throw(INTERP_KERNEL::Exception)
2985 std::vector<const DataArrayInt *> tmp;
2986 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayInt *>(li,SWIGTYPE_p_MEDCoupling__DataArrayInt,"DataArrayInt",tmp);
2987 return DataArrayInt::BuildIntersection(tmp);
2990 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
2993 int r1=self->getMaxValue(tmp);
2994 PyObject *ret=PyTuple_New(2);
2995 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
2996 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3000 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
3003 int r1=self->getMinValue(tmp);
3004 PyObject *ret=PyTuple_New(2);
3005 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
3006 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
3010 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3012 int nbOfCompo=self->getNumberOfComponents();
3017 if(PyInt_Check(obj))
3019 int val=(int)PyInt_AS_LONG(obj);
3020 return self->findIdFirstEqual(val);
3023 throw INTERP_KERNEL::Exception("DataArrayInt::index : 'this' contains one component and trying to find an element which is not an integer !");
3027 std::vector<int> arr;
3028 convertPyToNewIntArr3(obj,arr);
3029 return self->findIdFirstEqualTuple(arr);
3034 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
3036 int nbOfCompo=self->getNumberOfComponents();
3043 if(PyInt_Check(obj))
3045 int val=(int)PyInt_AS_LONG(obj);
3046 return self->presenceOfValue(val);
3049 throw INTERP_KERNEL::Exception("DataArrayInt::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
3053 std::vector<int> arr;
3054 convertPyToNewIntArr3(obj,arr);
3055 return self->presenceOfTuple(arr);
3060 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3062 const char msg[]="Unexpected situation in DataArrayInt::__getitem__ !";
3063 const char msg2[]="DataArrayInt::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
3064 self->checkAllocated();
3065 int nbOfTuples=self->getNumberOfTuples();
3066 int nbOfComponents=self->getNumberOfComponents();
3068 std::vector<int> vt1,vc1;
3069 std::pair<int, std::pair<int,int> > pt1,pc1;
3070 DataArrayInt *dt1=0,*dc1=0;
3072 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3073 MCAuto<DataArrayInt> ret;
3078 if(nbOfComponents==1)
3079 return PyInt_FromLong(self->getIJSafe(it1,0));
3080 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&it1,&it1+1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3083 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3085 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3087 return SWIG_NewPointerObj(SWIG_as_voidptr(self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems())),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3089 return PyInt_FromLong(self->getIJSafe(it1,ic1));
3092 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3093 std::vector<int> v2(1,ic1);
3094 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3098 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3099 std::vector<int> v2(1,ic1);
3100 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3104 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3105 std::vector<int> v2(1,ic1);
3106 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3110 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3111 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3115 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3116 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3120 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3121 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3125 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3126 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(vc1)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3130 ret=self->selectByTupleIdSafe(&it1,&it1+1);
3131 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3132 std::vector<int> v2(nbOfComp);
3133 for(int i=0;i<nbOfComp;i++)
3134 v2[i]=pc1.first+i*pc1.second.second;
3135 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3139 ret=self->selectByTupleIdSafe(&vt1[0],&vt1[0]+vt1.size());
3140 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3141 std::vector<int> v2(nbOfComp);
3142 for(int i=0;i<nbOfComp;i++)
3143 v2[i]=pc1.first+i*pc1.second.second;
3144 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3148 ret=self->selectByTupleIdSafeSlice(pt1.first,pt1.second.first,pt1.second.second);
3149 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3150 std::vector<int> v2(nbOfComp);
3151 for(int i=0;i<nbOfComp;i++)
3152 v2[i]=pc1.first+i*pc1.second.second;
3153 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3157 ret=self->selectByTupleIdSafe(dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems());
3158 int nbOfComp=DataArray::GetNumberOfItemGivenBESRelative(pc1.first,pc1.second.first,pc1.second.second,msg2);
3159 std::vector<int> v2(nbOfComp);
3160 for(int i=0;i<nbOfComp;i++)
3161 v2[i]=pc1.first+i*pc1.second.second;
3162 return SWIG_NewPointerObj(SWIG_as_voidptr(ret->keepSelectedComponents(v2)),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 );
3165 throw INTERP_KERNEL::Exception(msg);
3169 DataArrayInt *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
3171 self->checkAllocated();
3172 const char msg[]="Unexpected situation in __setitem__ !";
3173 int nbOfTuples=self->getNumberOfTuples();
3174 int nbOfComponents=self->getNumberOfComponents();
3177 std::vector<int> v1;
3179 DataArrayIntTuple *dd1=0;
3180 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
3182 std::vector<int> vt1,vc1;
3183 std::pair<int, std::pair<int,int> > pt1,pc1;
3184 DataArrayInt *dt1=0,*dc1=0;
3185 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
3186 MCAuto<DataArrayInt> tmp;
3194 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
3197 tmp=DataArrayInt::New();
3198 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3199 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
3202 self->setPartOfValues1(d1,it1,it1+1,1,0,nbOfComponents,1);
3205 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3206 self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1);
3209 throw INTERP_KERNEL::Exception(msg);
3218 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3221 tmp=DataArrayInt::New();
3222 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3223 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1,false);
3226 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3229 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3230 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
3233 throw INTERP_KERNEL::Exception(msg);
3242 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3245 tmp=DataArrayInt::New();
3246 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3247 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
3250 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3253 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3254 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
3257 throw INTERP_KERNEL::Exception(msg);
3266 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3269 tmp=DataArrayInt::New();
3270 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3271 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1,false);
3274 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3277 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3278 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
3281 throw INTERP_KERNEL::Exception(msg);
3290 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
3293 tmp=DataArrayInt::New();
3294 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3295 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
3298 self->setPartOfValues1(d1,it1,it1+1,1,ic1,ic1+1,1);
3301 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3302 self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1);
3305 throw INTERP_KERNEL::Exception(msg);
3314 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3317 tmp=DataArrayInt::New();
3318 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3319 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1,false);
3322 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3325 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3326 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
3329 throw INTERP_KERNEL::Exception(msg);
3338 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3341 tmp=DataArrayInt::New();
3342 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3343 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
3346 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3349 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3350 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
3353 throw INTERP_KERNEL::Exception(msg);
3362 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3365 tmp=DataArrayInt::New();
3366 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3367 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1,false);
3370 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3373 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3374 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
3377 throw INTERP_KERNEL::Exception(msg);
3386 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3389 tmp=DataArrayInt::New();
3390 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3391 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size(),false);
3394 self->setPartOfValues2(d1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3397 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3398 self->setPartOfValues2(tmp,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
3401 throw INTERP_KERNEL::Exception(msg);
3410 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3413 tmp=DataArrayInt::New();
3414 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3415 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size(),false);
3418 self->setPartOfValues2(d1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3421 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3422 self->setPartOfValues2(tmp,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
3425 throw INTERP_KERNEL::Exception(msg);
3434 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3437 tmp=DataArrayInt::New();
3438 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3439 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
3442 self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3445 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3446 self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
3449 throw INTERP_KERNEL::Exception(msg);
3458 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3461 tmp=DataArrayInt::New();
3462 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3463 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size(),false);
3466 self->setPartOfValues2(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3469 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3470 self->setPartOfValues2(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
3473 throw INTERP_KERNEL::Exception(msg);
3482 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3485 tmp=DataArrayInt::New();
3486 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3487 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
3490 self->setPartOfValues1(d1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3493 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3494 self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
3497 throw INTERP_KERNEL::Exception(msg);
3506 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3509 tmp=DataArrayInt::New();
3510 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3511 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second,false);
3514 self->setPartOfValues3(d1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3517 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3518 self->setPartOfValues3(tmp,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
3521 throw INTERP_KERNEL::Exception(msg);
3530 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3533 tmp=DataArrayInt::New();
3534 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3535 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
3538 self->setPartOfValues1(d1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3541 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3542 self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
3545 throw INTERP_KERNEL::Exception(msg);
3554 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3557 tmp=DataArrayInt::New();
3558 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
3559 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second,false);
3562 self->setPartOfValues3(d1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3565 tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
3566 self->setPartOfValues3(tmp,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
3569 throw INTERP_KERNEL::Exception(msg);
3574 throw INTERP_KERNEL::Exception(msg);
3579 DataArrayInt *__neg__() const throw(INTERP_KERNEL::Exception)
3581 return self->negate();
3584 DataArrayInt *__add__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3586 const char msg[]="Unexpected situation in __add__ !";
3589 std::vector<int> aa;
3590 DataArrayIntTuple *aaa;
3592 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3597 MCAuto<DataArrayInt> ret=self->deepCopy();
3598 ret->applyLin(1,val);
3603 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3604 return DataArrayInt::Add(self,aaaa);
3608 return DataArrayInt::Add(self,a);
3612 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3613 return DataArrayInt::Add(self,aaaa);
3616 throw INTERP_KERNEL::Exception(msg);
3620 DataArrayInt *__radd__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3622 const char msg[]="Unexpected situation in __radd__ !";
3625 std::vector<int> aa;
3626 DataArrayIntTuple *aaa;
3628 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3633 MCAuto<DataArrayInt> ret=self->deepCopy();
3634 ret->applyLin(1,val);
3639 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3640 return DataArrayInt::Add(self,aaaa);
3644 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3645 return DataArrayInt::Add(self,aaaa);
3648 throw INTERP_KERNEL::Exception(msg);
3652 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3654 const char msg[]="Unexpected situation in __iadd__ !";
3657 std::vector<int> aa;
3658 DataArrayIntTuple *aaa;
3660 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3665 self->applyLin(1,val);
3666 Py_XINCREF(trueSelf);
3671 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3673 Py_XINCREF(trueSelf);
3679 Py_XINCREF(trueSelf);
3684 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3685 self->addEqual(aaaa);
3686 Py_XINCREF(trueSelf);
3690 throw INTERP_KERNEL::Exception(msg);
3694 DataArrayInt *__sub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3696 const char msg[]="Unexpected situation in __sub__ !";
3699 std::vector<int> aa;
3700 DataArrayIntTuple *aaa;
3702 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3707 MCAuto<DataArrayInt> ret=self->deepCopy();
3708 ret->applyLin(1,-val);
3713 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3714 return DataArrayInt::Substract(self,aaaa);
3718 return DataArrayInt::Substract(self,a);
3722 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3723 return DataArrayInt::Substract(self,aaaa);
3726 throw INTERP_KERNEL::Exception(msg);
3730 DataArrayInt *__rsub__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3732 const char msg[]="Unexpected situation in __rsub__ !";
3735 std::vector<int> aa;
3736 DataArrayIntTuple *aaa;
3738 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3743 MCAuto<DataArrayInt> ret=self->deepCopy();
3744 ret->applyLin(-1,val);
3749 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3750 return DataArrayInt::Substract(aaaa,self);
3754 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3755 return DataArrayInt::Substract(aaaa,self);
3758 throw INTERP_KERNEL::Exception(msg);
3762 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3764 const char msg[]="Unexpected situation in __isub__ !";
3767 std::vector<int> aa;
3768 DataArrayIntTuple *aaa;
3770 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3775 self->applyLin(1,-val);
3776 Py_XINCREF(trueSelf);
3781 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3782 self->substractEqual(bb);
3783 Py_XINCREF(trueSelf);
3788 self->substractEqual(a);
3789 Py_XINCREF(trueSelf);
3794 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3795 self->substractEqual(aaaa);
3796 Py_XINCREF(trueSelf);
3800 throw INTERP_KERNEL::Exception(msg);
3804 DataArrayInt *__mul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3806 const char msg[]="Unexpected situation in __mul__ !";
3809 std::vector<int> aa;
3810 DataArrayIntTuple *aaa;
3812 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3817 MCAuto<DataArrayInt> ret=self->deepCopy();
3818 ret->applyLin(val,0);
3823 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3824 return DataArrayInt::Multiply(self,aaaa);
3828 return DataArrayInt::Multiply(self,a);
3832 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3833 return DataArrayInt::Multiply(self,aaaa);
3836 throw INTERP_KERNEL::Exception(msg);
3840 DataArrayInt *__rmul__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3842 const char msg[]="Unexpected situation in __rmul__ !";
3845 std::vector<int> aa;
3846 DataArrayIntTuple *aaa;
3848 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3853 MCAuto<DataArrayInt> ret=self->deepCopy();
3854 ret->applyLin(val,0);
3859 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3860 return DataArrayInt::Multiply(self,aaaa);
3864 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3865 return DataArrayInt::Multiply(self,aaaa);
3868 throw INTERP_KERNEL::Exception(msg);
3872 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3874 const char msg[]="Unexpected situation in __imul__ !";
3877 std::vector<int> aa;
3878 DataArrayIntTuple *aaa;
3880 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3885 self->applyLin(val,0);
3886 Py_XINCREF(trueSelf);
3891 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3892 self->multiplyEqual(bb);
3893 Py_XINCREF(trueSelf);
3898 self->multiplyEqual(a);
3899 Py_XINCREF(trueSelf);
3904 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3905 self->multiplyEqual(aaaa);
3906 Py_XINCREF(trueSelf);
3910 throw INTERP_KERNEL::Exception(msg);
3914 DataArrayInt *__div__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3916 const char msg[]="Unexpected situation in __div__ !";
3919 std::vector<int> aa;
3920 DataArrayIntTuple *aaa;
3922 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3927 MCAuto<DataArrayInt> ret=self->deepCopy();
3928 ret->applyDivideBy(val);
3933 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3934 return DataArrayInt::Divide(self,aaaa);
3938 return DataArrayInt::Divide(self,a);
3942 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3943 return DataArrayInt::Divide(self,aaaa);
3946 throw INTERP_KERNEL::Exception(msg);
3950 DataArrayInt *__rdiv__(PyObject *obj) throw(INTERP_KERNEL::Exception)
3952 const char msg[]="Unexpected situation in __rdiv__ !";
3955 std::vector<int> aa;
3956 DataArrayIntTuple *aaa;
3958 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3963 MCAuto<DataArrayInt> ret=self->deepCopy();
3969 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
3970 return DataArrayInt::Divide(aaaa,self);
3974 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
3975 return DataArrayInt::Divide(aaaa,self);
3978 throw INTERP_KERNEL::Exception(msg);
3982 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
3984 const char msg[]="Unexpected situation in __idiv__ !";
3987 std::vector<int> aa;
3988 DataArrayIntTuple *aaa;
3990 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
3995 self->applyDivideBy(val);
3996 Py_XINCREF(trueSelf);
4001 MCAuto<DataArrayInt> bb=DataArrayInt::New(); bb->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4002 self->divideEqual(bb);
4003 Py_XINCREF(trueSelf);
4008 self->divideEqual(a);
4009 Py_XINCREF(trueSelf);
4014 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4015 self->divideEqual(aaaa);
4016 Py_XINCREF(trueSelf);
4020 throw INTERP_KERNEL::Exception(msg);
4024 DataArrayInt *__mod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4026 const char msg[]="Unexpected situation in __mod__ !";
4029 std::vector<int> aa;
4030 DataArrayIntTuple *aaa;
4032 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4037 MCAuto<DataArrayInt> ret=self->deepCopy();
4038 ret->applyModulus(val);
4043 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4044 return DataArrayInt::Modulus(self,aaaa);
4048 return DataArrayInt::Modulus(self,a);
4052 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4053 return DataArrayInt::Modulus(self,aaaa);
4056 throw INTERP_KERNEL::Exception(msg);
4060 DataArrayInt *__rmod__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4062 const char msg[]="Unexpected situation in __rmod__ !";
4065 std::vector<int> aa;
4066 DataArrayIntTuple *aaa;
4068 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4073 MCAuto<DataArrayInt> ret=self->deepCopy();
4074 ret->applyRModulus(val);
4079 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4080 return DataArrayInt::Modulus(aaaa,self);
4084 return DataArrayInt::Modulus(a,self);
4088 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4089 return DataArrayInt::Modulus(aaaa,self);
4092 throw INTERP_KERNEL::Exception(msg);
4096 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4098 const char msg[]="Unexpected situation in __imod__ !";
4101 std::vector<int> aa;
4102 DataArrayIntTuple *aaa;
4104 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4109 self->applyModulus(val);
4110 Py_XINCREF(trueSelf);
4115 self->modulusEqual(a);
4116 Py_XINCREF(trueSelf);
4121 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4122 self->modulusEqual(aaaa);
4123 Py_XINCREF(trueSelf);
4127 throw INTERP_KERNEL::Exception(msg);
4131 DataArrayInt *__pow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4133 const char msg[]="Unexpected situation in __pow__ !";
4136 std::vector<int> aa;
4137 DataArrayIntTuple *aaa;
4139 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4144 MCAuto<DataArrayInt> ret=self->deepCopy();
4150 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4151 return DataArrayInt::Pow(self,aaaa);
4155 return DataArrayInt::Pow(self,a);
4159 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4160 return DataArrayInt::Pow(self,aaaa);
4163 throw INTERP_KERNEL::Exception(msg);
4167 DataArrayInt *__rpow__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4169 const char msg[]="Unexpected situation in __rpow__ !";
4172 std::vector<int> aa;
4173 DataArrayIntTuple *aaa;
4175 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4180 MCAuto<DataArrayInt> ret=self->deepCopy();
4181 ret->applyRPow(val);
4186 MCAuto<DataArrayInt> aaaa=DataArrayInt::New(); aaaa->useArray(&aa[0],false,CPP_DEALLOC,1,(int)aa.size());
4187 return DataArrayInt::Pow(aaaa,self);
4191 return DataArrayInt::Pow(a,self);
4195 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4196 return DataArrayInt::Pow(aaaa,self);
4199 throw INTERP_KERNEL::Exception(msg);
4203 PyObject *___ipow___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4205 const char msg[]="Unexpected situation in __ipow__ !";
4208 std::vector<int> aa;
4209 DataArrayIntTuple *aaa;
4211 convertIntStarLikePyObjToCpp(obj,sw,val,aa,a,aaa);
4216 self->applyPow(val);
4217 Py_XINCREF(trueSelf);
4223 Py_XINCREF(trueSelf);
4228 MCAuto<DataArrayInt> aaaa=aaa->buildDAInt(1,self->getNumberOfComponents());
4229 self->powEqual(aaaa);
4230 Py_XINCREF(trueSelf);
4234 throw INTERP_KERNEL::Exception(msg);
4238 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4240 std::ostringstream oss;
4241 self->reprQuickOverview(oss);
4245 void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
4247 int szArr,sw,iTypppArr;
4248 std::vector<int> stdvecTyyppArr;
4249 const int *tmp=convertIntStarLikePyObjToCppIntStar(li,sw,szArr,iTypppArr,stdvecTyyppArr);
4250 self->pushBackValsSilent(tmp,tmp+szArr);
4253 PyObject *partitionByDifferentValues() const throw(INTERP_KERNEL::Exception)
4255 std::vector<int> ret1;
4256 std::vector<DataArrayInt *> ret0=self->partitionByDifferentValues(ret1);
4257 std::size_t sz=ret0.size();
4258 PyObject *pyRet=PyTuple_New(2);
4259 PyObject *pyRet0=PyList_New((int)sz);
4260 PyObject *pyRet1=PyList_New((int)sz);
4261 for(std::size_t i=0;i<sz;i++)
4263 PyList_SetItem(pyRet0,i,SWIG_NewPointerObj(SWIG_as_voidptr(ret0[i]),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4264 PyList_SetItem(pyRet1,i,PyInt_FromLong(ret1[i]));
4266 PyTuple_SetItem(pyRet,0,pyRet0);
4267 PyTuple_SetItem(pyRet,1,pyRet1);
4271 PyObject *findIdsRangesInListOfIds(const DataArrayInt *listOfIds) const throw(INTERP_KERNEL::Exception)
4273 DataArrayInt *ret0=0,*ret1=0;
4274 self->findIdsRangesInListOfIds(listOfIds,ret0,ret1);
4275 PyObject *pyRet=PyTuple_New(2);
4276 PyTuple_SetItem(pyRet,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4277 PyTuple_SetItem(pyRet,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
4281 PyObject *isRange() const throw(INTERP_KERNEL::Exception)
4284 bool ret(self->isRange(a,b,c));
4285 PyObject *pyRet=PyTuple_New(2);
4286 PyObject *ret0Py=ret?Py_True:Py_False,*ret1Py(0);
4288 PyTuple_SetItem(pyRet,0,ret0Py);
4290 ret1Py=PySlice_New(PyInt_FromLong(a),PyInt_FromLong(b),PyInt_FromLong(c));
4296 PyTuple_SetItem(pyRet,1,ret1Py);
4301 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
4303 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayInt");
4306 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
4309 if(!self->isAllocated())
4310 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : self is not allocated !");
4311 PyObject *ret(PyTuple_New(1));
4312 PyObject *ret0(PyDict_New());
4313 PyObject *numpyArryObj(MEDCoupling_DataArrayInt_toNumPyArray(self));
4314 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
4315 PyObject *tmp1(PyInt_FromLong(0));
4316 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
4317 PyTuple_SetItem(ret,0,ret0);
4321 throw INTERP_KERNEL::Exception("PyWrap of DataArrayInt.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
4327 class DataArrayIntTuple;
4329 class DataArrayIntIterator
4332 DataArrayIntIterator(DataArrayInt *da);
4333 ~DataArrayIntIterator();
4338 DataArrayIntTuple *ret=self->nextt();
4340 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayIntTuple,SWIG_POINTER_OWN | 0);
4343 PyErr_SetString(PyExc_StopIteration,"No more data.");
4350 class DataArrayIntTuple
4353 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
4354 DataArrayInt *buildDAInt(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
4357 std::string __str__() const throw(INTERP_KERNEL::Exception)
4359 return self->repr();
4362 int __int__() const throw(INTERP_KERNEL::Exception)
4364 return self->intValue();
4367 DataArrayInt *buildDAInt() throw(INTERP_KERNEL::Exception)
4369 return self->buildDAInt(1,self->getNumberOfCompo());
4372 PyObject *___iadd___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4374 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4375 MEDCoupling_DataArrayInt____iadd___(ret,0,obj);
4376 Py_XINCREF(trueSelf);
4380 PyObject *___isub___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4382 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4383 MEDCoupling_DataArrayInt____isub___(ret,0,obj);
4384 Py_XINCREF(trueSelf);
4388 PyObject *___imul___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4390 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4391 MEDCoupling_DataArrayInt____imul___(ret,0,obj);
4392 Py_XINCREF(trueSelf);
4395 PyObject *___idiv___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4397 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4398 MEDCoupling_DataArrayInt____idiv___(ret,0,obj);
4399 Py_XINCREF(trueSelf);
4403 PyObject *___imod___(PyObject *trueSelf, PyObject *obj) throw(INTERP_KERNEL::Exception)
4405 MCAuto<DataArrayInt> ret=self->buildDAInt(1,self->getNumberOfCompo());
4406 MEDCoupling_DataArrayInt____imod___(ret,0,obj);
4407 Py_XINCREF(trueSelf);
4411 PyObject *__len__() throw(INTERP_KERNEL::Exception)
4413 return PyInt_FromLong(self->getNumberOfCompo());
4416 PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
4418 const char msg2[]="DataArrayIntTuple::__getitem__ : Mismatch of slice values in 2nd parameter (components) !";
4421 std::vector<int> multiVal;
4422 std::pair<int, std::pair<int,int> > slic;
4423 MEDCoupling::DataArrayInt *daIntTyypp=0;
4424 const int *pt=self->getConstPointer();
4425 int nbc=self->getNumberOfCompo();
4426 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw,singleVal,multiVal,slic,daIntTyypp);
4433 std::ostringstream oss;
4434 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4435 PyErr_SetString(PyExc_StopIteration,oss.str().c_str());
4439 return PyInt_FromLong(pt[singleVal]);
4443 return PyInt_FromLong(pt[nbc+singleVal]);
4446 std::ostringstream oss;
4447 oss << "Requesting for id " << singleVal << " having only " << nbc << " components !";
4448 throw INTERP_KERNEL::Exception(oss.str().c_str());
4454 PyObject *t=PyTuple_New(multiVal.size());
4455 for(int j=0;j<(int)multiVal.size();j++)
4457 int cid=multiVal[j];
4460 std::ostringstream oss;
4461 oss << "Requesting for id #" << cid << " having only " << nbc << " components !";
4462 throw INTERP_KERNEL::Exception(oss.str().c_str());
4464 PyTuple_SetItem(t,j,PyInt_FromLong(pt[cid]));
4470 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4471 PyObject *t=PyTuple_New(sz);
4472 for(int j=0;j<sz;j++)
4473 PyTuple_SetItem(t,j,PyInt_FromLong(pt[slic.first+j*slic.second.second]));
4477 throw INTERP_KERNEL::Exception("DataArrayIntTuple::__getitem__ : unrecognized type entered !");
4481 DataArrayIntTuple *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
4483 const char msg[]="DataArrayIntTuple::__setitem__ : unrecognized type entered, int, slice, list<int>, tuple<int> !";
4484 const char msg2[]="DataArrayIntTuple::__setitem__ : Mismatch of slice values in 2nd parameter (components) !";
4487 std::vector<int> multiValV;
4488 std::pair<int, std::pair<int,int> > slicV;
4489 MEDCoupling::DataArrayIntTuple *daIntTyyppV=0;
4490 int nbc=self->getNumberOfCompo();
4491 convertObjToPossibleCpp22(value,nbc,sw1,singleValV,multiValV,slicV,daIntTyyppV);
4493 std::vector<int> multiVal;
4494 std::pair<int, std::pair<int,int> > slic;
4495 MEDCoupling::DataArrayInt *daIntTyypp=0;
4496 int *pt=self->getPointer();
4497 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbc,sw2,singleVal,multiVal,slic,daIntTyypp);
4504 std::ostringstream oss;
4505 oss << "Requesting for setting id # " << singleVal << " having only " << nbc << " components !";
4506 throw INTERP_KERNEL::Exception(oss.str().c_str());
4512 pt[singleVal]=singleValV;
4517 if(multiValV.size()!=1)
4519 std::ostringstream oss;
4520 oss << "Requesting for setting id # " << singleVal << " with a list or tuple with size != 1 ! ";
4521 throw INTERP_KERNEL::Exception(oss.str().c_str());
4523 pt[singleVal]=multiValV[0];
4528 pt[singleVal]=daIntTyyppV->getConstPointer()[0];
4532 throw INTERP_KERNEL::Exception(msg);
4541 for(std::vector<int>::const_iterator it=multiVal.begin();it!=multiVal.end();it++)
4545 std::ostringstream oss;
4546 oss << "Requesting for setting id # " << *it << " having only " << nbc << " components !";
4547 throw INTERP_KERNEL::Exception(oss.str().c_str());
4555 if(multiVal.size()!=multiValV.size())
4557 std::ostringstream oss;
4558 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << multiVal.size() << " !";
4559 throw INTERP_KERNEL::Exception(oss.str().c_str());
4561 for(int i=0;i<(int)multiVal.size();i++)
4563 int pos=multiVal[i];
4566 std::ostringstream oss;
4567 oss << "Requesting for setting id # " << pos << " having only " << nbc << " components !";
4568 throw INTERP_KERNEL::Exception(oss.str().c_str());
4570 pt[multiVal[i]]=multiValV[i];
4576 const int *ptV=daIntTyyppV->getConstPointer();
4577 if(nbc>daIntTyyppV->getNumberOfCompo())
4579 std::ostringstream oss;
4580 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4581 throw INTERP_KERNEL::Exception(oss.str().c_str());
4583 std::copy(ptV,ptV+nbc,pt);
4587 throw INTERP_KERNEL::Exception(msg);
4592 int sz=DataArray::GetNumberOfItemGivenBES(slic.first,slic.second.first,slic.second.second,msg2);
4597 for(int j=0;j<sz;j++)
4598 pt[slic.first+j*slic.second.second]=singleValV;
4603 if(sz!=(int)multiValV.size())
4605 std::ostringstream oss;
4606 oss << "Mismatch length of during assignment : " << multiValV.size() << " != " << sz << " !";
4607 throw INTERP_KERNEL::Exception(oss.str().c_str());
4609 for(int j=0;j<sz;j++)
4610 pt[slic.first+j*slic.second.second]=multiValV[j];
4615 const int *ptV=daIntTyyppV->getConstPointer();
4616 if(sz>daIntTyyppV->getNumberOfCompo())
4618 std::ostringstream oss;
4619 oss << "Mismatch length of during assignment : " << nbc << " != " << daIntTyyppV->getNumberOfCompo() << " !";
4620 throw INTERP_KERNEL::Exception(oss.str().c_str());
4622 for(int j=0;j<sz;j++)
4623 pt[slic.first+j*slic.second.second]=ptV[j];
4627 throw INTERP_KERNEL::Exception(msg);
4631 throw INTERP_KERNEL::Exception(msg);
4637 class DataArrayChar : public DataArray
4640 virtual DataArrayChar *buildEmptySpecializedDAChar() const throw(INTERP_KERNEL::Exception);
4641 int getHashCode() const throw(INTERP_KERNEL::Exception);
4642 bool empty() const throw(INTERP_KERNEL::Exception);
4643 void deepCopyFrom(const DataArrayChar& other) throw(INTERP_KERNEL::Exception);
4644 void reserve(std::size_t nbOfElems) throw(INTERP_KERNEL::Exception);
4645 void pushBackSilent(char val) throw(INTERP_KERNEL::Exception);
4646 char popBackSilent() throw(INTERP_KERNEL::Exception);
4647 void pack() const throw(INTERP_KERNEL::Exception);
4648 void allocIfNecessary(int nbOfTuple, int nbOfCompo) throw(INTERP_KERNEL::Exception);
4649 bool isEqual(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4650 bool isEqualWithoutConsideringStr(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception);
4651 void reverse() throw(INTERP_KERNEL::Exception);
4652 void fillWithZero() throw(INTERP_KERNEL::Exception);
4653 void fillWithValue(char val) throw(INTERP_KERNEL::Exception);
4654 std::string repr() const throw(INTERP_KERNEL::Exception);
4655 std::string reprZip() const throw(INTERP_KERNEL::Exception);
4656 DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception);
4657 DataArrayChar *renumber(const int *old2New) const throw(INTERP_KERNEL::Exception);
4658 DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception);
4659 DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception);
4660 bool isUniform(char val) const throw(INTERP_KERNEL::Exception);
4661 void sort(bool asc=true) throw(INTERP_KERNEL::Exception);
4662 DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
4663 DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception);
4664 void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception);
4665 void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
4666 char front() const throw(INTERP_KERNEL::Exception);
4667 char back() const throw(INTERP_KERNEL::Exception);
4668 void setIJ(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4669 void setIJSilent(int tupleId, int compoId, char newVal) throw(INTERP_KERNEL::Exception);
4670 char *getPointer() throw(INTERP_KERNEL::Exception);
4671 DataArrayInt *findIdsEqual(char val) const throw(INTERP_KERNEL::Exception);
4672 DataArrayInt *findIdsNotEqual(char val) const throw(INTERP_KERNEL::Exception);
4673 int findIdFirstEqualTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4674 bool presenceOfTuple(const std::vector<char>& tupl) const throw(INTERP_KERNEL::Exception);
4675 char getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4676 char getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
4677 char getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
4678 char getMinValueInArray() const throw(INTERP_KERNEL::Exception);
4679 DataArrayInt *findIdsInRange(char vmin, char vmax) const throw(INTERP_KERNEL::Exception);
4680 static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4681 static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2) throw(INTERP_KERNEL::Exception);
4684 int __len__() const throw(INTERP_KERNEL::Exception)
4686 if(self->isAllocated())
4688 return self->getNumberOfTuples();
4692 throw INTERP_KERNEL::Exception("DataArrayChar::__len__ : Instance is NOT allocated !");
4696 PyObject *isEqualIfNotWhy(const DataArrayChar& other) const throw(INTERP_KERNEL::Exception)
4699 bool ret0=self->isEqualIfNotWhy(other,ret1);
4700 PyObject *ret=PyTuple_New(2);
4701 PyObject *ret0Py=ret0?Py_True:Py_False;
4703 PyTuple_SetItem(ret,0,ret0Py);
4704 PyTuple_SetItem(ret,1,PyString_FromString(ret1.c_str()));
4708 DataArrayChar *renumber(PyObject *li) throw(INTERP_KERNEL::Exception)
4711 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4712 if (!SWIG_IsOK(res1))
4715 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4716 if(size!=self->getNumberOfTuples())
4718 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4720 return self->renumber(tmp);
4724 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4726 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4727 da2->checkAllocated();
4728 int size=self->getNumberOfTuples();
4729 if(size!=self->getNumberOfTuples())
4731 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4733 return self->renumber(da2->getConstPointer());
4737 DataArrayChar *renumberR(PyObject *li) throw(INTERP_KERNEL::Exception)
4740 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4741 if (!SWIG_IsOK(res1))
4744 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4745 if(size!=self->getNumberOfTuples())
4747 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4749 return self->renumberR(tmp);
4753 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4755 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4756 da2->checkAllocated();
4757 int size=self->getNumberOfTuples();
4758 if(size!=self->getNumberOfTuples())
4760 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4762 return self->renumberR(da2->getConstPointer());
4766 DataArrayChar *renumberAndReduce(PyObject *li, int newNbOfTuple) throw(INTERP_KERNEL::Exception)
4769 int res1=SWIG_ConvertPtr(li,&da,SWIGTYPE_p_MEDCoupling__DataArrayInt, 0 | 0 );
4770 if (!SWIG_IsOK(res1))
4773 INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&size);
4774 if(size!=self->getNumberOfTuples())
4776 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4778 return self->renumberAndReduce(tmp,newNbOfTuple);
4782 DataArrayInt *da2=reinterpret_cast< DataArrayInt * >(da);
4784 throw INTERP_KERNEL::Exception("Not null DataArrayInt instance expected !");
4785 da2->checkAllocated();
4786 int size=self->getNumberOfTuples();
4787 if(size!=self->getNumberOfTuples())
4789 throw INTERP_KERNEL::Exception("Invalid list length ! Must be equal to number of tuples !");
4791 return self->renumberAndReduce(da2->getConstPointer(),newNbOfTuple);
4795 static DataArrayChar *Aggregate(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4797 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4798 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4799 return DataArrayChar::Aggregate(tmp);
4802 static DataArrayChar *Meld(PyObject *dachs) throw(INTERP_KERNEL::Exception)
4804 std::vector<const MEDCoupling::DataArrayChar *> tmp;
4805 convertFromPyObjVectorOfObj<const MEDCoupling::DataArrayChar *>(dachs,SWIGTYPE_p_MEDCoupling__DataArrayChar,"DataArrayChar",tmp);
4806 return DataArrayChar::Meld(tmp);
4811 class DataArrayByteIterator;
4813 class DataArrayByte : public DataArrayChar
4816 static DataArrayByte *New();
4817 DataArrayByteIterator *iterator() throw(INTERP_KERNEL::Exception);
4818 DataArrayByte *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
4819 char byteValue() const throw(INTERP_KERNEL::Exception);
4822 DataArrayByte() throw(INTERP_KERNEL::Exception)
4824 return DataArrayByte::New();
4827 static DataArrayByte *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4829 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) !";
4830 if(PyList_Check(elt0) || PyTuple_Check(elt0))
4834 if(PyInt_Check(nbOfTuples))
4836 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
4838 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4841 if(PyInt_Check(nbOfComp))
4842 {//DataArrayByte.New([1,3,4,5],2,2)
4843 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
4845 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4846 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4847 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
4848 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4852 throw INTERP_KERNEL::Exception(msg);
4855 {//DataArrayByte.New([1,3,4],3)
4856 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4858 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
4859 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4864 throw INTERP_KERNEL::Exception(msg);
4867 {// DataArrayByte.New([1,3,4])
4868 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4869 int tmpp1=-1,tmpp2=-1;
4870 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
4871 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
4875 else if(PyInt_Check(elt0))
4877 int nbOfTuples1=PyInt_AS_LONG(elt0);
4879 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive set of allocated memory !");
4884 if(PyInt_Check(nbOfTuples))
4885 {//DataArrayByte.New(5,2)
4886 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
4888 throw INTERP_KERNEL::Exception("DataArrayByte::New : should be a positive number of components !");
4889 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4890 ret->alloc(nbOfTuples1,nbOfCompo);
4894 throw INTERP_KERNEL::Exception(msg);
4897 throw INTERP_KERNEL::Exception(msg);
4900 {//DataArrayByte.New(5)
4901 MCAuto<DataArrayByte> ret=DataArrayByte::New();
4902 ret->alloc(nbOfTuples1,1);
4907 else if(PyArray_Check(elt0) && nbOfTuples==NULL && nbOfComp==NULL)
4908 {//DataArrayDouble.New(numpyArray)
4909 return BuildNewInstance<DataArrayByte,char>(elt0,NPY_INT8,&PyCallBackDataArrayChar_RefType,"INT8");
4913 throw INTERP_KERNEL::Exception(msg);
4916 DataArrayByte(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
4918 return MEDCoupling_DataArrayByte_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
4921 std::string __repr__() const throw(INTERP_KERNEL::Exception)
4923 std::ostringstream oss;
4924 self->reprQuickOverview(oss);
4928 int __int__() const throw(INTERP_KERNEL::Exception)
4930 return (int) self->byteValue();
4933 DataArrayByteIterator *__iter__() throw(INTERP_KERNEL::Exception)
4935 return self->iterator();
4938 int getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4940 return (int)self->getIJ(tupleId,compoId);
4943 int getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
4945 return (int)self->getIJSafe(tupleId,compoId);
4948 std::string __str__() const throw(INTERP_KERNEL::Exception)
4950 return self->repr();
4953 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
4955 const char *vals=self->getConstPointer();
4956 int nbOfComp=self->getNumberOfComponents();
4957 int nbOfTuples=self->getNumberOfTuples();
4958 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
4961 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4964 int ival=-1; std::vector<int> ivval;
4965 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4966 std::vector<char> vals(sz);
4967 std::copy(pt,pt+sz,vals.begin());
4968 return self->presenceOfTuple(vals);
4971 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4974 int ival=-1; std::vector<int> ivval;
4975 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4976 std::vector<char> vals2(sz);
4977 std::copy(pt,pt+sz,vals2.begin());
4978 return self->presenceOfValue(vals2);
4981 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
4984 int ival=-1; std::vector<int> ivval;
4985 const int *pt=convertIntStarLikePyObjToCppIntStar(vals,sw,sz,ival,ivval);
4986 std::vector<char> vals2(sz);
4987 std::copy(pt,pt+sz,vals2.begin());
4988 return self->findIdFirstEqual(vals2);
4991 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
4994 int ival=-1; std::vector<int> ivval;
4995 const int *pt=convertIntStarLikePyObjToCppIntStar(tupl,sw,sz,ival,ivval);
4996 std::vector<char> vals(sz);
4997 std::copy(pt,pt+sz,vals.begin());
4998 return self->findIdFirstEqualTuple(vals);
5001 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5004 int ival=-1; std::vector<int> ivval;
5005 const int *pt=convertIntStarLikePyObjToCppIntStar(strOrListOfInt,sw,sz,ival,ivval);
5006 std::vector<char> vals(sz);
5007 std::copy(pt,pt+sz,vals.begin());
5008 return self->findIdSequence(vals);
5011 PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception)
5013 int sz=self->getNumberOfComponents();
5014 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz];
5015 self->getTuple(tupleId,tmp);
5016 PyObject *ret=PyTuple_New(sz);
5017 for(int i=0;i<sz;i++) PyTuple_SetItem(ret,i,PyInt_FromLong((int)tmp[i]));
5021 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5024 int r1=(int)self->getMaxValue(tmp);
5025 PyObject *ret=PyTuple_New(2);
5026 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5027 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5031 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5034 int r1=(int)self->getMinValue(tmp);
5035 PyObject *ret=PyTuple_New(2);
5036 PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
5037 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5041 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5043 int nbOfCompo=self->getNumberOfComponents();
5048 if(PyInt_Check(obj))
5050 int val=(int)PyInt_AS_LONG(obj);
5051 return self->findIdFirstEqual(val);
5054 throw INTERP_KERNEL::Exception("DataArrayByte::index : 'this' contains one component and trying to find an element which is not an integer !");
5057 return MEDCoupling_DataArrayByte_findIdFirstEqualTuple(self,obj);
5061 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5063 int nbOfCompo=self->getNumberOfComponents();
5070 if(PyInt_Check(obj))
5072 int val=(int)PyInt_AS_LONG(obj);
5073 return self->presenceOfValue(val);
5076 throw INTERP_KERNEL::Exception("DataArrayByte::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5079 return MEDCoupling_DataArrayByte_presenceOfTuple(self,obj);
5084 PyObject *toNumPyArray() throw(INTERP_KERNEL::Exception) // not const. It is not a bug !
5086 return ToNumPyArray<DataArrayByte,char>(self,NPY_INT8,"DataArrayByte");
5091 static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
5093 return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"DataArrayByte");
5096 PyObject *__getnewargs__() throw(INTERP_KERNEL::Exception)
5099 if(!self->isAllocated())
5100 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : self is not allocated !");
5101 PyObject *ret(PyTuple_New(1));
5102 PyObject *ret0(PyDict_New());
5103 PyObject *numpyArryObj(MEDCoupling_DataArrayByte_toNumPyArray(self));
5104 {// create a dict to discriminite in __new__ if __init__ should be called. Not beautiful but not idea ...
5105 PyObject *tmp1(PyInt_FromLong(0));
5106 PyDict_SetItem(ret0,tmp1,numpyArryObj); Py_DECREF(tmp1); Py_DECREF(numpyArryObj);
5107 PyTuple_SetItem(ret,0,ret0);
5111 throw INTERP_KERNEL::Exception("PyWrap of DataArrayByte.__getnewargs__ : not implemented because numpy is not active in your configuration ! No serialization/unserialization available without numpy !");
5115 DataArrayByte *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5117 self->checkAllocated();
5118 const char msg[]="Unexpected situation in __setitem__ !";
5119 int nbOfTuples(self->getNumberOfTuples()),nbOfComponents(self->getNumberOfComponents());
5122 std::vector<int> v1;
5124 DataArrayIntTuple *dd1=0;
5125 convertIntStarLikePyObjToCpp(value,sw1,i1,v1,d1,dd1);
5127 std::vector<int> vt1,vc1;
5128 std::pair<int, std::pair<int,int> > pt1,pc1;
5129 DataArrayInt *dt1=0,*dc1=0;
5130 convertObjToPossibleCpp3(obj,nbOfTuples,nbOfComponents,sw2,it1,ic1,vt1,vc1,pt1,pc1,dt1,dc1);
5131 MCAuto<DataArrayInt> tmp;
5139 self->setPartOfValuesSimple1(i1,it1,it1+1,1,0,nbOfComponents,1);
5142 throw INTERP_KERNEL::Exception(msg);
5151 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),0,nbOfComponents,1);
5154 throw INTERP_KERNEL::Exception(msg);
5163 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1);
5166 throw INTERP_KERNEL::Exception(msg);
5175 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),0,nbOfComponents,1);
5178 throw INTERP_KERNEL::Exception(msg);
5187 self->setPartOfValuesSimple1(i1,it1,it1+1,1,ic1,ic1+1,1);
5190 throw INTERP_KERNEL::Exception(msg);
5199 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),ic1,ic1+1,1);
5202 throw INTERP_KERNEL::Exception(msg);
5211 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1);
5214 throw INTERP_KERNEL::Exception(msg);
5223 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),ic1,ic1+1,1);
5226 throw INTERP_KERNEL::Exception(msg);
5235 self->setPartOfValuesSimple2(i1,&it1,&it1+1,&vc1[0],&vc1[0]+vc1.size());
5238 throw INTERP_KERNEL::Exception(msg);
5247 self->setPartOfValuesSimple2(i1,&vt1[0],&vt1[0]+vt1.size(),&vc1[0],&vc1[0]+vc1.size());
5250 throw INTERP_KERNEL::Exception(msg);
5259 self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
5262 throw INTERP_KERNEL::Exception(msg);
5271 self->setPartOfValuesSimple2(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),&vc1[0],&vc1[0]+vc1.size());
5274 throw INTERP_KERNEL::Exception(msg);
5283 self->setPartOfValuesSimple1(i1,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second);
5286 throw INTERP_KERNEL::Exception(msg);
5295 self->setPartOfValuesSimple3(i1,&vt1[0],&vt1[0]+vt1.size(),pc1.first,pc1.second.first,pc1.second.second);
5298 throw INTERP_KERNEL::Exception(msg);
5307 self->setPartOfValuesSimple1(i1,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second);
5310 throw INTERP_KERNEL::Exception(msg);
5319 self->setPartOfValuesSimple3(i1,dt1->getConstPointer(),dt1->getConstPointer()+dt1->getNbOfElems(),pc1.first,pc1.second.first,pc1.second.second);
5322 throw INTERP_KERNEL::Exception(msg);
5327 throw INTERP_KERNEL::Exception(msg);
5334 class DataArrayByteTuple;
5336 class DataArrayByteIterator
5339 DataArrayByteIterator(DataArrayByte *da);
5340 ~DataArrayByteIterator();
5343 class DataArrayByteTuple
5346 std::string repr() const throw(INTERP_KERNEL::Exception);
5347 DataArrayByte *buildDAByte(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5350 std::string __str__() const throw(INTERP_KERNEL::Exception)
5352 return self->repr();
5355 char __int__() const throw(INTERP_KERNEL::Exception)
5357 return self->byteValue();
5360 DataArrayByte *buildDAByte() throw(INTERP_KERNEL::Exception)
5362 return self->buildDAByte(1,self->getNumberOfCompo());
5367 class DataArrayAsciiCharIterator;
5369 class DataArrayAsciiChar : public DataArrayChar
5372 static DataArrayAsciiChar *New();
5373 DataArrayAsciiCharIterator *iterator() throw(INTERP_KERNEL::Exception);
5374 DataArrayAsciiChar *performCopyOrIncrRef(bool deepCopy) const throw(INTERP_KERNEL::Exception);
5375 char asciiCharValue() const throw(INTERP_KERNEL::Exception);
5378 DataArrayAsciiChar() throw(INTERP_KERNEL::Exception)
5380 return DataArrayAsciiChar::New();
5383 static DataArrayAsciiChar *New(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5385 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) !";
5386 if(PyList_Check(elt0) || PyTuple_Check(elt0))
5390 if(PyInt_Check(nbOfTuples))
5392 int nbOfTuples1=PyInt_AS_LONG(nbOfTuples);
5394 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5397 if(PyInt_Check(nbOfComp))
5398 {//DataArrayAsciiChar.New([1,3,4,5],2,2)
5399 int nbOfCompo=PyInt_AS_LONG(nbOfComp);
5401 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5402 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5403 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,nbOfCompo);
5404 ret->alloc(nbOfTuples1,nbOfCompo); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5408 throw INTERP_KERNEL::Exception(msg);
5411 {//DataArrayAsciiChar.New([1,3,4],3)
5412 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5414 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,nbOfTuples1,tmpp1);
5415 ret->alloc(nbOfTuples1,tmpp1); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5419 else if(PyString_Check(nbOfTuples))
5421 if(PyString_Size(nbOfTuples)!=1)
5422 throw INTERP_KERNEL::Exception(msg);
5423 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5424 std::vector<std::string> tmp;
5425 if(fillStringVector(elt0,tmp))
5426 return DataArrayAsciiChar::New(tmp,PyString_AsString(nbOfTuples)[0]);
5428 throw INTERP_KERNEL::Exception(msg);
5430 %#if PY_VERSION_HEX >= 0x03000000
5431 else if(PyUnicode_Check(nbOfTuples))
5433 if(PyUnicode_GET_LENGTH(nbOfTuples)!=1)
5434 throw INTERP_KERNEL::Exception(msg);
5435 //DataArrayAsciiChar.New(["abc","de","fghi"],"t")
5436 std::vector<std::string> tmp;
5437 if(fillStringVector(elt0,tmp))
5438 return DataArrayAsciiChar::New(tmp,PyUnicode_AsUTF8(nbOfTuples)[0]);
5440 throw INTERP_KERNEL::Exception(msg);
5444 throw INTERP_KERNEL::Exception(msg);
5448 std::vector<std::string> tmmp;
5449 if(fillStringVector(elt0,tmmp))
5450 //DataArrayAsciiChar.New(["abc","de","fghi"])
5451 return DataArrayAsciiChar::New(tmmp,' ');
5454 // DataArrayAsciiChar.New([1,3,4])
5455 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5456 int tmpp1=-1,tmpp2=-1;
5457 std::vector<int> tmp=fillArrayWithPyListInt2(elt0,tmpp1,tmpp2);
5458 ret->alloc(tmpp1,tmpp2); std::copy(tmp.begin(),tmp.end(),ret->getPointer());
5463 else if(PyInt_Check(elt0))
5465 int nbOfTuples1=PyInt_AS_LONG(elt0);
5467 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive set of allocated memory !");
5472 if(PyInt_Check(nbOfTuples))
5473 {//DataArrayAsciiChar.New(5,2)
5474 int nbOfCompo=PyInt_AS_LONG(nbOfTuples);
5476 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::New : should be a positive number of components !");
5477 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5478 ret->alloc(nbOfTuples1,nbOfCompo);
5482 throw INTERP_KERNEL::Exception(msg);
5485 throw INTERP_KERNEL::Exception(msg);
5488 {//DataArrayAsciiChar.New(5)
5489 MCAuto<DataArrayAsciiChar> ret=DataArrayAsciiChar::New();
5490 ret->alloc(nbOfTuples1,1);
5495 throw INTERP_KERNEL::Exception(msg);
5498 DataArrayAsciiChar(PyObject *elt0, PyObject *nbOfTuples=0, PyObject *nbOfComp=0) throw(INTERP_KERNEL::Exception)
5500 return MEDCoupling_DataArrayAsciiChar_New__SWIG_1(elt0,nbOfTuples,nbOfComp);
5503 std::string __repr__() const throw(INTERP_KERNEL::Exception)
5505 std::ostringstream oss;
5506 self->reprQuickOverview(oss);
5510 DataArrayAsciiCharIterator *__iter__() throw(INTERP_KERNEL::Exception)
5512 return self->iterator();
5515 std::string getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5517 char tmp[2]; tmp[1]='\0';
5518 tmp[0]=self->getIJ(tupleId,compoId);
5519 return std::string(tmp);
5522 std::string getIJSafe(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception)
5524 char tmp[2]; tmp[1]='\0';
5525 tmp[0]=self->getIJSafe(tupleId,compoId);
5526 return std::string(tmp);
5529 std::string __str__() const throw(INTERP_KERNEL::Exception)
5531 return self->repr();
5534 PyObject *toStrList() const throw(INTERP_KERNEL::Exception)
5536 const char *vals=self->getConstPointer();
5537 int nbOfComp=self->getNumberOfComponents();
5538 int nbOfTuples=self->getNumberOfTuples();
5539 return convertCharArrToPyListOfTuple(vals,nbOfComp,nbOfTuples);
5542 bool presenceOfTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5544 if(PyString_Check(tupl))
5546 Py_ssize_t sz=PyString_Size(tupl);
5547 std::vector<char> vals(sz);
5548 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5549 return self->presenceOfTuple(vals);
5551 %#if PY_VERSION_HEX >= 0x03000000
5552 else if(PyUnicode_Check(tupl))
5554 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5555 std::vector<char> vals(sz);
5556 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5557 return self->presenceOfTuple(vals);
5561 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfTuple : only strings in input supported !");
5564 bool presenceOfValue(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5566 if(PyString_Check(vals))
5568 Py_ssize_t sz=PyString_Size(vals);
5569 std::vector<char> vals2(sz);
5570 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5571 return self->presenceOfValue(vals2);
5573 %#if PY_VERSION_HEX >= 0x03000000
5574 if(PyUnicode_Check(vals))
5576 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5577 std::vector<char> vals2(sz);
5578 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5579 return self->presenceOfValue(vals2);
5583 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::presenceOfValue : only strings in input supported !");
5586 int findIdFirstEqual(PyObject *vals) const throw(INTERP_KERNEL::Exception)
5588 if(PyString_Check(vals))
5590 Py_ssize_t sz=PyString_Size(vals);
5591 std::vector<char> vals2(sz);
5592 std::copy(PyString_AsString(vals),PyString_AsString(vals)+sz,vals2.begin());
5593 return self->findIdFirstEqual(vals2);
5595 %#if PY_VERSION_HEX >= 0x03000000
5596 if(PyUnicode_Check(vals))
5598 Py_ssize_t sz=PyUnicode_GET_LENGTH(vals);
5599 std::vector<char> vals2(sz);
5600 std::copy(PyUnicode_AsUTF8(vals),PyUnicode_AsUTF8(vals)+sz,vals2.begin());
5601 return self->findIdFirstEqual(vals2);
5605 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqual : only strings in input supported !");
5608 int findIdFirstEqualTuple(PyObject *tupl) const throw(INTERP_KERNEL::Exception)
5610 if(PyString_Check(tupl))
5612 Py_ssize_t sz=PyString_Size(tupl);
5613 std::vector<char> vals(sz);
5614 std::copy(PyString_AsString(tupl),PyString_AsString(tupl)+sz,vals.begin());
5615 return self->findIdFirstEqualTuple(vals);
5617 %#if PY_VERSION_HEX >= 0x03000000
5618 if(PyUnicode_Check(tupl))
5620 Py_ssize_t sz=PyUnicode_GET_LENGTH(tupl);
5621 std::vector<char> vals(sz);
5622 std::copy(PyUnicode_AsUTF8(tupl),PyUnicode_AsUTF8(tupl)+sz,vals.begin());
5623 return self->findIdFirstEqualTuple(vals);
5627 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !");
5630 int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception)
5632 if(PyString_Check(strOrListOfInt))
5634 Py_ssize_t sz=PyString_Size(strOrListOfInt);
5635 std::vector<char> vals(sz);
5636 std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin());
5637 return self->findIdSequence(vals);
5639 %#if PY_VERSION_HEX >= 0x03000000
5640 else if(PyUnicode_Check(strOrListOfInt))
5642 Py_ssize_t sz=PyUnicode_GET_LENGTH(strOrListOfInt);
5643 std::vector<char> vals(sz);
5644 std::copy(PyUnicode_AsUTF8(strOrListOfInt),PyUnicode_AsUTF8(strOrListOfInt)+sz,vals.begin());
5645 return self->findIdSequence(vals);
5649 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !");
5652 PyObject *getTuple(int tupleId) const throw(INTERP_KERNEL::Exception)
5654 int sz=self->getNumberOfComponents();
5655 INTERP_KERNEL::AutoPtr<char> tmp=new char[sz+1]; tmp[sz]='\0';
5656 self->getTuple(tupleId,tmp);
5657 return PyString_FromString(tmp);
5660 PyObject *getMaxValue() const throw(INTERP_KERNEL::Exception)
5663 char tmp2[2]; tmp2[1]='\0';
5664 tmp2[0]=self->getMaxValue(tmp);
5665 PyObject *ret=PyTuple_New(2);
5666 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5667 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5671 PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
5674 char tmp2[2]; tmp2[1]='\0';
5675 tmp2[0]=self->getMinValue(tmp);
5676 PyObject *ret=PyTuple_New(2);
5677 PyTuple_SetItem(ret,0,PyString_FromString(tmp2));
5678 PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
5682 int index(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5684 int nbOfCompo=self->getNumberOfComponents();
5689 if(PyString_Check(obj))
5691 Py_ssize_t sz=PyString_Size(obj);
5692 char *pt=PyString_AsString(obj);
5694 return self->findIdFirstEqual(pt[0]);
5696 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5698 %#if PY_VERSION_HEX >= 0x03000000
5699 if(PyUnicode_Check(obj))
5702 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5704 return self->findIdFirstEqual(pt[0]);
5706 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find a string with size different from 1 !");
5710 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::index : 'this' contains one component and trying to find an element which is not an integer !");
5713 return MEDCoupling_DataArrayAsciiChar_findIdFirstEqualTuple(self,obj);
5717 bool __contains__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5719 int nbOfCompo=self->getNumberOfComponents();
5726 if(PyString_Check(obj))
5728 Py_ssize_t sz=PyString_Size(obj);
5729 char *pt=PyString_AsString(obj);
5731 return self->presenceOfValue(pt[0]);
5733 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5735 %#if PY_VERSION_HEX >= 0x03000000
5736 if(PyUnicode_Check(obj))
5739 char *pt=PyUnicode_AsUTF8AndSize(obj, &sz);
5741 return self->presenceOfValue(pt[0]);
5743 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find a string with size different from 1 !");
5747 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__contains__ : 'this' contains one component and trying to find an element which is not an integer !");
5750 return MEDCoupling_DataArrayAsciiChar_presenceOfTuple(self,obj);
5754 PyObject *__getitem__(PyObject *obj) const throw(INTERP_KERNEL::Exception)
5757 std::vector<int> stdvecTyyppArr;
5758 std::pair<int, std::pair<int,int> > sTyyppArr;
5759 MEDCoupling::DataArrayInt *daIntTyypp=0;
5760 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,self->getNumberOfTuples(),sw,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5764 return MEDCoupling_DataArrayAsciiChar_getTuple(self,iTypppArr);
5766 return convertDataArrayChar(self->selectByTupleIdSafe(&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size()), SWIG_POINTER_OWN | 0 );
5768 return convertDataArrayChar(self->selectByTupleIdSafeSlice(sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second), SWIG_POINTER_OWN | 0 );
5770 return convertDataArrayChar(self->selectByTupleIdSafe(daIntTyypp->begin(),daIntTyypp->end()), SWIG_POINTER_OWN | 0 );
5772 throw INTERP_KERNEL::Exception("DataArrayAsciiChar::__getitem__ : supporting int, list of int, tuple of int, DataArrayInt and slice in input !");
5776 DataArrayAsciiChar *__setitem__(PyObject *obj, PyObject *value) throw(INTERP_KERNEL::Exception)
5778 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.";
5780 std::vector<int> stdvecTyyppArr;
5781 std::pair<int, std::pair<int,int> > sTyyppArr;
5782 MEDCoupling::DataArrayInt *daIntTyypp=0;
5783 int nbOfCompo=self->getNumberOfComponents();
5784 int nbOfTuples=self->getNumberOfTuples();
5785 convertIntStarOrSliceLikePyObjToCppWithNegIntInterp(obj,nbOfTuples,sw1,iTypppArr,stdvecTyyppArr,sTyyppArr,daIntTyypp);
5787 char vc; std::string sc; std::vector<std::string> vsc; DataArrayChar *dacc=0;
5788 convertObjToPossibleCpp6(value,sw2,vc,sc,vsc,dacc);
5797 self->setPartOfValuesSimple3(vc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1);
5803 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5804 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5807 //value vector<string>
5810 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5811 self->setPartOfValues3(tmp,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5814 //value DataArrayChar
5817 self->setPartOfValues3(dacc,&iTypppArr,&iTypppArr+1,0,nbOfCompo,1,false);
5821 throw INTERP_KERNEL::Exception(msg);
5825 {//obj list-tuple[int]
5831 self->setPartOfValuesSimple3(vc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1);
5837 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5838 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5841 //value vector<string>
5844 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5845 self->setPartOfValues3(tmp,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5848 //value DataArrayChar
5851 self->setPartOfValues3(dacc,&stdvecTyyppArr[0],&stdvecTyyppArr[0]+stdvecTyyppArr.size(),0,nbOfCompo,1,false);
5855 throw INTERP_KERNEL::Exception(msg);
5866 self->setPartOfValuesSimple1(vc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1);
5872 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5873 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5876 //value vector<string>
5879 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5880 self->setPartOfValues1(tmp,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5883 //value DataArrayChar
5886 self->setPartOfValues1(dacc,sTyyppArr.first,sTyyppArr.second.first,sTyyppArr.second.second,0,nbOfCompo,1,false);
5890 throw INTERP_KERNEL::Exception(msg);
5901 self->setPartOfValuesSimple3(vc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1);
5907 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(sc);
5908 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5911 //value vector<string>
5914 MCAuto<DataArrayAsciiChar> tmp=DataArrayAsciiChar::New(vsc,' ');
5915 self->setPartOfValues3(tmp,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5918 //value DataArrayChar
5921 self->setPartOfValues3(dacc,daIntTyypp->begin(),daIntTyypp->end(),0,nbOfCompo,1,false);
5925 throw INTERP_KERNEL::Exception(msg);
5930 throw INTERP_KERNEL::Exception(msg);
5936 class DataArrayAsciiCharTuple;
5938 class DataArrayAsciiCharIterator
5941 DataArrayAsciiCharIterator(DataArrayAsciiChar *da);
5942 ~DataArrayAsciiCharIterator();
5947 DataArrayAsciiCharTuple *ret=self->nextt();
5949 return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_MEDCoupling__DataArrayAsciiCharTuple,SWIG_POINTER_OWN | 0);
5952 PyErr_SetString(PyExc_StopIteration,"No more data.");
5959 class DataArrayAsciiCharTuple
5962 int getNumberOfCompo() const throw(INTERP_KERNEL::Exception);
5963 DataArrayAsciiChar *buildDAAsciiChar(int nbOfTuples, int nbOfCompo) const throw(INTERP_KERNEL::Exception);
5966 std::string __str__() const throw(INTERP_KERNEL::Exception)
5968 return self->repr();
5971 DataArrayAsciiChar *buildDAAsciiChar() throw(INTERP_KERNEL::Exception)
5973 return self->buildDAAsciiChar(1,self->getNumberOfCompo());